Commits

Rob Hoelz  committed 0b64109

Allow "multi-bracket" regexes

This isn't an offical Perl 6 term; this is a term I use to denote
a common bug I've found in my lexer. It involves things that look
like this:

m«< some stuff»

This used to parse incorrectly.

  • Participants
  • Parent commits 8387651

Comments (0)

Files changed (1)

File pygments/lexers/agile.py

             ( r'(?<=~~)\s*/(?:\\\\|\\/|.)*?/', String.Regex ),
             ( r'(?<=[=(,])\s*/(?:\\\\|\\/|.)*?/', String.Regex ),
             ( r'm\w+(?=[(])', Name ),
-            ( r'(?:m|ms|rx)\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>[^0-9a-zA-Z:\s]+)', brackets_callback(String.Regex) ),
+            ( r'(?:m|ms|rx)\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^0-9a-zA-Z:\s])(?P=first_char)*)', brackets_callback(String.Regex) ),
             ( r'(?:s|ss|tr)\s*(?::[\w\s:]+)?\s*/(?:\\\\|\\/|.)*?/(?:\\\\|\\/|.)*?/', String.Regex ),
             ( r'<[^\s=].*?\S>', String ),
             ( _build_word_match([ re.escape(x) for x in PERL6_OPERATORS]), Operator ),