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

🪲 nested blocks error #5395

Closed
Felienne opened this issue Apr 11, 2024 · 0 comments · Fixed by #5409
Closed

🪲 nested blocks error #5395

Felienne opened this issue Apr 11, 2024 · 0 comments · Fixed by #5409
Assignees
Labels
bug Something isn't working

Comments

@Felienne
Copy link
Member

Describe the bug
Adding an extra line in a nested block gives an error:

image
repeat 10 times
    hoek is ask 'Hoe ver moet ik draaien?'
    repeat 5 times
        forward 10
        turn hoek
    forward 100

But without the final line, it does work:

image
@Felienne Felienne added the bug Something isn't working label Apr 11, 2024
@Felienne Felienne changed the title 🪲 🪲 nested blocks error Apr 11, 2024
@mergify mergify bot closed this as completed in #5409 Apr 19, 2024
mergify bot pushed a commit that referenced this issue Apr 19, 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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants