Server IP : 85.214.239.14 / Your IP : 3.144.9.183 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/usr/lib/python3/dist-packages/pygments/lexers/ |
Upload File : |
""" pygments.lexers.teal ~~~~~~~~~~~~~~~~~~~~ Lexer for TEAL. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexer, bygroups, include, words from pygments.token import Comment, Name, Number, String, Text, Keyword, \ Whitespace __all__ = ['TealLexer'] class TealLexer(RegexLexer): """ For the Transaction Execution Approval Language (TEAL) For more information about the grammar, see: https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go .. versionadded:: 2.9 """ name = 'teal' url = 'https://developer.algorand.org/docs/reference/teal/specification/' aliases = ['teal'] filenames = ['*.teal'] keywords = words({ 'Sender', 'Fee', 'FirstValid', 'FirstValidTime', 'LastValid', 'Note', 'Lease', 'Receiver', 'Amount', 'CloseRemainderTo', 'VotePK', 'SelectionPK', 'VoteFirst', 'VoteLast', 'VoteKeyDilution', 'Type', 'TypeEnum', 'XferAsset', 'AssetAmount', 'AssetSender', 'AssetReceiver', 'AssetCloseTo', 'GroupIndex', 'TxID', 'ApplicationID', 'OnCompletion', 'ApplicationArgs', 'NumAppArgs', 'Accounts', 'NumAccounts', 'ApprovalProgram', 'ClearStateProgram', 'RekeyTo', 'ConfigAsset', 'ConfigAssetTotal', 'ConfigAssetDecimals', 'ConfigAssetDefaultFrozen', 'ConfigAssetUnitName', 'ConfigAssetName', 'ConfigAssetURL', 'ConfigAssetMetadataHash', 'ConfigAssetManager', 'ConfigAssetReserve', 'ConfigAssetFreeze', 'ConfigAssetClawback', 'FreezeAsset', 'FreezeAssetAccount', 'FreezeAssetFrozen', 'NoOp', 'OptIn', 'CloseOut', 'ClearState', 'UpdateApplication', 'DeleteApplication', 'MinTxnFee', 'MinBalance', 'MaxTxnLife', 'ZeroAddress', 'GroupSize', 'LogicSigVersion', 'Round', 'LatestTimestamp', 'CurrentApplicationID', 'AssetBalance', 'AssetFrozen', 'AssetTotal', 'AssetDecimals', 'AssetDefaultFrozen', 'AssetUnitName', 'AssetName', 'AssetURL', 'AssetMetadataHash', 'AssetManager', 'AssetReserve', 'AssetFreeze', 'AssetClawback', }, suffix=r'\b') identifier = r'[^ \t\n]+(?=\/\/)|[^ \t\n]+' newline = r'\r?\n' tokens = { 'root': [ include('whitespace'), # pragmas match specifically on the space character (r'^#pragma .*' + newline, Comment.Directive), # labels must be followed by a space, # but anything after that is ignored ('(' + identifier + ':' + ')' + '([ \t].*)', bygroups(Name.Label, Comment.Single)), (identifier, Name.Function, 'function-args'), ], 'function-args': [ include('whitespace'), (r'"', String, 'string'), (r'(b(?:ase)?(?:32|64) ?)(\(?[a-zA-Z0-9+/=]+\)?)', bygroups(String.Affix, String.Other)), (r'[A-Z2-7]{58}', Number), # address (r'0x[\da-fA-F]+', Number.Hex), (r'\d+', Number.Integer), (keywords, Keyword), (identifier, Name.Attributes), # branch targets (newline, Text, '#pop'), ], 'string': [ (r'\\(?:["nrt\\]|x\d\d)', String.Escape), (r'[^\\\"\n]+', String), (r'"', String, '#pop'), ], 'whitespace': [ (r'[ \t]+', Whitespace), (r'//[^\n]+', Comment.Single), ], }