diff -r ace8a08028f3 -r da76c71624de ThirdParty/Pygments/pygments/lexers/asm.py --- a/ThirdParty/Pygments/pygments/lexers/asm.py Sun Feb 17 19:05:40 2013 +0100 +++ b/ThirdParty/Pygments/pygments/lexers/asm.py Sun Feb 17 19:07:15 2013 +0100 @@ -5,7 +5,7 @@ Lexers for assembly languages. - :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -17,7 +17,7 @@ Other, Keyword, Operator __all__ = ['GasLexer', 'ObjdumpLexer','DObjdumpLexer', 'CppObjdumpLexer', - 'CObjdumpLexer', 'LlvmLexer', 'NasmLexer'] + 'CObjdumpLexer', 'LlvmLexer', 'NasmLexer', 'Ca65Lexer'] class GasLexer(RegexLexer): @@ -31,7 +31,7 @@ #: optional Comment or Whitespace string = r'"(\\"|[^"])*"' - char = r'[a-zA-Z$._0-9@]' + char = r'[a-zA-Z$._0-9@-]' identifier = r'(?:[a-zA-Z$_]' + char + '*|\.' + char + '+)' number = r'(?:0[xX][a-zA-Z0-9]+|\d+)' @@ -208,7 +208,7 @@ include('whitespace'), # Before keywords, because keywords are valid label names :(... - (r'^\s*' + identifier + '\s*:', Name.Label), + (identifier + '\s*:', Name.Label), include('keyword'), @@ -240,8 +240,8 @@ r'|linkonce_odr|weak|weak_odr|appending|dllimport|dllexport' r'|common|default|hidden|protected|extern_weak|external' r'|thread_local|zeroinitializer|undef|null|to|tail|target|triple' - r'|deplibs|datalayout|volatile|nuw|nsw|exact|inbounds|align' - r'|addrspace|section|alias|module|asm|sideeffect|gc|dbg' + r'|datalayout|volatile|nuw|nsw|nnan|ninf|nsz|arcp|fast|exact|inbounds' + r'|align|addrspace|section|alias|module|asm|sideeffect|gc|dbg' r'|ccc|fastcc|coldcc|x86_stdcallcc|x86_fastcallcc|arm_apcscc' r'|arm_aapcscc|arm_aapcs_vfpcc' @@ -304,7 +304,8 @@ floatn = decn + r'\.e?' + decn string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`" declkw = r'(?:res|d)[bwdqt]|times' - register = (r'[a-d][lh]|e?[a-d]x|e?[sb]p|e?[sd]i|[c-gs]s|st[0-7]|' + register = (r'r[0-9][0-5]?[bwd]|' + r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|' r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]') wordop = r'seg|wrt|strict' type = r'byte|[dq]?word' @@ -357,3 +358,41 @@ (type, Keyword.Type) ], } + + +class Ca65Lexer(RegexLexer): + """ + For ca65 assembler sources. + + *New in Pygments 1.6.* + """ + name = 'ca65' + aliases = ['ca65'] + filenames = ['*.s'] + + flags = re.IGNORECASE + + tokens = { + 'root': [ + (r';.*', Comment.Single), + (r'\s+', Text), + (r'[a-z_.@$][\w.@$]*:', Name.Label), + (r'((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]' + r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs' + r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor' + r'|bit)\b', Keyword), + (r'\.[a-z0-9_]+', Keyword.Pseudo), + (r'[-+~*/^&|!<>=]', Operator), + (r'"[^"\n]*.', String), + (r"'[^'\n]*.", String.Char), + (r'\$[0-9a-f]+|[0-9a-f]+h\b', Number.Hex), + (r'\d+|%[01]+', Number.Integer), + (r'[#,.:()=]', Punctuation), + (r'[a-z_.@$][\w.@$]*', Name), + ] + } + + def analyse_text(self, text): + # comments in GAS start with "#" + if re.match(r'^\s*;', text, re.MULTILINE): + return 0.9