Skip to content

Commit

Permalink
add support for lexing attributes in Chapel (#2376)
Browse files Browse the repository at this point in the history
Chapel 1.30 includes support for attributes. The lexer was not able to process them without some adjustments.

Co-authored-by: amitkummer <49096391+amitkummer@users.noreply.github.com>
  • Loading branch information
arezaii and amitkummer committed Mar 28, 2023
1 parent d2cf5e9 commit 2a2537d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pygments/lexers/chapel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class ChapelLexer(RegexLexer):
(words(known_types, suffix=r'\b'), Keyword.Type),
(words((*type_modifiers, *other_keywords), suffix=r'\b'), Keyword),

(r'@', Keyword, 'attributename'),
(r'(iter)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
(r'(proc)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
(r'(operator)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
Expand Down Expand Up @@ -133,4 +134,7 @@ class ChapelLexer(RegexLexer):
(words(known_types, suffix=r'\b'), Keyword.Type),
(r'[^()]*', Name.Other, '#pop'),
],
'attributename': [
(r'[a-zA-Z_][.\w$]*', Name.Decorator, '#pop'),
],
}

0 comments on commit 2a2537d

Please sign in to comment.