ó ’,bc@s¨dZddlZddlZddlmZmZdefd„ƒYZd„ZdZ iZ xBe j ƒD]4Z e rle j ƒ\ZZeeeƒe et|dƒ)}t|jƒ}tj||dƒWdQXdS(s½Dump the grammar tables to a pickle file. dump() recursively changes all dict to OrderedDict, so the pickled file is not exactly the same as what was passed in to dump(). load() uses the pickled file to create the tables, but only changes OrderedDict to dict at the top level; it does not recursively change OrderedDict to dict. So, the loaded tables are different from the original tables that were passed to load() in that some of the OrderedDict (from the pickled file) are not changed back to dict. For parsing, this has no effect on performance because OrderedDict uses dict's __getitem__ with nothing in between. twbiN(topent_make_deterministict__dict__tpickletdump(R tfilenametftd((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyRXs cCs<t|dƒ}tj|ƒ}|jƒ|jj|ƒdS(s+Load the grammar tables from a pickle file.trbN(RRtloadtcloseRtupdate(R RRR((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyRis cCsf|jƒ}x-dD]%}t||t||ƒjƒƒqW|j|_|j|_|j|_|S(s# Copy the grammar. RRRR R R (RRRR R R (t __class__tsetattrtgetattrtcopyRRR (R tnewt dict_attr((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyRps  #   cCszddlm}dGH||jƒdGH||jƒdGH||jƒdGH||jƒdGH||jƒdG|jGHd S( s:Dump the grammar tables to standard output, for debugging.iÿÿÿÿ(tpprintts2ntn2sRRRR N(R"RRRRRR (R R"((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pytreport}s     (t__name__t __module__t__doc__RRRRR%(((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyRs 4   cCs…t|tƒr2tjtd„|jƒDƒƒƒSt|tƒr^g|D]}t|ƒ^qHSt|tƒrtd„|DƒƒS|S(Ncss'|]\}}|t|ƒfVqdS(N(R(t.0tktv((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pys scss|]}t|ƒVqdS(N(R(R)te((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pys ”s( t isinstancetdictt collectionst OrderedDicttsortedt iteritemstlistRttuple(ttopR,((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyRss ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW (R(R/RtRRtobjectRRt opmap_rawtopmapt splitlinestlinetsplittoptnameR(((s+/usr/lib/python2.7/lib2to3/pgen2/grammar.pyt s  v =