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

GAS assembly lexer doesn't highlight negative values

Anonymous created an issue

Hi, I spotted a problem that negative values in GAS are not highlighted correctly. For example:

subl $16, %esp

In this case $16 is highlighted like any other value and that's good. However:

subl $-16, %esp

And $-16 isn't highlighted correctly. I made following change (added '-' character to regular expression):

{{{ diff -r 96e8b9cb83ef pygments/lexers/asm.py --- a/pygments/lexers/asm.py Thu Apr 05 10:27:51 2012 -0700 +++ b/pygments/lexers/asm.py Wed Apr 18 21:27:56 2012 +0200 @@ -31,7 +31,7 @@

 #: optional Comment or Whitespace
 string = r'"(\\"|[^"])*"'
  • char = r'[a-zA-Z$._0-9@]'
  • char = r'[a-zA-Z$.0-9@-]' identifier = r'(?:[a-zA-Z$]' + char + '*|.' + char + '+)' number = r'(?:0[xX][a-zA-Z0-9]+|\d+)' }}}

And it worked.

Comments (2)

  1. Log in to comment