hedyorg / hedy

Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
https://www.hedy.org
European Union Public License 1.2
1.33k stars 289 forks source link

🪲 Stop highlighting unmatched quotes #5693

Closed jpelay closed 3 months ago

jpelay commented 3 months ago

The old way to handle strings, was to use a grammar rule that allowed everything between quotation marks. However, this had the problem that it highlighted even strings that were not complete, and even would mess the highlighting of the next lines. That's why I changed it here to a token rule, and now it properly handles strings that are not well formed.

Another change that I found out while working on this, was that list assignments from level12 onwards were not working properly because they still were expecting text without quotes.

This is the behaviour now:

image

This is how it looked before:

image

As you can see now, it's a lot clearer to know the exact line that is causing issues.

Fixes #4874

How to test

Write an unfinished string in any of the levels from 4 onwards.

mergify[bot] commented 3 months ago

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[bot] commented 3 months ago

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).