Skip to content

Conversation

brianpeiris
Copy link
Contributor

@brianpeiris brianpeiris commented Sep 5, 2025

Fixes #5757

The highlighting grammar for Level 13 explicitly allowed for Numbers when using the pressed keyword, as part of the EqualityCheck rule. Subsequent grammars (Level 14-18) omitted Numbers since the rule was split out into a dedicated PressedCheck rule. This PR reintroduces Numbers in the pressed grammar rule to fix the highlighting when expecting a number key press.

How to test

Follow these steps to verify this PR works as intended:

if 1 is pressed
    print 'one'
else
    print 'waiting for second key'
    if x is pressed
        print 'x'
    else
        print '?'
stop = False
key = 'x'
while stop == False:
    if 1 is pressed:
        print 'one'
    elif a is pressed:
        print 'a'
    elif key is pressed:
        print 'x'
        stop = True
    else:
        print '?'
  • See that pressed is highlighted orange in all the if and elif conditions

Checklist

  • Contains one of the PR categories in the name
  • Describes changes in the format above
  • Links to an existing issue or discussion
  • Has a "How to test" section

@Felienne
Copy link
Member

Felienne commented Sep 5, 2025

Thanks for the fix @brianpeiris!

We are about to make some large changes to the grammar (see #6329) which will then also impact the highlighter, so we need to keep this PR for a little while until @jpelay is ready with the highlighter.

@jpelay Can you take this into account when updating the highlighter?

@jpelay jpelay self-assigned this Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress
Status: Review for relevance

Development

Successfully merging this pull request may close these issues.

🪲 pressed not highlighted when number is used as key to press

3 participants