summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2009-11-23 21:16:37 +0100
committergbrandl <devnull@localhost>2009-11-23 21:16:37 +0100
commit610664cf5f590235ec02fb96a6dc190d2a889e20 (patch)
tree7a5f6b284e427b2de3b67e1beba091830ef2c78f
parent1602ecc89a303541affa2d5fa1b6ce1b32629960 (diff)
downloadpygments-610664cf5f590235ec02fb96a6dc190d2a889e20.tar.gz
A few ASM lexer fixes (#450).
-rw-r--r--CHANGES4
-rw-r--r--pygments/lexers/asm.py11
2 files changed, 9 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 31f18125..3d143da2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -23,7 +23,9 @@ Version 1.2
- Fixed the CLexer to not highlight ternary statements as labels.
-- added new float ops to LLVM
+- A few ASM lexer fixes (#450).
+
+- Added new float ops to LLVM.
Version 1.1.1
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py
index cbeadc5b..7b7c9b22 100644
--- a/pygments/lexers/asm.py
+++ b/pygments/lexers/asm.py
@@ -275,7 +275,7 @@ class NasmLexer(RegexLexer):
mimetypes = ['text/x-nasm']
identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?#@~]*'
- hexn = r'(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9a-fA-F]+h)'
+ hexn = r'(?:0[xX][0-9a-fA-F]+|$0[0-9a-fA-F]*|[0-9]+[0-9a-fA-F]*h)'
octn = r'[0-7]+q'
binn = r'[01]+b'
decn = r'[0-9]+'
@@ -287,7 +287,8 @@ class NasmLexer(RegexLexer):
wordop = r'seg|wrt|strict'
type = r'byte|[dq]?word'
directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
- r'COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE')
+ r'ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|'
+ r'EXPORT|LIBRARY|MODULE')
flags = re.IGNORECASE | re.MULTILINE
tokens = {
@@ -295,10 +296,10 @@ class NasmLexer(RegexLexer):
include('whitespace'),
(r'^\s*%', Comment.Preproc, 'preproc'),
(identifier + ':', Name.Label),
- (directives, Keyword, 'instruction-args'),
- (r'(%s)\s+(equ)' % identifier,
- bygroups(Name.Constant, Keyword.Declaration),
+ (r'(%s)(\s+)(equ)' % identifier,
+ bygroups(Name.Constant, Keyword.Declaration, Keyword.Declaration),
'instruction-args'),
+ (directives, Keyword, 'instruction-args'),
(declkw, Keyword.Declaration, 'instruction-args'),
(identifier, Name.Function, 'instruction-args'),
(r'[\r\n]+', Text)