/opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__
NameSizeModeActions
conv.cpython-36.opt-1.pyc61610644editdlrm
conv.cpython-36.opt-2.pyc36630644editdlrm
conv.cpython-36.pyc70450644editdlrm
driver.cpython-36.opt-1.pyc50930644editdlrm
driver.cpython-36.opt-2.pyc40340644editdlrm
driver.cpython-36.pyc51410644editdlrm
grammar.cpython-36.opt-1.pyc70700644editdlrm
grammar.cpython-36.opt-2.pyc32420644editdlrm
grammar.cpython-36.pyc70700644editdlrm
literals.cpython-36.opt-1.pyc13590644editdlrm
literals.cpython-36.opt-2.pyc12680644editdlrm
literals.cpython-36.pyc15470644editdlrm
parse.cpython-36.opt-1.pyc63120644editdlrm
parse.cpython-36.opt-2.pyc30770644editdlrm
parse.cpython-36.pyc63420644editdlrm
pgen.cpython-36.opt-1.pyc93460644editdlrm
pgen.cpython-36.opt-2.pyc93320644editdlrm
pgen.cpython-36.pyc97980644editdlrm
token.cpython-36.opt-1.pyc18650644editdlrm
token.cpython-36.opt-2.pyc18010644editdlrm
token.cpython-36.pyc18650644editdlrm
tokenize.cpython-36.opt-1.pyc153270644editdlrm
tokenize.cpython-36.opt-2.pyc113820644editdlrm
tokenize.cpython-36.pyc153990644editdlrm
__init__.cpython-36.opt-1.pyc1720644editdlrm
__init__.cpython-36.opt-2.pyc1300644editdlrm
__init__.cpython-36.pyc1720644editdlrm
Edit: /opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__/conv.cpython-36.opt-1.pyc (6161B)
3 kf%@s2dZddlZddlmZmZGdddejZdS)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc@s0eZdZdZddZddZddZdd Zd S) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. cCs |j||j||jdS)z@rd||d|<qWqW||f||<q4W|dt|}}||_g}|dt|}}tjd|}t |jd}xjt |D]^}|dt|}}tjd|}|j \}}t |}|dkrd}nt|}|j ||fqpW|dt|}}||_|dt|}}|dt|}}tjd|}t |jd}|dt|}}|dt|}}tjd|}t |jd}|dt|}}tjd|}t |jd} | |_|dt|}}y|dt|}}Wntk rYnXdS)aParse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; zCan't open %s: %sFNrr z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)r rrnext startswithrrlistmaprrrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!rrrrrrZallarcsr)rnmkZarcs_ijststater.ZndfasrrxyzfirstZ rawbitsetcZbyter/Znlabelsr0r r r rTs         "        zConverter.parse_graminit_ccCs\i|_i|_xJt|jD]<\}\}}|tjkrB|dk rB||j|<q|dkr||j|<qWdS)z1Create additional useful structures. (Internal).N)keywordstokensr,r/rNAME)rZilabeltypevaluer r r rs zConverter.finish_offN)__name__ __module__ __qualname____doc__r rrrr r r r r$s  &r)rHrZpgen2rrZGrammarrr r r r s