ThirdParty/Pygments/pygments/lexers/compiled.py

changeset 808
8f85926125ef
parent 684
2f29a0b6e1c7
child 1705
b0fbc9300f2b
equal deleted inserted replaced
805:83ca4d1ff648 808:8f85926125ef
24 24
25 __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'JavaLexer', 25 __all__ = ['CLexer', 'CppLexer', 'DLexer', 'DelphiLexer', 'JavaLexer',
26 'ScalaLexer', 'DylanLexer', 'OcamlLexer', 'ObjectiveCLexer', 26 'ScalaLexer', 'DylanLexer', 'OcamlLexer', 'ObjectiveCLexer',
27 'FortranLexer', 'GLShaderLexer', 'PrologLexer', 'CythonLexer', 27 'FortranLexer', 'GLShaderLexer', 'PrologLexer', 'CythonLexer',
28 'ValaLexer', 'OocLexer', 'GoLexer', 'FelixLexer', 'AdaLexer', 28 'ValaLexer', 'OocLexer', 'GoLexer', 'FelixLexer', 'AdaLexer',
29 'Modula2Lexer'] 29 'Modula2Lexer', 'BlitzMaxLexer']
30 30
31 31
32 class CLexer(RegexLexer): 32 class CLexer(RegexLexer):
33 """ 33 """
34 For C source code with preprocessor directives. 34 For C source code with preprocessor directives.
41 #: optional Comment or Whitespace 41 #: optional Comment or Whitespace
42 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' 42 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
43 43
44 tokens = { 44 tokens = {
45 'whitespace': [ 45 'whitespace': [
46 (r'^\s*#if\s+0', Comment.Preproc, 'if0'), 46 # preprocessor directives: without whitespace
47 (r'^\s*#', Comment.Preproc, 'macro'), 47 ('^#if\s+0', Comment.Preproc, 'if0'),
48 ('^#', Comment.Preproc, 'macro'),
49 # or with whitespace
50 ('^' + _ws + r'#if\s+0', Comment.Preproc, 'if0'),
51 ('^' + _ws + '#', Comment.Preproc, 'macro'),
48 (r'^(\s*)([a-zA-Z_][a-zA-Z0-9_]*:(?!:))', bygroups(Text, Name.Label)), 52 (r'^(\s*)([a-zA-Z_][a-zA-Z0-9_]*:(?!:))', bygroups(Text, Name.Label)),
49 (r'\n', Text), 53 (r'\n', Text),
50 (r'\s+', Text), 54 (r'\s+', Text),
51 (r'\\\n', Text), # line continuation 55 (r'\\\n', Text), # line continuation
52 (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single), 56 (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
53 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), 57 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
54 ], 58 ],
55 'statements': [ 59 'statements': [
56 (r'L?"', String, 'string'), 60 (r'L?"', String, 'string'),
57 (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), 61 (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
58 (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), 62 (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
59 (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), 63 (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
60 (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex), 64 (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
61 (r'0[0-7]+[Ll]?', Number.Oct), 65 (r'0[0-7]+[LlUu]*', Number.Oct),
62 (r'\d+[Ll]?', Number.Integer), 66 (r'\d+[LlUu]*', Number.Integer),
63 (r'\*/', Error), 67 (r'\*/', Error),
64 (r'[~!%^&*+=|?:<>/-]', Operator), 68 (r'[~!%^&*+=|?:<>/-]', Operator),
65 (r'[()\[\],.]', Punctuation), 69 (r'[()\[\],.]', Punctuation),
66 (r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)), 70 (r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)),
67 (r'(auto|break|case|const|continue|default|do|else|enum|extern|' 71 (r'(auto|break|case|const|continue|default|do|else|enum|extern|'
166 name = 'C++' 170 name = 'C++'
167 aliases = ['cpp', 'c++'] 171 aliases = ['cpp', 'c++']
168 filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx'] 172 filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx']
169 mimetypes = ['text/x-c++hdr', 'text/x-c++src'] 173 mimetypes = ['text/x-c++hdr', 'text/x-c++src']
170 174
175 #: optional Comment or Whitespace
176 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
177
171 tokens = { 178 tokens = {
172 'root': [ 179 'root': [
173 (r'^\s*#if\s+0', Comment.Preproc, 'if0'), 180 # preprocessor directives: without whitespace
174 (r'^\s*#', Comment.Preproc, 'macro'), 181 ('^#if\s+0', Comment.Preproc, 'if0'),
182 ('^#', Comment.Preproc, 'macro'),
183 # or with whitespace
184 ('^' + _ws + r'#if\s+0', Comment.Preproc, 'if0'),
185 ('^' + _ws + '#', Comment.Preproc, 'macro'),
175 (r'\n', Text), 186 (r'\n', Text),
176 (r'\s+', Text), 187 (r'\s+', Text),
177 (r'\\\n', Text), # line continuation 188 (r'\\\n', Text), # line continuation
178 (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), 189 (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
179 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), 190 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
180 (r'[{}]', Punctuation), 191 (r'[{}]', Punctuation),
181 (r'L?"', String, 'string'), 192 (r'L?"', String, 'string'),
182 (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), 193 (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
183 (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), 194 (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
184 (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), 195 (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
185 (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex), 196 (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
186 (r'0[0-7]+[Ll]?', Number.Oct), 197 (r'0[0-7]+[LlUu]*', Number.Oct),
187 (r'\d+[Ll]?', Number.Integer), 198 (r'\d+[LlUu]*', Number.Integer),
188 (r'\*/', Error), 199 (r'\*/', Error),
189 (r'[~!%^&*+=|?:<>/-]', Operator), 200 (r'[~!%^&*+=|?:<>/-]', Operator),
190 (r'[()\[\],.;]', Punctuation), 201 (r'[()\[\],.;]', Punctuation),
191 (r'(asm|auto|break|case|catch|const|const_cast|continue|' 202 (r'(asm|auto|break|case|catch|const|const_cast|continue|'
192 r'default|delete|do|dynamic_cast|else|enum|explicit|export|' 203 r'default|delete|do|dynamic_cast|else|enum|explicit|export|'
202 (r'__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|' 213 (r'__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|'
203 r'declspec|finally|int64|try|leave|wchar_t|w64|virtual_inheritance|' 214 r'declspec|finally|int64|try|leave|wchar_t|w64|virtual_inheritance|'
204 r'uuidof|unaligned|super|single_inheritance|raise|noop|' 215 r'uuidof|unaligned|super|single_inheritance|raise|noop|'
205 r'multiple_inheritance|m128i|m128d|m128|m64|interface|' 216 r'multiple_inheritance|m128i|m128d|m128|m64|interface|'
206 r'identifier|forceinline|event|assume)\b', Keyword.Reserved), 217 r'identifier|forceinline|event|assume)\b', Keyword.Reserved),
218 # Offload C++ extensions, http://offload.codeplay.com/
219 (r'(__offload|__blockingoffload|__outer)\b', Keyword.Psuedo),
207 (r'(true|false)\b', Keyword.Constant), 220 (r'(true|false)\b', Keyword.Constant),
208 (r'NULL\b', Name.Builtin), 221 (r'NULL\b', Name.Builtin),
209 ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label), 222 ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),
210 ('[a-zA-Z_][a-zA-Z0-9_]*', Name), 223 ('[a-zA-Z_][a-zA-Z0-9_]*', Name),
211 ], 224 ],
1036 *New in Pygments 0.7.* 1049 *New in Pygments 0.7.*
1037 """ 1050 """
1038 1051
1039 name = 'Dylan' 1052 name = 'Dylan'
1040 aliases = ['dylan'] 1053 aliases = ['dylan']
1041 filenames = ['*.dylan'] 1054 filenames = ['*.dylan', '*.dyl']
1042 mimetypes = ['text/x-dylan'] 1055 mimetypes = ['text/x-dylan']
1043 1056
1044 flags = re.DOTALL 1057 flags = re.DOTALL
1045 1058
1046 tokens = { 1059 tokens = {
1049 r'|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler' 1062 r'|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler'
1050 r'|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)' 1063 r'|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)'
1051 r'|open|primary|sealed|si(deways|ngleton)|slot' 1064 r'|open|primary|sealed|si(deways|ngleton)|slot'
1052 r'|v(ariable|irtual))\b', Name.Builtin), 1065 r'|v(ariable|irtual))\b', Name.Builtin),
1053 (r'<\w+>', Keyword.Type), 1066 (r'<\w+>', Keyword.Type),
1054 (r'#?"(?:\\.|[^"])+?"', String.Double),
1055 (r'//.*?\n', Comment.Single), 1067 (r'//.*?\n', Comment.Single),
1056 (r'/\*[\w\W]*?\*/', Comment.Multiline), 1068 (r'/\*[\w\W]*?\*/', Comment.Multiline),
1057 (r'\'.*?\'', String.Single), 1069 (r'"', String, 'string'),
1070 (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
1058 (r'=>|\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)' 1071 (r'=>|\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)'
1059 r'|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise' 1072 r'|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise'
1060 r'|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\b', 1073 r'|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\b',
1061 Keyword), 1074 Keyword),
1062 (r'([ \t])([!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*:)', 1075 (r'([ \t])([!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*:)',
1069 (r'[!$%&*/:<>=?~^.+\[\]{}-]+', Operator), 1082 (r'[!$%&*/:<>=?~^.+\[\]{}-]+', Operator),
1070 (r'\s+', Text), 1083 (r'\s+', Text),
1071 (r'#[a-zA-Z0-9-]+', Keyword), 1084 (r'#[a-zA-Z0-9-]+', Keyword),
1072 (r'[a-zA-Z0-9-]+', Name.Variable), 1085 (r'[a-zA-Z0-9-]+', Name.Variable),
1073 ], 1086 ],
1087 'string': [
1088 (r'"', String, '#pop'),
1089 (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
1090 (r'[^\\"\n]+', String), # all other characters
1091 (r'\\\n', String), # line continuation
1092 (r'\\', String), # stray backslash
1093 ],
1074 } 1094 }
1075 1095
1076 1096
1077 class ObjectiveCLexer(RegexLexer): 1097 class ObjectiveCLexer(RegexLexer):
1078 """ 1098 """
1088 #: optional Comment or Whitespace 1108 #: optional Comment or Whitespace
1089 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' 1109 _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
1090 1110
1091 tokens = { 1111 tokens = {
1092 'whitespace': [ 1112 'whitespace': [
1093 (r'^(\s*)(#if\s+0)', bygroups(Text, Comment.Preproc), 'if0'), 1113 # preprocessor directives: without whitespace
1094 (r'^(\s*)(#)', bygroups(Text, Comment.Preproc), 'macro'), 1114 ('^#if\s+0', Comment.Preproc, 'if0'),
1115 ('^#', Comment.Preproc, 'macro'),
1116 # or with whitespace
1117 ('^' + _ws + r'#if\s+0', Comment.Preproc, 'if0'),
1118 ('^' + _ws + '#', Comment.Preproc, 'macro'),
1095 (r'\n', Text), 1119 (r'\n', Text),
1096 (r'\s+', Text), 1120 (r'\s+', Text),
1097 (r'\\\n', Text), # line continuation 1121 (r'\\\n', Text), # line continuation
1098 (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single), 1122 (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
1099 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), 1123 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
1321 1345
1322 tokens = { 1346 tokens = {
1323 'root': [ 1347 'root': [
1324 (r'^#.*', Comment.Preproc), 1348 (r'^#.*', Comment.Preproc),
1325 (r'//.*', Comment.Single), 1349 (r'//.*', Comment.Single),
1326 (r'/\*[\w\W]*\*/', Comment.Multiline), 1350 (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
1327 (r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?', 1351 (r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?',
1328 Operator), 1352 Operator),
1329 (r'[?:]', Operator), # quick hack for ternary 1353 (r'[?:]', Operator), # quick hack for ternary
1330 (r'\bdefined\b', Operator), 1354 (r'\bdefined\b', Operator),
1331 (r'[;{}(),\[\]]', Punctuation), 1355 (r'[;{}(),\[\]]', Punctuation),
1332 #FIXME when e is present, no decimal point needed 1356 #FIXME when e is present, no decimal point needed
1333 (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float), 1357 (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float),
1334 (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float), 1358 (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float),
1335 (r'0[xX][0-9a-fA-F]*', Number.Hex), 1359 (r'0[xX][0-9a-fA-F]*', Number.Hex),
1336 (r'0[0-7]*', Number.Octal), 1360 (r'0[0-7]*', Number.Oct),
1337 (r'[1-9][0-9]*', Number.Integer), 1361 (r'[1-9][0-9]*', Number.Integer),
1338 (r'\b(attribute|const|uniform|varying|centroid|break|continue|' 1362 (r'\b(attribute|const|uniform|varying|centroid|break|continue|'
1339 r'do|for|while|if|else|in|out|inout|float|int|void|bool|true|' 1363 r'do|for|while|if|else|in|out|inout|float|int|void|bool|true|'
1340 r'false|invariant|discard|return|mat[234]|mat[234]x[234]|' 1364 r'false|invariant|discard|return|mat[234]|mat[234]x[234]|'
1341 r'vec[234]|[ib]vec[234]|sampler[123]D|samplerCube|' 1365 r'vec[234]|[ib]vec[234]|sampler[123]D|samplerCube|'
1344 r'switch|default|inline|noinline|volatile|public|static|extern|' 1368 r'switch|default|inline|noinline|volatile|public|static|extern|'
1345 r'external|interface|long|short|double|half|fixed|unsigned|' 1369 r'external|interface|long|short|double|half|fixed|unsigned|'
1346 r'lowp|mediump|highp|precision|input|output|hvec[234]|' 1370 r'lowp|mediump|highp|precision|input|output|hvec[234]|'
1347 r'[df]vec[234]|sampler[23]DRect|sampler2DRectShadow|sizeof|' 1371 r'[df]vec[234]|sampler[23]DRect|sampler2DRectShadow|sizeof|'
1348 r'cast|namespace|using)\b', Keyword), #future use 1372 r'cast|namespace|using)\b', Keyword), #future use
1349 (r'[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable), 1373 (r'[a-zA-Z_][a-zA-Z_0-9]*', Name),
1350 (r'\.', Punctuation), 1374 (r'\.', Punctuation),
1351 (r'\s+', Text), 1375 (r'\s+', Text),
1352 ], 1376 ],
1353 } 1377 }
1378
1354 1379
1355 class PrologLexer(RegexLexer): 1380 class PrologLexer(RegexLexer):
1356 """ 1381 """
1357 Lexer for Prolog files. 1382 Lexer for Prolog files.
1358 """ 1383 """
1369 (r'/\*', Comment.Multiline, 'nested-comment'), 1394 (r'/\*', Comment.Multiline, 'nested-comment'),
1370 (r'%.*', Comment.Single), 1395 (r'%.*', Comment.Single),
1371 (r'[0-9]+', Number), 1396 (r'[0-9]+', Number),
1372 (r'[\[\](){}|.,;!]', Punctuation), 1397 (r'[\[\](){}|.,;!]', Punctuation),
1373 (r':-|-->', Punctuation), 1398 (r':-|-->', Punctuation),
1374 (r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\U[0-9a-fA-F]{8}|' 1399 (r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
1375 r'\\[0-7]+\\|\\[\w\W]|[^"])*"', String.Double), 1400 r'\\[0-7]+\\|\\[\w\W]|[^"])*"', String.Double),
1376 (r"'(?:''|[^'])*'", String.Atom), # quoted atom 1401 (r"'(?:''|[^'])*'", String.Atom), # quoted atom
1377 # Needs to not be followed by an atom. 1402 # Needs to not be followed by an atom.
1378 #(r'=(?=\s|[a-zA-Z\[])', Operator), 1403 #(r'=(?=\s|[a-zA-Z\[])', Operator),
1379 (r'(is|<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])', 1404 (r'(is|<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])',
1705 1730
1706 # : introduces types 1731 # : introduces types
1707 (r'[:(){}\[\];,]', Punctuation), 1732 (r'[:(){}\[\];,]', Punctuation),
1708 1733
1709 (r'0x[0-9a-fA-F]+', Number.Hex), 1734 (r'0x[0-9a-fA-F]+', Number.Hex),
1710 (r'0c[0-9]+', Number.Octal), 1735 (r'0c[0-9]+', Number.Oct),
1711 (r'0b[01]+', Number.Binary), 1736 (r'0b[01]+', Number.Binary),
1712 (r'[0-9_]\.[0-9_]*(?!\.)', Number.Float), 1737 (r'[0-9_]\.[0-9_]*(?!\.)', Number.Float),
1713 (r'[0-9_]+', Number.Decimal), 1738 (r'[0-9_]+', Number.Decimal),
1714 1739
1715 (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\"])*"', 1740 (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\"])*"',
2361 token = Keyword.Reserved 2386 token = Keyword.Reserved
2362 elif value in self.pervasives: 2387 elif value in self.pervasives:
2363 token = Keyword.Pervasive 2388 token = Keyword.Pervasive
2364 # return result 2389 # return result
2365 yield index, token, value 2390 yield index, token, value
2391
2392
2393 class BlitzMaxLexer(RegexLexer):
2394 """
2395 For `BlitzMax <http://blitzbasic.com>`_ source code.
2396
2397 *New in Pygments 1.4.*
2398 """
2399
2400 name = 'BlitzMax'
2401 aliases = ['blitzmax', 'bmax']
2402 filenames = ['*.bmx']
2403 mimetypes = ['text/x-bmx']
2404
2405 bmax_vopwords = r'\b(Shl|Shr|Sar|Mod)\b'
2406 bmax_sktypes = r'@{1,2}|[!#$%]'
2407 bmax_lktypes = r'\b(Int|Byte|Short|Float|Double|Long)\b'
2408 bmax_name = r'[a-z_][a-z0-9_]*'
2409 bmax_var = r'(%s)(?:(?:([ \t]*)(%s)|([ \t]*:[ \t]*\b(?:Shl|Shr|Sar|Mod)\b)|([ \t]*)([:])([ \t]*)(?:%s|(%s)))(?:([ \t]*)(Ptr))?)' % (bmax_name, bmax_sktypes, bmax_lktypes, bmax_name)
2410 bmax_func = bmax_var + r'?((?:[ \t]|\.\.\n)*)([(])'
2411
2412 flags = re.MULTILINE | re.IGNORECASE
2413 tokens = {
2414 'root': [
2415 # Text
2416 (r'[ \t]+', Text),
2417 (r'\.\.\n', Text), # Line continuation
2418 # Comments
2419 (r"'.*?\n", Comment.Single),
2420 (r'([ \t]*)\bRem\n(\n|.)*?\s*\bEnd([ \t]*)Rem', Comment.Multiline),
2421 # Data types
2422 ('"', String.Double, 'string'),
2423 # Numbers
2424 (r'[0-9]+\.[0-9]*(?!\.)', Number.Float),
2425 (r'\.[0-9]*(?!\.)', Number.Float),
2426 (r'[0-9]+', Number.Integer),
2427 (r'\$[0-9a-f]+', Number.Hex),
2428 (r'\%[10]+', Number), # Binary
2429 # Other
2430 (r'(?:(?:(:)?([ \t]*)(:?%s|([+\-*/&|~]))|Or|And|Not|[=<>^]))' %
2431 (bmax_vopwords), Operator),
2432 (r'[(),.:\[\]]', Punctuation),
2433 (r'(?:#[\w \t]*)', Name.Label),
2434 (r'(?:\?[\w \t]*)', Comment.Preproc),
2435 # Identifiers
2436 (r'\b(New)\b([ \t]?)([(]?)(%s)' % (bmax_name),
2437 bygroups(Keyword.Reserved, Text, Punctuation, Name.Class)),
2438 (r'\b(Import|Framework|Module)([ \t]+)(%s\.%s)' %
2439 (bmax_name, bmax_name),
2440 bygroups(Keyword.Reserved, Text, Keyword.Namespace)),
2441 (bmax_func, bygroups(Name.Function, Text, Keyword.Type,
2442 Operator, Text, Punctuation, Text,
2443 Keyword.Type, Name.Class, Text,
2444 Keyword.Type, Text, Punctuation)),
2445 (bmax_var, bygroups(Name.Variable, Text, Keyword.Type, Operator,
2446 Text, Punctuation, Text, Keyword.Type,
2447 Name.Class, Text, Keyword.Type)),
2448 (r'\b(Type|Extends)([ \t]+)(%s)' % (bmax_name),
2449 bygroups(Keyword.Reserved, Text, Name.Class)),
2450 # Keywords
2451 (r'\b(Ptr)\b', Keyword.Type),
2452 (r'\b(Pi|True|False|Null|Self|Super)\b', Keyword.Constant),
2453 (r'\b(Local|Global|Const|Field)\b', Keyword.Declaration),
2454 (r'\b(TNullMethodException|TNullFunctionException|'
2455 r'TNullObjectException|TArrayBoundsException|'
2456 r'TRuntimeException)\b', Name.Exception),
2457 (r'\b(Strict|SuperStrict|Module|ModuleInfo|'
2458 r'End|Return|Continue|Exit|Public|Private|'
2459 r'Var|VarPtr|Chr|Len|Asc|SizeOf|Sgn|Abs|Min|Max|'
2460 r'New|Release|Delete|'
2461 r'Incbin|IncbinPtr|IncbinLen|'
2462 r'Framework|Include|Import|Extern|EndExtern|'
2463 r'Function|EndFunction|'
2464 r'Type|EndType|Extends|'
2465 r'Method|EndMethod|'
2466 r'Abstract|Final|'
2467 r'If|Then|Else|ElseIf|EndIf|'
2468 r'For|To|Next|Step|EachIn|'
2469 r'While|Wend|EndWhile|'
2470 r'Repeat|Until|Forever|'
2471 r'Select|Case|Default|EndSelect|'
2472 r'Try|Catch|EndTry|Throw|Assert|'
2473 r'Goto|DefData|ReadData|RestoreData)\b', Keyword.Reserved),
2474 # Final resolve (for variable names and such)
2475 (r'(%s)' % (bmax_name), Name.Variable),
2476 ],
2477 'string': [
2478 (r'""', String.Double),
2479 (r'"C?', String.Double, '#pop'),
2480 (r'[^"]+', String.Double),
2481 ],
2482 }

eric ide

mercurial