From 6d7ba58f880be618ade07f8ea080fe8c4bf8a896 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:10:44 -0400 Subject: venv --- .../site-packages/pygments/lexers/teal.py | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 venv/lib/python3.11/site-packages/pygments/lexers/teal.py (limited to 'venv/lib/python3.11/site-packages/pygments/lexers/teal.py') diff --git a/venv/lib/python3.11/site-packages/pygments/lexers/teal.py b/venv/lib/python3.11/site-packages/pygments/lexers/teal.py new file mode 100644 index 0000000..e488e09 --- /dev/null +++ b/venv/lib/python3.11/site-packages/pygments/lexers/teal.py @@ -0,0 +1,89 @@ +""" + pygments.lexers.teal + ~~~~~~~~~~~~~~~~~~~~ + + Lexer for TEAL. + + :copyright: Copyright 2006-2023 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), + ], + } -- cgit v1.2.3