3 pygments.lexers.asm |
3 pygments.lexers.asm |
4 ~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for assembly languages. |
6 Lexers for assembly languages. |
7 |
7 |
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
14 from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingLexer |
14 from pygments.lexer import RegexLexer, include, bygroups, using, words, \ |
|
15 DelegatingLexer |
15 from pygments.lexers.c_cpp import CppLexer, CLexer |
16 from pygments.lexers.c_cpp import CppLexer, CLexer |
16 from pygments.lexers.d import DLexer |
17 from pygments.lexers.d import DLexer |
17 from pygments.token import Text, Name, Number, String, Comment, Punctuation, \ |
18 from pygments.token import Text, Name, Number, String, Comment, Punctuation, \ |
18 Other, Keyword, Operator |
19 Other, Keyword, Operator |
19 |
20 |
20 __all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer', |
21 __all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer', |
21 'CObjdumpLexer', 'LlvmLexer', 'NasmLexer', 'NasmObjdumpLexer', |
22 'CObjdumpLexer', 'HsailLexer', 'LlvmLexer', 'NasmLexer', |
22 'Ca65Lexer'] |
23 'NasmObjdumpLexer', 'TasmLexer', 'Ca65Lexer'] |
23 |
24 |
24 |
25 |
25 class GasLexer(RegexLexer): |
26 class GasLexer(RegexLexer): |
26 """ |
27 """ |
27 For Gas (AT&T) assembly code. |
28 For Gas (AT&T) assembly code. |
196 |
195 |
197 def __init__(self, **options): |
196 def __init__(self, **options): |
198 super(CObjdumpLexer, self).__init__(CLexer, ObjdumpLexer, **options) |
197 super(CObjdumpLexer, self).__init__(CLexer, ObjdumpLexer, **options) |
199 |
198 |
200 |
199 |
|
200 class HsailLexer(RegexLexer): |
|
201 """ |
|
202 For HSAIL assembly code. |
|
203 |
|
204 .. versionadded:: 2.2 |
|
205 """ |
|
206 name = 'HSAIL' |
|
207 aliases = ['hsail', 'hsa'] |
|
208 filenames = ['*.hsail'] |
|
209 mimetypes = ['text/x-hsail'] |
|
210 |
|
211 string = r'"[^"]*?"' |
|
212 identifier = r'[a-zA-Z_][\w.]*' |
|
213 # Registers |
|
214 register_number = r'[0-9]+' |
|
215 register = r'(\$(c|s|d|q)' + register_number + ')' |
|
216 # Qualifiers |
|
217 alignQual = r'(align\(\d+\))' |
|
218 widthQual = r'(width\((\d+|all)\))' |
|
219 allocQual = r'(alloc\(agent\))' |
|
220 # Instruction Modifiers |
|
221 roundingMod = (r'((_ftz)?(_up|_down|_zero|_near))') |
|
222 datatypeMod = (r'_(' |
|
223 # packedTypes |
|
224 r'u8x4|s8x4|u16x2|s16x2|u8x8|s8x8|u16x4|s16x4|u32x2|s32x2|' |
|
225 r'u8x16|s8x16|u16x8|s16x8|u32x4|s32x4|u64x2|s64x2|' |
|
226 r'f16x2|f16x4|f16x8|f32x2|f32x4|f64x2|' |
|
227 # baseTypes |
|
228 r'u8|s8|u16|s16|u32|s32|u64|s64|' |
|
229 r'b128|b8|b16|b32|b64|b1|' |
|
230 r'f16|f32|f64|' |
|
231 # opaqueType |
|
232 r'roimg|woimg|rwimg|samp|sig32|sig64)') |
|
233 |
|
234 # Numeric Constant |
|
235 float = r'((\d+\.)|(\d*\.\d+))[eE][+-]?\d+' |
|
236 hexfloat = r'0[xX](([0-9a-fA-F]+\.[0-9a-fA-F]*)|([0-9a-fA-F]*\.[0-9a-fA-F]+))[pP][+-]?\d+' |
|
237 ieeefloat = r'0((h|H)[0-9a-fA-F]{4}|(f|F)[0-9a-fA-F]{8}|(d|D)[0-9a-fA-F]{16})' |
|
238 |
|
239 tokens = { |
|
240 'root': [ |
|
241 include('whitespace'), |
|
242 include('comments'), |
|
243 |
|
244 (string, String), |
|
245 |
|
246 (r'@' + identifier + ':?', Name.Label), |
|
247 |
|
248 (register, Name.Variable.Anonymous), |
|
249 |
|
250 include('keyword'), |
|
251 |
|
252 (r'&' + identifier, Name.Variable.Global), |
|
253 (r'%' + identifier, Name.Variable), |
|
254 |
|
255 (hexfloat, Number.Hex), |
|
256 (r'0[xX][a-fA-F0-9]+', Number.Hex), |
|
257 (ieeefloat, Number.Float), |
|
258 (float, Number.Float), |
|
259 ('\d+', Number.Integer), |
|
260 |
|
261 (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation) |
|
262 ], |
|
263 'whitespace': [ |
|
264 (r'(\n|\s)+', Text), |
|
265 ], |
|
266 'comments': [ |
|
267 (r'/\*.*?\*/', Comment.Multiline), |
|
268 (r'//.*?\n', Comment.Singleline), |
|
269 ], |
|
270 'keyword': [ |
|
271 # Types |
|
272 (r'kernarg' + datatypeMod, Keyword.Type), |
|
273 |
|
274 # Regular keywords |
|
275 (r'\$(full|base|small|large|default|zero|near)', Keyword), |
|
276 (words(( |
|
277 'module', 'extension', 'pragma', 'prog', 'indirect', 'signature', |
|
278 'decl', 'kernel', 'function', 'enablebreakexceptions', |
|
279 'enabledetectexceptions', 'maxdynamicgroupsize', 'maxflatgridsize', |
|
280 'maxflatworkgroupsize', 'requireddim', 'requiredgridsize', |
|
281 'requiredworkgroupsize', 'requirenopartialworkgroups'), |
|
282 suffix=r'\b'), Keyword), |
|
283 |
|
284 # instructions |
|
285 (roundingMod, Keyword), |
|
286 (datatypeMod, Keyword), |
|
287 (r'_(' + alignQual + '|' + widthQual + ')', Keyword), |
|
288 (r'_kernarg', Keyword), |
|
289 (r'(nop|imagefence)\b', Keyword), |
|
290 (words(( |
|
291 'cleardetectexcept', 'clock', 'cuid', 'debugtrap', 'dim', |
|
292 'getdetectexcept', 'groupbaseptr', 'kernargbaseptr', 'laneid', |
|
293 'maxcuid', 'maxwaveid', 'packetid', 'setdetectexcept', 'waveid', |
|
294 'workitemflatabsid', 'workitemflatid', 'nullptr', 'abs', 'bitrev', |
|
295 'currentworkgroupsize', 'currentworkitemflatid', 'fract', 'ncos', |
|
296 'neg', 'nexp2', 'nlog2', 'nrcp', 'nrsqrt', 'nsin', 'nsqrt', |
|
297 'gridgroups', 'gridsize', 'not', 'sqrt', 'workgroupid', |
|
298 'workgroupsize', 'workitemabsid', 'workitemid', 'ceil', 'floor', |
|
299 'rint', 'trunc', 'add', 'bitmask', 'borrow', 'carry', 'copysign', |
|
300 'div', 'rem', 'sub', 'shl', 'shr', 'and', 'or', 'xor', 'unpackhi', |
|
301 'unpacklo', 'max', 'min', 'fma', 'mad', 'bitextract', 'bitselect', |
|
302 'shuffle', 'cmov', 'bitalign', 'bytealign', 'lerp', 'nfma', 'mul', |
|
303 'mulhi', 'mul24hi', 'mul24', 'mad24', 'mad24hi', 'bitinsert', |
|
304 'combine', 'expand', 'lda', 'mov', 'pack', 'unpack', 'packcvt', |
|
305 'unpackcvt', 'sad', 'sementp', 'ftos', 'stof', 'cmp', 'ld', 'st', |
|
306 '_eq', '_ne', '_lt', '_le', '_gt', '_ge', '_equ', '_neu', '_ltu', |
|
307 '_leu', '_gtu', '_geu', '_num', '_nan', '_seq', '_sne', '_slt', |
|
308 '_sle', '_sgt', '_sge', '_snum', '_snan', '_sequ', '_sneu', '_sltu', |
|
309 '_sleu', '_sgtu', '_sgeu', 'atomic', '_ld', '_st', '_cas', '_add', |
|
310 '_and', '_exch', '_max', '_min', '_or', '_sub', '_wrapdec', |
|
311 '_wrapinc', '_xor', 'ret', 'cvt', '_readonly', '_kernarg', '_global', |
|
312 'br', 'cbr', 'sbr', '_scacq', '_screl', '_scar', '_rlx', '_wave', |
|
313 '_wg', '_agent', '_system', 'ldimage', 'stimage', '_v2', '_v3', '_v4', |
|
314 '_1d', '_2d', '_3d', '_1da', '_2da', '_1db', '_2ddepth', '_2dadepth', |
|
315 '_width', '_height', '_depth', '_array', '_channelorder', |
|
316 '_channeltype', 'querysampler', '_coord', '_filter', '_addressing', |
|
317 'barrier', 'wavebarrier', 'initfbar', 'joinfbar', 'waitfbar', |
|
318 'arrivefbar', 'leavefbar', 'releasefbar', 'ldf', 'activelaneid', |
|
319 'activelanecount', 'activelanemask', 'activelanepermute', 'call', |
|
320 'scall', 'icall', 'alloca', 'packetcompletionsig', |
|
321 'addqueuewriteindex', 'casqueuewriteindex', 'ldqueuereadindex', |
|
322 'stqueuereadindex', 'readonly', 'global', 'private', 'group', |
|
323 'spill', 'arg', '_upi', '_downi', '_zeroi', '_neari', '_upi_sat', |
|
324 '_downi_sat', '_zeroi_sat', '_neari_sat', '_supi', '_sdowni', |
|
325 '_szeroi', '_sneari', '_supi_sat', '_sdowni_sat', '_szeroi_sat', |
|
326 '_sneari_sat', '_pp', '_ps', '_sp', '_ss', '_s', '_p', '_pp_sat', |
|
327 '_ps_sat', '_sp_sat', '_ss_sat', '_s_sat', '_p_sat')), Keyword), |
|
328 |
|
329 # Integer types |
|
330 (r'i[1-9]\d*', Keyword) |
|
331 ] |
|
332 } |
|
333 |
|
334 |
201 class LlvmLexer(RegexLexer): |
335 class LlvmLexer(RegexLexer): |
202 """ |
336 """ |
203 For LLVM assembly code. |
337 For LLVM assembly code. |
204 """ |
338 """ |
205 name = 'LLVM' |
339 name = 'LLVM' |
238 (r'(\n|\s)+', Text), |
372 (r'(\n|\s)+', Text), |
239 (r';.*?\n', Comment) |
373 (r';.*?\n', Comment) |
240 ], |
374 ], |
241 'keyword': [ |
375 'keyword': [ |
242 # Regular keywords |
376 # Regular keywords |
243 (r'(begin|end' |
377 (words(( |
244 r'|true|false' |
378 'begin', 'end', 'true', 'false', 'declare', 'define', 'global', |
245 r'|declare|define' |
379 'constant', 'private', 'linker_private', 'internal', |
246 r'|global|constant' |
380 'available_externally', 'linkonce', 'linkonce_odr', 'weak', |
247 |
381 'weak_odr', 'appending', 'dllimport', 'dllexport', 'common', |
248 r'|private|linker_private|internal|available_externally|linkonce' |
382 'default', 'hidden', 'protected', 'extern_weak', 'external', |
249 r'|linkonce_odr|weak|weak_odr|appending|dllimport|dllexport' |
383 'thread_local', 'zeroinitializer', 'undef', 'null', 'to', 'tail', |
250 r'|common|default|hidden|protected|extern_weak|external' |
384 'target', 'triple', 'datalayout', 'volatile', 'nuw', 'nsw', 'nnan', |
251 r'|thread_local|zeroinitializer|undef|null|to|tail|target|triple' |
385 'ninf', 'nsz', 'arcp', 'fast', 'exact', 'inbounds', 'align', |
252 r'|datalayout|volatile|nuw|nsw|nnan|ninf|nsz|arcp|fast|exact|inbounds' |
386 'addrspace', 'section', 'alias', 'module', 'asm', 'sideeffect', |
253 r'|align|addrspace|section|alias|module|asm|sideeffect|gc|dbg' |
387 'gc', 'dbg', 'linker_private_weak', 'attributes', 'blockaddress', |
254 r'|linker_private_weak' |
388 'initialexec', 'localdynamic', 'localexec', 'prefix', 'unnamed_addr', |
255 r'|attributes|blockaddress|initialexec|localdynamic|localexec' |
389 'ccc', 'fastcc', 'coldcc', 'x86_stdcallcc', 'x86_fastcallcc', |
256 r'|prefix|unnamed_addr' |
390 'arm_apcscc', 'arm_aapcscc', 'arm_aapcs_vfpcc', 'ptx_device', |
257 |
391 'ptx_kernel', 'intel_ocl_bicc', 'msp430_intrcc', 'spir_func', |
258 r'|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc' |
392 'spir_kernel', 'x86_64_sysvcc', 'x86_64_win64cc', 'x86_thiscallcc', |
259 r'|arm_aapcscc|arm_aapcs_vfpcc|ptx_device|ptx_kernel' |
393 'cc', 'c', 'signext', 'zeroext', 'inreg', 'sret', 'nounwind', |
260 r'|intel_ocl_bicc|msp430_intrcc|spir_func|spir_kernel' |
394 'noreturn', 'noalias', 'nocapture', 'byval', 'nest', 'readnone', |
261 r'|x86_64_sysvcc|x86_64_win64cc|x86_thiscallcc' |
395 'readonly', 'inlinehint', 'noinline', 'alwaysinline', 'optsize', 'ssp', |
262 |
396 'sspreq', 'noredzone', 'noimplicitfloat', 'naked', 'builtin', 'cold', |
263 r'|cc|c' |
397 'nobuiltin', 'noduplicate', 'nonlazybind', 'optnone', 'returns_twice', |
264 |
398 'sanitize_address', 'sanitize_memory', 'sanitize_thread', 'sspstrong', |
265 r'|signext|zeroext|inreg|sret|nounwind|noreturn|noalias|nocapture' |
399 'uwtable', 'returned', 'type', 'opaque', 'eq', 'ne', 'slt', 'sgt', |
266 r'|byval|nest|readnone|readonly' |
400 'sle', 'sge', 'ult', 'ugt', 'ule', 'uge', 'oeq', 'one', 'olt', 'ogt', |
267 r'|inlinehint|noinline|alwaysinline|optsize|ssp|sspreq|noredzone' |
401 'ole', 'oge', 'ord', 'uno', 'ueq', 'une', 'x', 'acq_rel', 'acquire', |
268 r'|noimplicitfloat|naked' |
402 'alignstack', 'atomic', 'catch', 'cleanup', 'filter', 'inteldialect', |
269 r'|builtin|cold|nobuiltin|noduplicate|nonlazybind|optnone' |
403 'max', 'min', 'monotonic', 'nand', 'personality', 'release', 'seq_cst', |
270 r'|returns_twice|sanitize_address|sanitize_memory|sanitize_thread' |
404 'singlethread', 'umax', 'umin', 'unordered', 'xchg', 'add', 'fadd', |
271 r'|sspstrong|uwtable|returned' |
405 'sub', 'fsub', 'mul', 'fmul', 'udiv', 'sdiv', 'fdiv', 'urem', 'srem', |
272 |
406 'frem', 'shl', 'lshr', 'ashr', 'and', 'or', 'xor', 'icmp', 'fcmp', |
273 r'|type|opaque' |
407 'phi', 'call', 'trunc', 'zext', 'sext', 'fptrunc', 'fpext', 'uitofp', |
274 |
408 'sitofp', 'fptoui', 'fptosi', 'inttoptr', 'ptrtoint', 'bitcast', |
275 r'|eq|ne|slt|sgt|sle' |
409 'addrspacecast', 'select', 'va_arg', 'ret', 'br', 'switch', 'invoke', |
276 r'|sge|ult|ugt|ule|uge' |
410 'unwind', 'unreachable', 'indirectbr', 'landingpad', 'resume', |
277 r'|oeq|one|olt|ogt|ole' |
411 'malloc', 'alloca', 'free', 'load', 'store', 'getelementptr', |
278 r'|oge|ord|uno|ueq|une' |
412 'extractelement', 'insertelement', 'shufflevector', 'getresult', |
279 r'|x' |
413 'extractvalue', 'insertvalue', 'atomicrmw', 'cmpxchg', 'fence', |
280 r'|acq_rel|acquire|alignstack|atomic|catch|cleanup|filter' |
414 'allocsize', 'amdgpu_cs', 'amdgpu_gs', 'amdgpu_kernel', 'amdgpu_ps', |
281 r'|inteldialect|max|min|monotonic|nand|personality|release' |
415 'amdgpu_vs', 'any', 'anyregcc', 'argmemonly', 'avr_intrcc', |
282 r'|seq_cst|singlethread|umax|umin|unordered|xchg' |
416 'avr_signalcc', 'caller', 'catchpad', 'catchret', 'catchswitch', |
283 |
417 'cleanuppad', 'cleanupret', 'comdat', 'convergent', 'cxx_fast_tlscc', |
284 # instructions |
418 'deplibs', 'dereferenceable', 'dereferenceable_or_null', 'distinct', |
285 r'|add|fadd|sub|fsub|mul|fmul|udiv|sdiv|fdiv|urem|srem|frem|shl' |
419 'exactmatch', 'externally_initialized', 'from', 'ghccc', 'hhvm_ccc', |
286 r'|lshr|ashr|and|or|xor|icmp|fcmp' |
420 'hhvmcc', 'ifunc', 'inaccessiblemem_or_argmemonly', 'inaccessiblememonly', |
287 |
421 'inalloca', 'jumptable', 'largest', 'local_unnamed_addr', 'minsize', |
288 r'|phi|call|trunc|zext|sext|fptrunc|fpext|uitofp|sitofp|fptoui' |
422 'musttail', 'noduplicates', 'none', 'nonnull', 'norecurse', 'notail', |
289 r'|fptosi|inttoptr|ptrtoint|bitcast|addrspacecast' |
423 'preserve_allcc', 'preserve_mostcc', 'prologue', 'safestack', 'samesize', |
290 r'|select|va_arg|ret|br|switch' |
424 'source_filename', 'swiftcc', 'swifterror', 'swiftself', 'webkit_jscc', |
291 r'|invoke|unwind|unreachable' |
425 'within', 'writeonly', 'x86_intrcc', 'x86_vectorcallcc'), |
292 r'|indirectbr|landingpad|resume' |
426 suffix=r'\b'), Keyword), |
293 |
|
294 r'|malloc|alloca|free|load|store|getelementptr' |
|
295 |
|
296 r'|extractelement|insertelement|shufflevector|getresult' |
|
297 r'|extractvalue|insertvalue' |
|
298 |
|
299 r'|atomicrmw|cmpxchg|fence' |
|
300 |
|
301 r')\b', Keyword), |
|
302 |
427 |
303 # Types |
428 # Types |
304 (r'void|half|float|double|x86_fp80|fp128|ppc_fp128|label|metadata', |
429 (words(('void', 'half', 'float', 'double', 'x86_fp80', 'fp128', |
305 Keyword.Type), |
430 'ppc_fp128', 'label', 'metadata', 'token')), Keyword.Type), |
306 |
431 |
307 # Integer types |
432 # Integer types |
308 (r'i[1-9]\d*', Keyword) |
433 (r'i[1-9]\d*', Keyword) |
309 ] |
434 ] |
310 } |
435 } |
393 aliases = ['objdump-nasm'] |
518 aliases = ['objdump-nasm'] |
394 filenames = ['*.objdump-intel'] |
519 filenames = ['*.objdump-intel'] |
395 mimetypes = ['text/x-nasm-objdump'] |
520 mimetypes = ['text/x-nasm-objdump'] |
396 |
521 |
397 tokens = _objdump_lexer_tokens(NasmLexer) |
522 tokens = _objdump_lexer_tokens(NasmLexer) |
|
523 |
|
524 |
|
525 class TasmLexer(RegexLexer): |
|
526 """ |
|
527 For Tasm (Turbo Assembler) assembly code. |
|
528 """ |
|
529 name = 'TASM' |
|
530 aliases = ['tasm'] |
|
531 filenames = ['*.asm', '*.ASM', '*.tasm'] |
|
532 mimetypes = ['text/x-tasm'] |
|
533 |
|
534 identifier = r'[@a-z$._?][\w$.?#@~]*' |
|
535 hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)' |
|
536 octn = r'[0-7]+q' |
|
537 binn = r'[01]+b' |
|
538 decn = r'[0-9]+' |
|
539 floatn = decn + r'\.e?' + decn |
|
540 string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`" |
|
541 declkw = r'(?:res|d)[bwdqt]|times' |
|
542 register = (r'r[0-9][0-5]?[bwd]|' |
|
543 r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|' |
|
544 r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]') |
|
545 wordop = r'seg|wrt|strict' |
|
546 type = r'byte|[dq]?word' |
|
547 directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|' |
|
548 r'ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|' |
|
549 r'EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|' |
|
550 r'P386|MODEL|ASSUME|CODESEG|SIZE') |
|
551 # T[A-Z][a-z] is more of a convention. Lexer should filter out STRUC definitions |
|
552 # and then 'add' them to datatype somehow. |
|
553 datatype = (r'db|dd|dw|T[A-Z][a-z]+') |
|
554 |
|
555 flags = re.IGNORECASE | re.MULTILINE |
|
556 tokens = { |
|
557 'root': [ |
|
558 (r'^\s*%', Comment.Preproc, 'preproc'), |
|
559 include('whitespace'), |
|
560 (identifier + ':', Name.Label), |
|
561 (directives, Keyword, 'instruction-args'), |
|
562 (r'(%s)(\s+)(%s)' % (identifier, datatype), |
|
563 bygroups(Name.Constant, Keyword.Declaration, Keyword.Declaration), |
|
564 'instruction-args'), |
|
565 (declkw, Keyword.Declaration, 'instruction-args'), |
|
566 (identifier, Name.Function, 'instruction-args'), |
|
567 (r'[\r\n]+', Text) |
|
568 ], |
|
569 'instruction-args': [ |
|
570 (string, String), |
|
571 (hexn, Number.Hex), |
|
572 (octn, Number.Oct), |
|
573 (binn, Number.Bin), |
|
574 (floatn, Number.Float), |
|
575 (decn, Number.Integer), |
|
576 include('punctuation'), |
|
577 (register, Name.Builtin), |
|
578 (identifier, Name.Variable), |
|
579 # Do not match newline when it's preceeded by a backslash |
|
580 (r'(\\\s*)(;.*)([\r\n])', bygroups(Text, Comment.Single, Text)), |
|
581 (r'[\r\n]+', Text, '#pop'), |
|
582 include('whitespace') |
|
583 ], |
|
584 'preproc': [ |
|
585 (r'[^;\n]+', Comment.Preproc), |
|
586 (r';.*?\n', Comment.Single, '#pop'), |
|
587 (r'\n', Comment.Preproc, '#pop'), |
|
588 ], |
|
589 'whitespace': [ |
|
590 (r'[\n\r]', Text), |
|
591 (r'\\[\n\r]', Text), |
|
592 (r'[ \t]+', Text), |
|
593 (r';.*', Comment.Single) |
|
594 ], |
|
595 'punctuation': [ |
|
596 (r'[,():\[\]]+', Punctuation), |
|
597 (r'[&|^<>+*=/%~-]+', Operator), |
|
598 (r'[$]+', Keyword.Constant), |
|
599 (wordop, Operator.Word), |
|
600 (type, Keyword.Type) |
|
601 ], |
|
602 } |
398 |
603 |
399 |
604 |
400 class Ca65Lexer(RegexLexer): |
605 class Ca65Lexer(RegexLexer): |
401 """ |
606 """ |
402 For ca65 assembler sources. |
607 For ca65 assembler sources. |