# 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.iteritems(): setattr(self, name, symbol) python_grammar = driver.load_grammar(_GRAMMAR_FILE) python_symbols = Symbols(python_grammar) python_grammar_no_print_statement = python_grammar.copy() del python_grammar_no_print_statement.keywords["print"] pattern_grammar = driver.load_grammar(_PATTERN_GRAMMAR_FILE) pattern_symbols = Symbols(pattern_grammar)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
fixes | Folder | 0755 |
|
|
pgen2 | Folder | 0755 |
|
|
.__init__.pyo.40009 | File | 127 B | 0644 |
|
.__main__.pyo.40009 | File | 242 B | 0644 |
|
.btm_matcher.pyo.40009 | File | 5.69 KB | 0644 |
|
.btm_utils.pyo.40009 | File | 7.39 KB | 0644 |
|
.fixer_base.pyo.40009 | File | 7.09 KB | 0644 |
|
.fixer_util.pyo.40009 | File | 14.34 KB | 0644 |
|
.pygram.pyo.40009 | File | 1.38 KB | 0644 |
|
Grammar.txt | File | 6.43 KB | 0644 |
|
Grammar2.7.5.final.0.pickle | File | 19.75 KB | 0644 |
|
PatternGrammar.txt | File | 793 B | 0644 |
|
PatternGrammar2.7.5.final.0.pickle | File | 1.35 KB | 0644 |
|
__init__.py | File | 7 B | 0644 |
|
__init__.pyc | File | 127 B | 0644 |
|
__init__.pyo | File | 127 B | 0644 |
|
__main__.py | File | 67 B | 0644 |
|
__main__.pyc | File | 242 B | 0644 |
|
__main__.pyo | File | 242 B | 0644 |
|
btm_matcher.py | File | 6.67 KB | 0644 |
|
btm_matcher.pyc | File | 5.69 KB | 0644 |
|
btm_matcher.pyo | File | 5.69 KB | 0644 |
|
btm_utils.py | File | 9.78 KB | 0644 |
|
btm_utils.pyc | File | 7.39 KB | 0644 |
|
btm_utils.pyo | File | 7.39 KB | 0644 |
|
fixer_base.py | File | 6.69 KB | 0644 |
|
fixer_base.pyc | File | 7.09 KB | 0644 |
|
fixer_base.pyo | File | 7.09 KB | 0644 |
|
fixer_util.py | File | 14.25 KB | 0644 |
|
fixer_util.pyc | File | 14.34 KB | 0644 |
|
fixer_util.pyo | File | 14.34 KB | 0644 |
|
main.py | File | 11.33 KB | 0644 |
|
main.pyc | File | 9.6 KB | 0644 |
|
main.pyo | File | 9.56 KB | 0644 |
|
patcomp.py | File | 6.92 KB | 0644 |
|
patcomp.pyc | File | 6.51 KB | 0644 |
|
patcomp.pyo | File | 6.21 KB | 0644 |
|
pygram.py | File | 1.09 KB | 0644 |
|
pygram.pyc | File | 1.38 KB | 0644 |
|
pygram.pyo | File | 1.38 KB | 0644 |
|
pytree.py | File | 28.36 KB | 0644 |
|
pytree.pyc | File | 29.59 KB | 0644 |
|
pytree.pyo | File | 28.73 KB | 0644 |
|
refactor.py | File | 27.41 KB | 0644 |
|
refactor.pyc | File | 23.4 KB | 0644 |
|
refactor.pyo | File | 23.35 KB | 0644 |
|