Skip to content

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

@vladbazon

Description

@vladbazon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lexingarea: changes to individual lexers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions