summaryrefslogtreecommitdiff
path: root/pygments/lexers/asm.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2011-03-19 20:00:07 -0700
committerTim Hatch <tim@timhatch.com>2011-03-19 20:00:07 -0700
commite7c58665d02d9a9ca75f7600361c8bb2f1989981 (patch)
tree664ee459ce61070f08f69d781065a4e22e3775d7 /pygments/lexers/asm.py
parenta220bbdfb2be4343b8f4a569ad827eecf8251989 (diff)
downloadpygments-e7c58665d02d9a9ca75f7600361c8bb2f1989981.tar.gz
Bulk changes to improve many lexers inner workings
Based on a suspicion that most examplefiles only exercise a small part of the lexers, I've written some code to find suspicious parts of regular expressions, then gone back over those to fix them. Most of these affect whether the regex does what it looks like it does, but none of them should appreciably change the function of the lexer. * a few cases which used capturing groups + bygroups incorrectly (most were harmless, but I think one could have generated a traceback in its previous state) * a few cases which could match empty string, without a callback (this is highly discouraged, because if an op doesn't consume any characters, it might be possible to enter an empty loop). I'll revisit individually the cases where a callback or state push is used. * many cases with embedded newlines in non-verbose regexes * many, many cases with reversed (else|elseif) style alternations
Diffstat (limited to 'pygments/lexers/asm.py')
-rw-r--r--pygments/lexers/asm.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py
index 4740569c..57c6be1b 100644
--- a/pygments/lexers/asm.py
+++ b/pygments/lexers/asm.py
@@ -130,17 +130,17 @@ class ObjdumpLexer(RegexLexer):
('( *)('+hex+r'+:)(\t)((?:'+hex+hex+' )+)$',
bygroups(Text, Name.Label, Text, Number.Hex)),
# Skipped a few bytes
- ('\t\.\.\.$', Text),
+ (r'\t\.\.\.$', Text),
# Relocation line
# (With offset)
- ('(\t\t\t)('+hex+'+:)( )([^\t]+)(\t)(.*?)([-+])(0x' + hex + '+)$',
+ (r'(\t\t\t)('+hex+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x' + hex + '+)$',
bygroups(Text, Name.Label, Text, Name.Property, Text,
Name.Constant, Punctuation, Number.Hex)),
# (Without offset)
- ('(\t\t\t)('+hex+'+:)( )([^\t]+)(\t)(.*?)$',
+ (r'(\t\t\t)('+hex+r'+:)( )([^\t]+)(\t)(.*?)$',
bygroups(Text, Name.Label, Text, Name.Property, Text,
Name.Constant)),
- ('[^\n]+\n', Other)
+ (r'[^\n]+\n', Other)
]
}