8.2.34 | Linux | www-data (uid:33)
👁 View: pygram.py
📁 //snap/core20/current/lib/python3.8/lib2to3/pygram.py
# 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)
← Back
💻 Terminal
📤 Upload
📂
Click or Drag & Drop
📁 //snap/core20/current/lib/python3.8/lib2to3
NameSizePermModifiedActions
📁 __pycache__/-07552026-09-01 05:21🗑 Delete
📁 fixes/-07552026-09-01 05:21🗑 Delete
📁 pgen2/-07552026-09-01 05:21🗑 Delete
Grammar.txt8.5K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
PatternGrammar.txt793B06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
__init__.py7B06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
__main__.py67B06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
btm_matcher.py6.5K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
btm_utils.py9.7K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
fixer_base.py6.5K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
fixer_util.py14.9K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
main.py11.4K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
patcomp.py6.9K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
pygram.py1.3K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
pytree.py27.3K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del
refactor.py26.8K06442021-05-11 08:35👁 View ✏️ Edit 📝 Rename 📦 Move 🗑 Del