/snap/core18/2979/usr/lib/python3.6/lib2to3/pgen2/__pycache__
NameSizeModeActions
conv.cpython-36.pyc70300644editdlrm
driver.cpython-36.pyc49700644editdlrm
grammar.cpython-36.pyc70550644editdlrm
literals.cpython-36.pyc15320644editdlrm
parse.cpython-36.pyc63270644editdlrm
pgen.cpython-36.pyc97830644editdlrm
token.cpython-36.pyc18500644editdlrm
tokenize.cpython-36.pyc153840644editdlrm
__init__.cpython-36.pyc1570644editdlrm
Edit: /snap/core18/2979/usr/lib/python3.6/lib2to3/pgen2/__pycache__/driver.cpython-36.pyc (4970B)
3 ]\@sdZdZddgZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZGdddeZd d ZdddZddZddZddZedkrejee dS)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc@sHeZdZdddZdddZdddZdd d Zdd d Zdd dZdS)rNcCs&||_|dkrtj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrr r r*/usr/lib/python3.6/lib2to3/pgen2/driver.py__init__ s zDriver.__init__FcCstj|j|j}|jd}d}d}}}} } d} xR|D]4} | \}}}} } |||fkr||f|ks|t||f|f|\} }|| kr| d| |7} | }d}||kr| | ||7} |}|tjtjfkr| |7} | \}}|j dr@|d7}d}q@|t j krtj |}|r,|j jdt j||| |j||| |frT|rR|j jdPd} | \}}|j dr@|d7}d}q@Wtjd||| |f|jS) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rZParserrr ZsetupAssertionErrorrCOMMENTNLendswithrOPZopmapr debugtok_nameZaddtokenZ ParseErrorZrootnode)rtokensrplinenocolumntypevaluestartendZ line_textprefixZ quintupleZs_linenoZs_columnrrr parse_tokens'sT      zDriver.parse_tokenscCstj|j}|j||S)z*Parse a stream and return the syntax tree.)rgenerate_tokensreadliner$)rstreamrrrrrparse_stream_rawWs zDriver.parse_stream_rawcCs |j||S)z*Parse a stream and return the syntax tree.)r()rr'rrrr parse_stream\szDriver.parse_streamc Cs*tj|d|}z |j||S|jXdS)z(Parse a file and return the syntax tree.rN)codecsopenr)close)rfilenameencodingrr'rrr parse_file`s zDriver.parse_filecCstjtj|j}|j||S)z*Parse a string and return the syntax tree.)rr%ioStringIOr&r$)rtextrrrrr parse_stringhszDriver.parse_string)NN)F)F)F)NF)F) __name__ __module__ __qualname__rr$r(r)r0r4rrrrrs   0   cCs:tjj|\}}|dkrd}||djtttjdS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtailrrr_generate_pickle_namensrD Grammar.txtTFcCsb|dkrtj}|dkr t|n|}|s4t|| rL|jd|tj|}ntj}|j ||S)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %s) r r rD_newerinfor Zgenerate_grammarrGrammarload)rAZgpsaveforcer grrrrus   cCs8tjj|sdStjj|s dStjj|tjj|kS)z0Inquire whether file a was written since file b.FT)r9r:existsgetmtime)abrrrrFs   rFcCsFtjj|rt|Sttjj|}tj||}tj }|j ||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) r9r:isfilerrDbasenamepkgutilget_datarrHloads)packageZgrammar_sourceZ pickled_namedatarLrrrload_packaged_grammars   rXcGsF|stjdd}tjtjtjddx|D]}t|dddq,WdS)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr'formatT)rJrK)r?argvr Z basicConfigINFOstdoutr)argsrArrrmains  r___main__)rENTFN)__doc__ __author____all__r+r1r9r rSr?rrrrrr objectrrDrrFrXr_r5exitintrrrr s$P