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

Unicode character not parsed correctly #284

Closed
goretkin opened this issue Jun 9, 2021 · 3 comments
Closed

Unicode character not parsed correctly #284

goretkin opened this issue Jun 9, 2021 · 3 comments

Comments

@goretkin
Copy link

goretkin commented Jun 9, 2021

julia> CSTParser.parse("∪⃑")
  1:6   ErrorToken
  1:3    OP: UNION
  4:6    ErrorToken( CSTParser.UnexpectedToken)
  4:6     ErrorToken( CSTParser.Unknown)


julia> Meta.parse("∪⃑")
:

Manifests as false positive in julia-vscode linter:

image

image

Even though running it gives:

julia> using LintTest: ⃑


julia> (a=1, b=2) ⃑ (a=10, c=30)
(a = 10, b = 2, c = 30)

For clarity:

help?> "∪⃑" can be typed by \cup<tab>\rightharpoonaccent<tab>

search:

  No documentation found.

  Binding ⃑ does not exist.
@goretkin
Copy link
Author

goretkin commented Jun 9, 2021

I suppose this is the problem:

julia> CSTParser.Tokenize.Lexers.isopsuffix(collect("∪⃑")[2])
false

@goretkin
Copy link
Author

goretkin commented Jun 9, 2021

I see that this actually is a problem with less esoteric symbols:

julia> dump(Meta.parse("1 +̄ 2"))
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol +̄
    2: Int64 1
    3: Int64 2

julia> CSTParser.parse("1 +̄ 2")
  1:7   call
  1:1    OP: +
  2:3    INTEGER: 1
  4:7    errortoken
  4:6     errortoken( CSTParser.UnexpectedToken)
  4:6      errortoken( CSTParser.Unknown)
  7:7     INTEGER: 2

@pfitzseb
Copy link
Member

Closing in favor of JuliaLang/Tokenize.jl#180.

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

No branches or pull requests

2 participants