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

🪲 Exclude end blocks from comments #5409

Merged
merged 3 commits into from
Apr 19, 2024
Merged

🪲 Exclude end blocks from comments #5409

merged 3 commits into from
Apr 19, 2024

Conversation

boryanagoncharenko
Copy link
Collaborator

@boryanagoncharenko boryanagoncharenko commented Apr 14, 2024

Fixes #5395
In a specific case, an end block (#ENDBLOCK) is parsed as a comment. This PR excludes end blocks from the definition of comments. Note comments are ignored in the parse tree, while end blocks are not. To ensure we will not leak an end block in an parse error message, I altered the textwithoutspaces to include a potential end block.

How to test

  • Ensure that the following program does not produce an error in level 9
repeat 3 times
    print 3
    repeat 5 times
        print 5
    print 1
  • Ensure that the following program does not show an error message which leaks a character from the endblock. It should mention that the unexpected character is a new line and not #:
for i in range 1 to 10
    print i

@boryanagoncharenko boryanagoncharenko marked this pull request as draft April 14, 2024 10:43
@boryanagoncharenko boryanagoncharenko changed the title 🪲 Seeking help for a nested repeat bug #5395 🪲 Seeking help for a nested repeat bug Apr 14, 2024
@jpelay
Copy link
Member

jpelay commented Apr 16, 2024

Hi @boryanagoncharenko! You've probably already tried this, but maybe we can leverage this feature of Lark? https://lark-parser.readthedocs.io/en/stable/examples/fruitflies.html

@boryanagoncharenko boryanagoncharenko marked this pull request as ready for review April 18, 2024 14:09
@boryanagoncharenko boryanagoncharenko changed the title 🪲 Seeking help for a nested repeat bug 🪲 Exclude end blocks from comments Apr 18, 2024
@jpelay jpelay self-assigned this Apr 18, 2024
Copy link
Member

@jpelay jpelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!!!

Copy link
Contributor

mergify bot commented Apr 19, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Apr 19, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 703b8d8 into main Apr 19, 2024
12 checks passed
@mergify mergify bot deleted the nested_repeat_5395 branch April 19, 2024 21:27
Copy link
Contributor

mergify bot commented Apr 19, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🪲 nested blocks error
2 participants