Commits

Rob Hoelz committed aea6d85

Perl 6: Make end-of-heredoc search more exact

Technically we need to start searching after the end of the heredoc
terminator declaration, not the end of the quote word delimiter. It
probably won't cause any problems in real world code, but it will
probably reduce the number of WTFs generated while reading it.

Comments (0)

Files changed (1)

pygments/lexers/agile.py

 
             if adverbs is not None and re.search(r':to\b', adverbs):
                 heredoc_terminator = text[match.start('delimiter') + n_chars : end_pos]
-                end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) + r'\s*$', text[ match.end('delimiter') : ], re.MULTILINE)
+                end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) + r'\s*$', text[ end_pos : ], re.MULTILINE)
 
                 if end_heredoc:
-                    end_pos = match.end('delimiter') + end_heredoc.end()
+                    end_pos += end_heredoc.end()
                 else:
                     end_pos = len(text)