Server IP : 85.214.239.14 / Your IP : 3.142.130.127 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 : /proc/2/root/lib/python3/dist-packages/pygments/lexers/ |
Upload File : |
""" pygments.lexers.sophia ~~~~~~~~~~~~~~~~~~~~~~ Lexer for Sophia. Derived from pygments/lexers/reason.py. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexer, include, default, words from pygments.token import Comment, Keyword, Name, Number, Operator, \ Punctuation, String, Text __all__ = ['SophiaLexer'] class SophiaLexer(RegexLexer): """ A Sophia lexer. .. versionadded:: 2.11 """ name = 'Sophia' aliases = ['sophia'] filenames = ['*.aes'] mimetypes = [] keywords = ( 'contract', 'include', 'let', 'switch', 'type', 'record', 'datatype', 'if', 'elif', 'else', 'function', 'stateful', 'payable', 'public', 'entrypoint', 'private', 'indexed', 'namespace', 'interface', 'main', 'using', 'as', 'for', 'hiding', ) builtins = ('state', 'put', 'abort', 'require') word_operators = ('mod', 'band', 'bor', 'bxor', 'bnot') primitive_types = ('int', 'address', 'bool', 'bits', 'bytes', 'string', 'list', 'option', 'char', 'unit', 'map', 'event', 'hash', 'signature', 'oracle', 'oracle_query') tokens = { 'escape-sequence': [ (r'\\[\\"\'ntbr]', String.Escape), (r'\\[0-9]{3}', String.Escape), (r'\\x[0-9a-fA-F]{2}', String.Escape), ], 'root': [ (r'\s+', Text.Whitespace), (r'(true|false)\b', Keyword.Constant), (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Class, 'dotted'), (r'\b([A-Z][\w\']*)', Name.Function), (r'//.*?\n', Comment.Single), (r'\/\*(?!/)', Comment.Multiline, 'comment'), (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex), (r'#[\da-fA-F][\da-fA-F_]*', Name.Label), (r'\d[\d_]*', Number.Integer), (words(keywords, suffix=r'\b'), Keyword), (words(builtins, suffix=r'\b'), Name.Builtin), (words(word_operators, prefix=r'\b', suffix=r'\b'), Operator.Word), (words(primitive_types, prefix=r'\b', suffix=r'\b'), Keyword.Type), (r'[=!<>+\\*/:&|?~@^-]', Operator.Word), (r'[.;:{}(),\[\]]', Punctuation), (r"(ak_|ok_|oq_|ct_)[\w']*", Name.Label), (r"[^\W\d][\w']*", Name), (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", String.Char), (r"'.'", String.Char), (r"'[a-z][\w]*", Name.Variable), (r'"', String.Double, 'string') ], 'comment': [ (r'[^/*]+', Comment.Multiline), (r'\/\*', Comment.Multiline, '#push'), (r'\*\/', Comment.Multiline, '#pop'), (r'\*', Comment.Multiline), ], 'string': [ (r'[^\\"]+', String.Double), include('escape-sequence'), (r'\\\n', String.Double), (r'"', String.Double, '#pop'), ], 'dotted': [ (r'\s+', Text), (r'\.', Punctuation), (r'[A-Z][\w\']*(?=\s*\.)', Name.Function), (r'[A-Z][\w\']*', Name.Function, '#pop'), (r'[a-z_][\w\']*', Name, '#pop'), default('#pop'), ], }