GAS assembly lexer doesn't highlight negative values

Anonymous avatarAnonymous 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.