Server IP : 85.214.239.14 / Your IP : 3.15.12.133 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/pygments/lexers/ |
Upload File : |
""" pygments.lexers.bare ~~~~~~~~~~~~~~~~~~~~ Lexer for the BARE schema. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ 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 source. .. versionadded:: 2.7 """ name = 'BARE' url = 'https://baremessages.org' filenames = ['*.bare'] aliases = ['bare'] 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+)', bygroups(Keyword, Whitespace, Name, Whitespace), 'typedef'), (r'(enum)(\s+)([A-Z][a-zA-Z0-9]+)(\s+\{)', bygroups(Keyword, Whitespace, Name.Class, Whitespace), 'enum'), (r'#.*?$', Comment), (r'\s+', Whitespace), ], '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'), (r'(\s*)(\|)(\s*)', bygroups(Whitespace, Text, Whitespace)), (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'), (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'\s+', Whitespace), ], }