Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../lib2to3
File: pygram.py
# Copyright 2006 Google, Inc. All Rights Reserved.
[0] Fix | Delete
# Licensed to PSF under a Contributor Agreement.
[1] Fix | Delete
[2] Fix | Delete
"""Export the Python grammar and symbols."""
[3] Fix | Delete
[4] Fix | Delete
# Python imports
[5] Fix | Delete
import os
[6] Fix | Delete
[7] Fix | Delete
# Local imports
[8] Fix | Delete
from .pgen2 import token
[9] Fix | Delete
from .pgen2 import driver
[10] Fix | Delete
from . import pytree
[11] Fix | Delete
[12] Fix | Delete
# The grammar file
[13] Fix | Delete
_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt")
[14] Fix | Delete
_PATTERN_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__),
[15] Fix | Delete
"PatternGrammar.txt")
[16] Fix | Delete
[17] Fix | Delete
[18] Fix | Delete
class Symbols(object):
[19] Fix | Delete
[20] Fix | Delete
def __init__(self, grammar):
[21] Fix | Delete
"""Initializer.
[22] Fix | Delete
[23] Fix | Delete
Creates an attribute for each grammar symbol (nonterminal),
[24] Fix | Delete
whose value is the symbol's type (an int >= 256).
[25] Fix | Delete
"""
[26] Fix | Delete
for name, symbol in grammar.symbol2number.iteritems():
[27] Fix | Delete
setattr(self, name, symbol)
[28] Fix | Delete
[29] Fix | Delete
[30] Fix | Delete
python_grammar = driver.load_packaged_grammar("lib2to3", _GRAMMAR_FILE)
[31] Fix | Delete
[32] Fix | Delete
python_symbols = Symbols(python_grammar)
[33] Fix | Delete
[34] Fix | Delete
python_grammar_no_print_statement = python_grammar.copy()
[35] Fix | Delete
del python_grammar_no_print_statement.keywords["print"]
[36] Fix | Delete
[37] Fix | Delete
pattern_grammar = driver.load_packaged_grammar("lib2to3", _PATTERN_GRAMMAR_FILE)
[38] Fix | Delete
pattern_symbols = Symbols(pattern_grammar)
[39] Fix | Delete
[40] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function