usagi-coffee / tree-sitter-abl

OpenEdge ABL grammar for tree-sitter
MIT License
7 stars 1 forks source link

Issue with escape characters #77

Closed eglekaz closed 1 month ago

eglekaz commented 1 month ago

After the previous fix related to the string, containing special characters, seems that escape character is still messing up tree structure. Here is the string containing those: nonAlphaChars = "!@#$%^&*()-_=+[]{}\|;:'~",<.>/?~~"

If the characters ~ are in the string then the code from some previous double quoted string up until this one is considered as a double_quoted_string and it brings up errors. When I removed all ~ from the string, then issue is not there anymore.

Example:

  method public static log isAlpha(oneChar as char):
    if oneChar >= "a" and oneChar <= "z" then
      return true.

    return false.
  end.

  method public static char replaceNonAlpha():
    def var nonAlphaChars as char no-undo.

    nonAlphaChars = "!@#$%^&*()-_=+[]{}\|;:'~",<.>/?~~".

    return nonAlphaChars.
  end method.

Tree shows that double_quoted_string starts from "a" and ends with ending of special char string.

jkbz64 commented 1 month ago

Okay... I think we'll try to just use external scanner for all strings, now double_quoted_string and single_quoted string will be just string_literal... Deploying in 0.0.36

jkbz64 commented 1 month ago

This is quite drastic change, let me know if it stays the same or you care about diffrentiating between single_quoted and double_quoted (I don't think progress does..., does it?)

eglekaz commented 1 month ago

It is working correctly now. And at least at the moment I don't see a reason, why we would need to differentiate between those. All good! Thank you!