diff options
author | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-24 00:09:36 -0400 |
---|---|---|
committer | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-24 00:09:36 -0400 |
commit | 69c05683c3de2a6ee30b64be88e79a4ef923e230 (patch) | |
tree | 4e56b12327d33f601f978a5c83dbbf389d694ba2 /pygments/lexers/compiled.py | |
parent | ae21a04728b251fe5fc7feac80b98cdf4ebffb18 (diff) | |
download | pygments-69c05683c3de2a6ee30b64be88e79a4ef923e230.tar.gz |
Change token for literal numbers, arrays and dictionaries from punctuation to literal
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r-- | pygments/lexers/compiled.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 2dc2a619..8da62c84 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -1391,7 +1391,9 @@ def objective(baselexer): (r'@0x[0-9a-fA-F]+[Ll]?', Number.Hex), (r'@0[0-7]+[Ll]?', Number.Oct), (r'@\d+[Ll]?', Number.Integer), - (r'@\([^()]+\)', Number), + (r'@\(', Literal, 'literal_number'), + (r'@\[', Literal, 'literal_array'), + (r'@\{', Literal, 'literal_dictionary'), (r'(@selector|@private|@protected|@public|@encode|' r'@synchronized|@try|@throw|@catch|@finally|@end|@property|' r'__bridge|__bridge_transfer|__autoreleasing|__block|__weak|__strong|' @@ -1466,6 +1468,30 @@ def objective(baselexer): ('{', Punctuation, 'function'), ('', Text, '#pop'), ], + 'literal_number': [ + (r'\(', Punctuation, 'literal_number_inner'), + (r'\)', Literal, '#pop'), + include('statement'), + ], + 'literal_number_inner': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + include('statement'), + ], + 'literal_array': [ + (r'\[', Punctuation, 'literal_array_inner'), + (r'\]', Literal, '#pop'), + include('statement'), + ], + 'literal_array_inner': [ + (r'\[', Punctuation, '#push'), + (r'\]', Punctuation, '#pop'), + include('statement'), + ], + 'literal_dictionary': [ + (r'\}', Literal, '#pop'), + include('statement'), + ], } def analyse_text(text): |