Commits

Rob Hoelz  committed e874187

Make the :sym following a token identifer optional

The previous regex had a bug where it would only consume an identifier
following the token/regex/rule keyword if it ended in :sym. This caused
some token names to be improperly highlighted

  • Participants
  • Parent commits 69ea2c9

Comments (0)

Files changed (1)

File pygments/lexers/agile.py

             ( r'^(\s*)=begin\s+(\w+)\b.*?^\1=end\s+\2', Comment.Multiline ),
             ( r'^(\s*)=for.*?\n\s*?\n', Comment.Multiline ),
             ( r'^=.*?\n\s*?\n', Comment.Multiline ),
-            ( r'(regex|token|rule)(?![' + PERL6_IDENTIFIER_CHARS + '])(\s*[' + PERL6_IDENTIFIER_CHARS + ']+:sym<.*?>)?', bygroups(Keyword, Name), 'pre-token' ),
+            ( r'(regex|token|rule)(?![' + PERL6_IDENTIFIER_CHARS + '])(\s*[' + PERL6_IDENTIFIER_CHARS + ']+(?::sym<.*?>)?)?', bygroups(Keyword, Name), 'pre-token' ),
             # deal with a special class in the Perl 6 grammar (role q { ... })
             ( r'(role)(\s*)(q)(\s*)', bygroups(Keyword, Text, Name, Text) ),
             ( _build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_CHARS), Keyword ),