18 __all__ = ['NimrodLexer'] |
18 __all__ = ['NimrodLexer'] |
19 |
19 |
20 |
20 |
21 class NimrodLexer(RegexLexer): |
21 class NimrodLexer(RegexLexer): |
22 """ |
22 """ |
23 For `Nimrod <http://nimrod-code.org/>`_ source code. |
23 For `Nim <http://nim-lang.org/>`_ source code. |
24 |
24 |
25 .. versionadded:: 1.5 |
25 .. versionadded:: 1.5 |
26 """ |
26 """ |
27 |
27 |
28 name = 'Nimrod' |
28 name = 'Nimrod' |
29 aliases = ['nimrod', 'nim'] |
29 aliases = ['nim', 'nimrod'] |
30 filenames = ['*.nim', '*.nimrod'] |
30 filenames = ['*.nim', '*.nimrod'] |
31 mimetypes = ['text/x-nimrod'] |
31 mimetypes = ['text/x-nim'] |
32 |
32 |
33 flags = re.MULTILINE | re.IGNORECASE | re.UNICODE |
33 flags = re.MULTILINE | re.IGNORECASE | re.UNICODE |
34 |
34 |
35 def underscorize(words): |
35 def underscorize(words): |
36 newWords = [] |
36 newWords = [] |
41 newWords.append(new) |
41 newWords.append(new) |
42 new = "" |
42 new = "" |
43 return "|".join(newWords) |
43 return "|".join(newWords) |
44 |
44 |
45 keywords = [ |
45 keywords = [ |
46 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', |
46 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', 'case', |
47 'case', 'cast', 'const', 'continue', 'converter', 'discard', |
47 'cast', 'concept', 'const', 'continue', 'converter', 'defer', 'discard', |
48 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', |
48 'distinct', 'div', 'do', 'elif', 'else', 'end', 'enum', 'except', |
49 'for', 'generic', 'if', 'implies', 'in', 'yield', |
49 'export', 'finally', 'for', 'func', 'if', 'in', 'yield', 'interface', |
50 'is', 'isnot', 'iterator', 'lambda', 'let', 'macro', 'method', |
50 'is', 'isnot', 'iterator', 'let', 'macro', 'method', 'mixin', 'mod', |
51 'mod', 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', |
51 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', 'ptr', 'raise', |
52 'ptr', 'raise', 'ref', 'return', 'shl', 'shr', 'template', 'try', |
52 'ref', 'return', 'shared', 'shl', 'shr', 'static', 'template', 'try', |
53 'tuple', 'type', 'when', 'while', 'with', 'without', 'xor' |
53 'tuple', 'type', 'when', 'while', 'with', 'without', 'xor' |
54 ] |
54 ] |
55 |
55 |
56 keywordsPseudo = [ |
56 keywordsPseudo = [ |
57 'nil', 'true', 'false' |
57 'nil', 'true', 'false' |