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

SLexer - break, next, else, in, repeat as Name.Function, not Name #2082

Open
vladbazon opened this issue Mar 7, 2022 · 1 comment · May be fixed by #2087
Open

SLexer - break, next, else, in, repeat as Name.Function, not Name #2082

vladbazon opened this issue Mar 7, 2022 · 1 comment · May be fixed by #2087

Comments

@vladbazon
Copy link

By SLexer, 'break(' IS a Name.Function token, but 'break' (without '()') is not.

For highlighting 'break', 'else' etc. -- we exclude him from the key 'keywords' (in r.py):
'keywords': [
(r'(if|for|while|return|switch|function)'
r'(?![\w.])',
Keyword.Reserved),
],

and we specify him on the _first scanned state in 'root':
'root': [
# calls:
(r'\b(else|next|break|repeat|in)\b', Name.Function),
(r'(%s)\s*(?=()' % valid_name, Name.Function),
include('statements'),
# blocks:
(r'{|}', Punctuation),
# (r'{', Punctuation, 'block'),
(r'.', Text),
],

Indeed, a very simple solution...

@jeanas
Copy link
Contributor

jeanas commented Mar 7, 2022

Would you be willing to prepare a PR?

@jeanas jeanas linked a pull request Mar 13, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants