diff options
author | Georg Brandl <georg@python.org> | 2011-06-01 20:27:52 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-06-01 20:27:52 +0200 |
commit | 0c8850f38e7ef2b48e1af350fddfff60934c7ebb (patch) | |
tree | 1ee79d0aacc1ea70e26f8483bbb73245a82a2f89 | |
parent | 91dff801f91b784b45244778ed757c6451063295 (diff) | |
download | pygments-0c8850f38e7ef2b48e1af350fddfff60934c7ebb.tar.gz |
Add author and changelog entry for Nimrod.
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | pygments/lexers/compiled.py | 44 |
3 files changed, 27 insertions, 19 deletions
@@ -62,6 +62,7 @@ Other contributors, listed alphabetically, are: * Jon Parise -- Protocol buffers lexer * Ronny Pfannschmidt -- BBCode lexer * Benjamin Peterson -- Test suite refactoring +* Dominik Picheta -- Nimrod lexer * Justin Reidy -- MXML lexer * Lubomir Rintel -- GoodData MAQL and CL lexers * Andre Roberge -- Tango style @@ -14,6 +14,7 @@ Version 1.5 * Fancy (#633) * PyPy Log * eC + * Nimrod Version 1.4 diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 1921070a..2945be98 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -2631,11 +2631,21 @@ class BlitzMaxLexer(RegexLexer): ], } + class NimrodLexer(RegexLexer): """ - For `Nimrod <http://nimrod-code.org/>`_ source code + For `Nimrod <http://nimrod-code.org/>`_ source code. + + *New in Pygments 1.5.* """ + name = 'Nimrod' + aliases = ['nimrod', 'nim'] + filenames = ['*.nim', '*.nimrod'] + mimetypes = ['text/x-nimrod'] + + flags = re.MULTILINE | re.IGNORECASE | re.UNICODE + def underscorize(words): newWords = [] new = "" @@ -2645,36 +2655,29 @@ class NimrodLexer(RegexLexer): newWords.append(new) new = "" return "|".join(newWords) - - name = 'Nimrod' - aliases = ['nimrod', 'nim'] - filenames = ['*.nim', '*.nimrod'] - mimetypes = ['text/x-nimrod'] - - flags = re.MULTILINE | re.IGNORECASE | re.UNICODE keywords = [ - 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', - 'case', 'cast', 'const', 'continue', 'converter', 'discard', - 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', + 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', + 'case', 'cast', 'const', 'continue', 'converter', 'discard', + 'distinct', 'div', 'elif', 'else', 'end', 'enum', 'except', 'finally', 'for', 'generic', 'if', 'implies', 'in', 'yield', - 'is', 'isnot', 'iterator', 'lambda', 'let', 'macro', 'method', + 'is', 'isnot', 'iterator', 'lambda', 'let', 'macro', 'method', 'mod', 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', - 'ptr', 'raise', 'ref', 'return', 'shl', 'shr', 'template', 'try', + 'ptr', 'raise', 'ref', 'return', 'shl', 'shr', 'template', 'try', 'tuple', 'type' , 'when', 'while', 'with', 'without', 'xor' ] - + keywordsPseudo = [ 'nil', 'true', 'false' ] opWords = [ - 'and', 'or', 'not', 'xor', 'shl', 'shr', 'div', 'mod', 'in', + 'and', 'or', 'not', 'xor', 'shl', 'shr', 'div', 'mod', 'in', 'notin', 'is', 'isnot' ] types = [ - 'int', 'int8', 'int16', 'int32', 'int64', 'float', 'float32', 'float64', + 'int', 'int8', 'int16', 'int32', 'int64', 'float', 'float32', 'float64', 'bool', 'char', 'range', 'array', 'seq', 'set', 'string' ] @@ -2683,7 +2686,8 @@ class NimrodLexer(RegexLexer): (r'##.*$', String.Doc), (r'#.*$', Comment), (r'\*|=|>|<|\+|-|/|@|\$|~|&|%|\!|\?|\||\\|\[|\]', Operator), - (r'\.\.|\.|,|[\.|\.]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;', Punctuation), + (r'\.\.|\.|,|[\.|\.]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;', + Punctuation), # Strings (r'(?:[\w]+)"', String, 'rdqs'), @@ -2697,7 +2701,8 @@ class NimrodLexer(RegexLexer): (r'(%s)\b' % underscorize(opWords), Operator.Word), (r'(p_?r_?o_?c_?\s)(?![\(\[\]])', Keyword, 'funcname'), (r'(%s)\b' % underscorize(keywords), Keyword), - (r'(%s)\b' % underscorize(['from', 'import', 'include']), Keyword.Namespace), + (r'(%s)\b' % underscorize(['from', 'import', 'include']), + Keyword.Namespace), (r'(v_?a_?r)\b', Keyword.Declaration), (r'(%s)\b' % underscorize(types), Keyword.Type), (r'(%s)\b' % underscorize(keywordsPseudo), Keyword.Pseudo), @@ -2729,7 +2734,8 @@ class NimrodLexer(RegexLexer): # newlines are an error (use "nl" state) ], 'dqs': [ - (r'\\([\\abcefnrtvl"\']|\n|x[a-fA-F0-9]{2}|[0-9]{1,3})', String.Escape), + (r'\\([\\abcefnrtvl"\']|\n|x[a-fA-F0-9]{2}|[0-9]{1,3})', + String.Escape), (r'"', String, '#pop'), include('strings') ], |