/usr/lib64/python3.9/lib2to3/pgen2/__pycache__
NameSizeModeActions
conv.cpython-39.opt-1.pyc61340644editdlrm
conv.cpython-39.opt-2.pyc36520644editdlrm
conv.cpython-39.pyc69950644editdlrm
driver.cpython-39.opt-1.pyc50970644editdlrm
driver.cpython-39.opt-2.pyc41010644editdlrm
driver.cpython-39.pyc51290644editdlrm
grammar.cpython-39.opt-1.pyc57070644editdlrm
grammar.cpython-39.opt-2.pyc25560644editdlrm
grammar.cpython-39.pyc57070644editdlrm
literals.cpython-39.opt-1.pyc13640644editdlrm
literals.cpython-39.opt-2.pyc12870644editdlrm
literals.cpython-39.pyc15310644editdlrm
parse.cpython-39.opt-1.pyc64660644editdlrm
parse.cpython-39.opt-2.pyc32420644editdlrm
parse.cpython-39.pyc64800644editdlrm
pgen.cpython-39.opt-1.pyc93190644editdlrm
pgen.cpython-39.opt-2.pyc93190644editdlrm
pgen.cpython-39.pyc97220644editdlrm
token.cpython-39.opt-1.pyc18890644editdlrm
token.cpython-39.opt-2.pyc18390644editdlrm
token.cpython-39.pyc18890644editdlrm
tokenize.cpython-39.opt-1.pyc151240644editdlrm
tokenize.cpython-39.opt-2.pyc112300644editdlrm
tokenize.cpython-39.pyc151730644editdlrm
__init__.cpython-39.opt-1.pyc1670644editdlrm
__init__.cpython-39.opt-2.pyc1390644editdlrm
__init__.cpython-39.pyc1670644editdlrm
Edit: /usr/lib64/python3.9/lib2to3/pgen2/__pycache__/conv.cpython-39.opt-1.pyc (6134B)
a ´iª%ã@s2dZddlZddlmZmZGdd„dejƒZdS)aýConvert 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)ÚgrammarÚtokenc@s0eZdZdZdd„Zdd„Zdd„Zdd „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 | |¡| |¡| ¡dS)z@rÌd||d|<qÌq´||f||<q&|dt|ƒ}}||_g}|dt|ƒ}}t d|¡}t | d¡ƒ}t |ƒD]^}|dt|ƒ}}t d|¡}|  ¡\}}t |ƒ}|dkrœd}nt|ƒ}|  ||f¡qV|dt|ƒ}}||_|dt|ƒ}}|dt|ƒ}}t d|¡}t | d¡ƒ}|dt|ƒ}}|dt|ƒ}}t d|¡}t | d¡ƒ}|dt|ƒ}}t d|¡}t | d¡ƒ} | |_|dt|ƒ}}z|dt|ƒ}}Wnty¸Yn0dS)aùParse 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__}, ... }; r NFrr 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+)$)rrrÚnextÚ startswithrrÚlistÚmaprrÚrangeÚappendÚstatesÚgroupÚevalÚ enumerateÚordÚdfasÚlabelsÚstartÚ StopIteration)!rrrrrrZallarcsr*rÚnÚmÚkZarcsÚ_ÚiÚjÚsÚtÚstater/ZndfasrrÚxÚyÚzÚfirstZ rawbitsetÚcZbyter0Znlabelsr1r r r rTs¾   ÿ          ÿ "          zConverter.parse_graminit_ccCsXi|_i|_t|jƒD]<\}\}}|tjkr@|dur@||j|<q|dur||j|<qdS)z1Create additional useful structures. (Internal).N)ÚkeywordsÚtokensr-r0rÚNAME)rZilabelÚtypeÚvaluer r r rùs zConverter.finish_offN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrr r r r r$s  &r)rIrZpgen2rrZGrammarrr r r r Ús