1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #798 resolved

Coloring makefile assignments incorrectly

Anonymous created an issue

In the development codebase fromt bitbucket, the BaseMakefile Lexer handles assignments syntax incorrectly. The buggy regex used there will cause all text to be parsed by BashLexer after the first assignment of the input.

The attachment is the patch to fix the buggy regex. Sorry that I am new to hg and bitbucket. I could not find a way to attach the patch file, so I just put it here:

changeset: 1616:b79e4674bc30 tag: tip user: Ken Wu ken.wu@ruckuswireless.com date: Thu Aug 16 15:57:51 2012 +0800 summary: Fixed regular expressions for assignment in BaseMakefileLexer. The

diff -r bed423abed70 -r b79e4674bc30 pygments/lexers/text.py --- a/pygments/lexers/text.py Tue Aug 14 00:40:51 2012 +0900 +++ b/pygments/lexers/text.py Thu Aug 16 15:57:51 2012 +0800 @@ -187,7 +187,7 @@ bygroups(Keyword, Text), 'export'), (r'export\s+', Keyword), # assignment - (r'([a-zA-Z0-9_${}.-]+)(\s)([!?:+]?=)([ \t])((?:.\\n|.\n)+)', + (r'([a-zA-Z0-9_${}.-]+)(\s)([!?:+]?=)([ \t])((?:.\\n)+|.\n)', bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))), # strings (r'(?s)"(\\|\.|[^"\])*"', String.Double),

Comments (4)

  1. Log in to comment