Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

variable of two keywords got splited during parsing #113

Open
eglekaz opened this issue Aug 28, 2024 · 3 comments
Open

variable of two keywords got splited during parsing #113

eglekaz opened this issue Aug 28, 2024 · 3 comments
Labels
blocked by 🌳 Blocked by tree-sitter implementation bug Something isn't working

Comments

@eglekaz
Copy link
Collaborator

eglekaz commented Aug 28, 2024

Variable outputStream in VAR statement was recognized as identifier, but later parsed as two separate keywords, which brings up error and rest of the file is not being formatted.

Example:

method public void WriteJson(filePath as char, inputJson as Object):
    var JsonSerializer jsonSerializer = new JsonSerializer(true).
    var FileOutputStream outputStream = new FileOutputStream(filePath).

    jsonSerializer:Serialize(inputJson, outputStream).
    outputStream:Close().
end method.

image
image
image
image

@eglekaz eglekaz added bug Something isn't working to create 🌳 Create and link tree-sitter ticket labels Aug 28, 2024
@eglekaz
Copy link
Collaborator Author

eglekaz commented Aug 28, 2024

Same happened with inputTable. And then after this it even thought that "def" in word "default" is DEFINE. Example:
This:

if inputTable:default-buffer-handle:available = false then
      undo, throw new AppException(ErrorCode:RECORD_NOT_FOUND, inputTable:name).

Became this:
if inputTable:defineault-buffer-handle:available = false then undo, throw new AppException(ErrorCode:RECORD_NOT_FOUND, inputTable:name).

@PauliusKu PauliusKu added blocked by 🌳 Blocked by tree-sitter implementation and removed to create 🌳 Create and link tree-sitter ticket labels Aug 28, 2024
@eglekaz
Copy link
Collaborator Author

eglekaz commented Sep 3, 2024

Adding description from other issue as well (Cannot name variables that start with "for" or "define"):
For example,

case dateFormat:
    when "YYYYYMMDD"
    then
        formattedDate = STRING(day, "99").
    otherwise
        message "HEEOLOO".
end.

turns into:

case dateFormat:
    when "YYYYYMMDD"
    then for
        mattedDate = STRING(day, "99").
    otherwise
        message "HEEOLOO".
end.

Similarly, if you use "define," it can result in:

case dateFormat:
    when "YYYYYMMDD"
    then define
        mattedDate = STRING(day, "99").
    otherwise
        message "HEEOLOO".
end.

image

@eglekaz
Copy link
Collaborator Author

eglekaz commented Sep 4, 2024

Registered: usagi-coffee/tree-sitter-abl#53

This was referenced Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by 🌳 Blocked by tree-sitter implementation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants