diff options
author | Georg Brandl <georg@python.org> | 2014-09-16 15:07:38 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-16 15:07:38 +0200 |
commit | 9866d8da397c9b43ec104489e8cd56f449e90d1c (patch) | |
tree | e6842b37d0e7c28fde81b1aae4fad8831f72cce4 /pygments/lexers/compiled.py | |
parent | 50528f3f2415449cbd6cc557525bf87b05ca5b99 (diff) | |
download | pygments-9866d8da397c9b43ec104489e8cd56f449e90d1c.tar.gz |
Nit lexer: untabify and apply words().
Diffstat (limited to 'pygments/lexers/compiled.py')
-rw-r--r-- | pygments/lexers/compiled.py | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 7ab5f7ee..6353aa15 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -5245,45 +5245,48 @@ class SwiftLexer(ObjectiveCLexer): class NitLexer(RegexLexer): - """ - For `nit <http://nitlanguage.org>`_ source. - - .. versionadded:: 2.0 - """ - - name = 'Nit' - aliases = ['nit'] - filenames = ['*.nit'] - tokens = { - 'root': [ - (r'#.*?$', Comment.Single), - (r'(package|module|import|class|abstract|interface|' - 'universal|enum|end|fun|type|init|redef|isa|do|' - 'readable|writable|var|intern|extern|public|protected|' - 'private|intrude|if|then|else|while|loop|for|in|and|' - 'or|not|implies|return|continue|break|abort|assert|' - 'new|is|once|super|self|true|false|nullable|null|as|' - 'isset|label|__debug__)(?=( |\n|\t|\r|\())', Keyword), - (r'[A-Z][A-Za-z0-9_]*', Name.Class), - (r'"""(([^\'\\]|\\.)|\\r|\\n)*(({{?)?(""?{{?)*""""*)', String), #Simple long string - (r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|' - r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), #Simple long string alt - (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?({{?""?)*{{{{*)', String), #Start long string - (r'}}}(((\\.|[^\'\\])|\\r|\\n))*(""?)?({{?""?)*{{{{*', String), #Mid long string - (r'}}}(((\\.|[^\'\\])|\\r|\\n))*({{?)?(""?{{?)*""""*', String), #End long string - (r'"(\\.|([^"}{\\]))*"', String), #Simple String - (r'"(\\.|([^"}{\\]))*{', String), #Start string - (r'}(\\.|([^"}{\\]))*{', String), #Mid String - (r'}(\\.|([^"}{\\]))*"', String), #End String - (r'(\'[^\'\\]\')|(\'\\.\')', String.Char), - (r'[0-9]+', Number.Integer), - (r'[0-9]*.[0-9]+', Number.Float), - (r'0(x|X)[0-9A-Fa-f]+', Number.Hex), - (r'[a-z][A-Za-z0-9_]*', Name), - (r'_[A-Za-z0-9_]+', Name.Variable.Instance), - (r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator), - (r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation), - (r'`{[^`]*`}', Text), # Extern blocks won't be Lexed by Nit - ('(\r|\n| |\t)+', Text)] - } + """ + For `nit <http://nitlanguage.org>`_ source. + + .. versionadded:: 2.0 + """ + name = 'Nit' + aliases = ['nit'] + filenames = ['*.nit'] + tokens = { + 'root': [ + (r'#.*?$', Comment.Single), + (words(( + 'package', 'module', 'import', 'class', 'abstract', 'interface', + 'universal', 'enum', 'end', 'fun', 'type', 'init', 'redef', + 'isa', 'do', 'readable', 'writable', 'var', 'intern', 'extern', + 'public', 'protected', 'private', 'intrude', 'if', 'then', + 'else', 'while', 'loop', 'for', 'in', 'and', 'or', 'not', + 'implies', 'return', 'continue', 'break', 'abort', 'assert', + 'new', 'is', 'once', 'super', 'self', 'true', 'false', 'nullable', + 'null', 'as', 'isset', 'label', '__debug__'), suffix='(?=( |\n|\t|\r|\())'), + Keyword), + (r'[A-Z][A-Za-z0-9_]*', Name.Class), + (r'"""(([^\'\\]|\\.)|\\r|\\n)*(({{?)?(""?{{?)*""""*)', String), # Simple long string + (r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|' + r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), # Simple long string alt + (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?({{?""?)*{{{{*)', String), # Start long string + (r'}}}(((\\.|[^\'\\])|\\r|\\n))*(""?)?({{?""?)*{{{{*', String), # Mid long string + (r'}}}(((\\.|[^\'\\])|\\r|\\n))*({{?)?(""?{{?)*""""*', String), # End long string + (r'"(\\.|([^"}{\\]))*"', String), # Simple String + (r'"(\\.|([^"}{\\]))*{', String), # Start string + (r'}(\\.|([^"}{\\]))*{', String), # Mid String + (r'}(\\.|([^"}{\\]))*"', String), # End String + (r'(\'[^\'\\]\')|(\'\\.\')', String.Char), + (r'[0-9]+', Number.Integer), + (r'[0-9]*.[0-9]+', Number.Float), + (r'0(x|X)[0-9A-Fa-f]+', Number.Hex), + (r'[a-z][A-Za-z0-9_]*', Name), + (r'_[A-Za-z0-9_]+', Name.Variable.Instance), + (r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator), + (r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation), + (r'`{[^`]*`}', Text), # Extern blocks won't be Lexed by Nit + ('(\r|\n| |\t)+', Text), + ], + } |