ThirdParty/Pygments/pygments/lexers/asm.py

changeset 6651
e8f3b5568b21
parent 5713
6762afd9f963
equal deleted inserted replaced
6650:1dd52aa8897c 6651:e8f3b5568b21
33 mimetypes = ['text/x-gas'] 33 mimetypes = ['text/x-gas']
34 34
35 #: optional Comment or Whitespace 35 #: optional Comment or Whitespace
36 string = r'"(\\"|[^"])*"' 36 string = r'"(\\"|[^"])*"'
37 char = r'[\w$.@-]' 37 char = r'[\w$.@-]'
38 identifier = r'(?:[a-zA-Z$_]' + char + '*|\.' + char + '+)' 38 identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
39 number = r'(?:0[xX][a-zA-Z0-9]+|\d+)' 39 number = r'(?:0[xX][a-zA-Z0-9]+|\d+)'
40 40
41 tokens = { 41 tokens = {
42 'root': [ 42 'root': [
43 include('whitespace'), 43 include('whitespace'),
51 (identifier, Name.Constant), 51 (identifier, Name.Constant),
52 (string, String), 52 (string, String),
53 ('@' + identifier, Name.Attribute), 53 ('@' + identifier, Name.Attribute),
54 (number, Number.Integer), 54 (number, Number.Integer),
55 (r'[\r\n]+', Text, '#pop'), 55 (r'[\r\n]+', Text, '#pop'),
56 (r'[;#].*?\n', Comment, '#pop'),
56 57
57 include('punctuation'), 58 include('punctuation'),
58 include('whitespace') 59 include('whitespace')
59 ], 60 ],
60 'instruction-args': [ 61 'instruction-args': [
74 ('%' + identifier, Name.Variable), 75 ('%' + identifier, Name.Variable),
75 # Numeric constants 76 # Numeric constants
76 ('$'+number, Number.Integer), 77 ('$'+number, Number.Integer),
77 (r"$'(.|\\')'", String.Char), 78 (r"$'(.|\\')'", String.Char),
78 (r'[\r\n]+', Text, '#pop'), 79 (r'[\r\n]+', Text, '#pop'),
80 (r'[;#].*?\n', Comment, '#pop'),
79 81
80 include('punctuation'), 82 include('punctuation'),
81 include('whitespace') 83 include('whitespace')
82 ], 84 ],
83 'whitespace': [ 85 'whitespace': [
254 256
255 (hexfloat, Number.Hex), 257 (hexfloat, Number.Hex),
256 (r'0[xX][a-fA-F0-9]+', Number.Hex), 258 (r'0[xX][a-fA-F0-9]+', Number.Hex),
257 (ieeefloat, Number.Float), 259 (ieeefloat, Number.Float),
258 (float, Number.Float), 260 (float, Number.Float),
259 ('\d+', Number.Integer), 261 (r'\d+', Number.Integer),
260 262
261 (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation) 263 (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation)
262 ], 264 ],
263 'whitespace': [ 265 'whitespace': [
264 (r'(\n|\s)+', Text), 266 (r'(\n|\s)+', Text),
265 ], 267 ],
266 'comments': [ 268 'comments': [
267 (r'/\*.*?\*/', Comment.Multiline), 269 (r'/\*.*?\*/', Comment.Multiline),
268 (r'//.*?\n', Comment.Singleline), 270 (r'//.*?\n', Comment.Single),
269 ], 271 ],
270 'keyword': [ 272 'keyword': [
271 # Types 273 # Types
272 (r'kernarg' + datatypeMod, Keyword.Type), 274 (r'kernarg' + datatypeMod, Keyword.Type),
273 275
348 tokens = { 350 tokens = {
349 'root': [ 351 'root': [
350 include('whitespace'), 352 include('whitespace'),
351 353
352 # Before keywords, because keywords are valid label names :(... 354 # Before keywords, because keywords are valid label names :(...
353 (identifier + '\s*:', Name.Label), 355 (identifier + r'\s*:', Name.Label),
354 356
355 include('keyword'), 357 include('keyword'),
356 358
357 (r'%' + identifier, Name.Variable), 359 (r'%' + identifier, Name.Variable),
358 (r'@' + identifier, Name.Variable.Global), 360 (r'@' + identifier, Name.Variable.Global),

eric ide

mercurial