Server IP : 85.214.239.14 / Your IP : 3.135.185.207 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/proc/3/task/3/root/proc/3/root/lib/python3/dist-packages/pygments/lexers/ |
Upload File : |
""" pygments.lexers.tal ~~~~~~~~~~~~~~~~~~~ Lexer for Uxntal .. versionadded:: 2.12 :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexer, words from pygments.token import Comment, Keyword, Name, String, Number, \ Punctuation, Whitespace, Literal __all__ = ['TalLexer'] class TalLexer(RegexLexer): """ For `Uxntal <https://wiki.xxiivv.com/site/uxntal.html>`_ source code. .. versionadded:: 2.12 """ name = 'Tal' aliases = ['tal', 'uxntal'] filenames = ['*.tal'] mimetypes = ['text/x-uxntal'] instructions = [ 'BRK', 'LIT', 'INC', 'POP', 'DUP', 'NIP', 'SWP', 'OVR', 'ROT', 'EQU', 'NEQ', 'GTH', 'LTH', 'JMP', 'JCN', 'JSR', 'STH', 'LDZ', 'STZ', 'LDR', 'STR', 'LDA', 'STA', 'DEI', 'DEO', 'ADD', 'SUB', 'MUL', 'DIV', 'AND', 'ORA', 'EOR', 'SFT' ] tokens = { # the comment delimiters must not be adjacent to non-space characters. # this means ( foo ) is a valid comment but (foo) is not. this also # applies to nested comments. 'comment': [ (r'(?<!\S)\((?!\S)', Comment.Multiline, '#push'), # nested comments (r'(?<!\S)\)(?!\S)', Comment.Multiline, '#pop'), # nested comments (r'[^()]+', Comment.Multiline), # comments (r'[()]+', Comment.Multiline), # comments ], 'root': [ (r'\s+', Whitespace), # spaces (r'(?<!\S)\((?!\S)', Comment.Multiline, 'comment'), # comments (words(instructions, prefix=r'(?<!\S)', suffix=r'2?k?r?(?!\S)'), Keyword.Reserved), # instructions (r'[][{}](?!\S)', Punctuation), # delimiters (r'#([0-9a-f]{2}){1,2}(?!\S)', Number.Hex), # integer (r'"\S+', String), # raw string (r"'\S(?!\S)", String.Char), # raw char (r'([0-9a-f]{2}){1,2}(?!\S)', Literal), # raw integer (r'[|$][0-9a-f]{1,4}(?!\S)', Keyword.Declaration), # abs/rel pad (r'%\S+', Name.Decorator), # macro (r'@\S+', Name.Function), # label (r'&\S+', Name.Label), # sublabel (r'/\S+', Name.Tag), # spacer (r'\.\S+', Name.Variable.Magic), # zero page addr (r',\S+', Name.Variable.Instance), # rel addr (r';\S+', Name.Variable.Global), # abs addr (r':\S+', Literal), # raw addr (r'~\S+', Keyword.Namespace), # include (r'\S+', Name), ] } def analyse_text(text): return '|0100' in text[:500]