Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multidimensional parse issue #350

Closed
domluna opened this issue Jun 29, 2022 · 2 comments · Fixed by #351
Closed

Multidimensional parse issue #350

domluna opened this issue Jun 29, 2022 · 2 comments · Fixed by #351

Comments

@domluna
Copy link

domluna commented Jun 29, 2022

These should be the same no?

julia> str |> print
[1;; 2]
julia> x |> print
[
    1;;
    2
]
julia> CSTParser.parse(str)
  1:7   ncat
  1:0    2
  1:4    INTEGER: 1
  5:5    INTEGER: 2

julia>

julia> CSTParser.parse(x)
  1:17  vcat
  1:10   row
  1:8     INTEGER: 1
  9:10    INTEGER: 2
@domluna
Copy link
Author

domluna commented Jul 12, 2022

julia> str = "[v1 v2;;]"
"[v1 v2;;]"

julia> o = format_text(str, margin=1)
"[\n    v1 v2;;\n]"

julia> CSTParser.parse(str)
  1:9   ncat
  1:0    2
  1:7    row
  1:3     v1
  4:7     v2


julia> o |> print
[
    v1 v2;;
]
julia> CSTParser.parse(o)
  1:15  hcat
  1:3    v1
  4:8    v2

Another example where this breaks @pfitzseb

@pfitzseb
Copy link
Member

The second case is actually parsed correctly; the first one is illegal:

julia> dump(Meta.parse("""[
           v1 v2;;
       ]"""))
Expr
  head: Symbol hcat
  args: Array{Any}((2,))
    1: Symbol v1
    2: Symbol v2

julia> dump(Meta.parse("""[v1 v2;;]"""))
ERROR: Base.Meta.ParseError("cannot mix space and ;; separators in an array expression, except to wrap a line")

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants