diff options
author | shadchin <[email protected]> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/Pygments/py3/pygments/lexers/bare.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/bare.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/bare.py | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/bare.py b/contrib/python/Pygments/py3/pygments/lexers/bare.py index 56ed5861358..bd5855f1661 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/bare.py +++ b/contrib/python/Pygments/py3/pygments/lexers/bare.py @@ -1,103 +1,103 @@ -""" - pygments.lexers.bare - ~~~~~~~~~~~~~~~~~~~~ - - Lexer for the BARE schema. - - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import re - -from pygments.lexer import RegexLexer, words, bygroups +""" + pygments.lexers.bare + ~~~~~~~~~~~~~~~~~~~~ + + Lexer for the BARE schema. + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, words, bygroups from pygments.token import Text, Comment, Keyword, Name, Literal, Whitespace - -__all__ = ['BareLexer'] - - -class BareLexer(RegexLexer): - """ - For `BARE schema <https://baremessages.org>`_ schema source. - - .. versionadded:: 2.7 - """ - name = 'BARE' - filenames = ['*.bare'] - aliases = ['bare'] - - flags = re.MULTILINE | re.UNICODE - - keywords = [ - 'type', - 'enum', - 'u8', - 'u16', - 'u32', - 'u64', - 'uint', - 'i8', - 'i16', - 'i32', - 'i64', - 'int', - 'f32', - 'f64', - 'bool', - 'void', - 'data', - 'string', - 'optional', - 'map', - ] - - tokens = { - 'root': [ + +__all__ = ['BareLexer'] + + +class BareLexer(RegexLexer): + """ + For `BARE schema <https://baremessages.org>`_ schema source. + + .. versionadded:: 2.7 + """ + name = 'BARE' + filenames = ['*.bare'] + aliases = ['bare'] + + flags = re.MULTILINE | re.UNICODE + + keywords = [ + 'type', + 'enum', + 'u8', + 'u16', + 'u32', + 'u64', + 'uint', + 'i8', + 'i16', + 'i32', + 'i64', + 'int', + 'f32', + 'f64', + 'bool', + 'void', + 'data', + 'string', + 'optional', + 'map', + ] + + tokens = { + 'root': [ (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)(\{)', bygroups(Keyword, Whitespace, Name.Class, Whitespace, Text), 'struct'), (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)(\()', bygroups(Keyword, Whitespace, Name.Class, Whitespace, Text), 'union'), - (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)', + (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)', bygroups(Keyword, Whitespace, Name, Whitespace), 'typedef'), - (r'(enum)(\s+)([A-Z][a-zA-Z0-9]+)(\s+\{)', + (r'(enum)(\s+)([A-Z][a-zA-Z0-9]+)(\s+\{)', bygroups(Keyword, Whitespace, Name.Class, Whitespace), 'enum'), - (r'#.*?$', Comment), + (r'#.*?$', Comment), (r'\s+', Whitespace), - ], - 'struct': [ - (r'\{', Text, '#push'), - (r'\}', Text, '#pop'), + ], + 'struct': [ + (r'\{', Text, '#push'), + (r'\}', Text, '#pop'), (r'([a-zA-Z0-9]+)(:)(\s*)', bygroups(Name.Attribute, Text, Whitespace), 'typedef'), (r'\s+', Whitespace), - ], - 'union': [ - (r'\)', Text, '#pop'), + ], + 'union': [ + (r'\)', Text, '#pop'), (r'(\s*)(\|)(\s*)', bygroups(Whitespace, Text, Whitespace)), - (r'[A-Z][a-zA-Z0-9]+', Name.Class), - (words(keywords), Keyword), + (r'[A-Z][a-zA-Z0-9]+', Name.Class), + (words(keywords), Keyword), (r'\s+', Whitespace), - ], - 'typedef': [ - (r'\[\]', Text), - (r'#.*?$', Comment, '#pop'), - (r'(\[)(\d+)(\])', bygroups(Text, Literal, Text)), - (r'<|>', Text), - (r'\(', Text, 'union'), - (r'(\[)([a-z][a-z-A-Z0-9]+)(\])', bygroups(Text, Keyword, Text)), - (r'(\[)([A-Z][a-z-A-Z0-9]+)(\])', bygroups(Text, Name.Class, Text)), - (r'([A-Z][a-z-A-Z0-9]+)', Name.Class), - (words(keywords), Keyword), - (r'\n', Text, '#pop'), - (r'\{', Text, 'struct'), + ], + 'typedef': [ + (r'\[\]', Text), + (r'#.*?$', Comment, '#pop'), + (r'(\[)(\d+)(\])', bygroups(Text, Literal, Text)), + (r'<|>', Text), + (r'\(', Text, 'union'), + (r'(\[)([a-z][a-z-A-Z0-9]+)(\])', bygroups(Text, Keyword, Text)), + (r'(\[)([A-Z][a-z-A-Z0-9]+)(\])', bygroups(Text, Name.Class, Text)), + (r'([A-Z][a-z-A-Z0-9]+)', Name.Class), + (words(keywords), Keyword), + (r'\n', Text, '#pop'), + (r'\{', Text, 'struct'), (r'\s+', Whitespace), - (r'\d+', Literal), - ], - 'enum': [ - (r'\{', Text, '#push'), - (r'\}', Text, '#pop'), - (r'([A-Z][A-Z0-9_]*)(\s*=\s*)(\d+)', bygroups(Name.Attribute, Text, Literal)), - (r'([A-Z][A-Z0-9_]*)', bygroups(Name.Attribute)), - (r'#.*?$', Comment), + (r'\d+', Literal), + ], + 'enum': [ + (r'\{', Text, '#push'), + (r'\}', Text, '#pop'), + (r'([A-Z][A-Z0-9_]*)(\s*=\s*)(\d+)', bygroups(Name.Attribute, Text, Literal)), + (r'([A-Z][A-Z0-9_]*)', bygroups(Name.Attribute)), + (r'#.*?$', Comment), (r'\s+', Whitespace), - ], - } + ], + } |