2Sce@s dZdZdZdZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkgeZ e jdldmkZere jZeZeZeZejejZnAe jZeZdnZejejZdoZejejZgZ ddl!Z!xEdpj"D]7Z#ye j$e%e!e#Wne&k rqLnXqLWdqZ'dre(fdsYZ)ej*Z+e+dtZ,ee+Z-eduZ.dvj/gej0D]Z1e1ej2kre1^qZ3de4fdwYZ5d e5fdxYZ6d"e5fdyYZ7d$e7fdzYZ8d'e4fd{YZ9d|e(fd}YZ:d#e(fd~YZ;dZ<dZ=dZ>dZ?dZ@dZAdZBe rdmdZCn dmdZCd%e(fdYZDd-eDfdYZEdeEfdYZFdeEfdYZGdeEfdYZHeHZIdeEfdYZJd eHfdYZKdeJfdYZLd1eEfdYZMd(eEfdYZNd&eEfdYZOd eEfdYZPd0eEfdYZQdeEfdYZRdeRfdYZSdeRfdYZTdeRfdYZUd+eRfdYZVd*eRfdYZWd3eRfdYZXd2eRfdYZYd!eDfdYZZdeZfdYZ[deZfdYZ\deZfdYZ]d eZfdYZ^deDfdYZ_de_fdYZ`de_fdYZad4e_fdYZbde_fdYZcde(fdYZdedZede_fdYZfd)e_fdYZgde_fdYZhdehfdYZid.e_fdYZjd/ejfdYZkd ejfdYZldejfdYZmd ejfdYZnd,ejfdYZode(fdYZpdZqderdZsetdZudZvdZwdZxdZyerezdZ{dZ|ezdZ}dZ~eFjdEZeTjdMZeUjdLZeVjdeZeWjddZeMe.dddmjdZdvj/ge3D]Z1e1dkre1^qZeNdjdZeNdjdZeeBeBeMeddBZemeeodeZeHdefdjdemeceeBjddZdZdZdZdZdZdZdZdZdZdZdZdZdZe(e_e)Ze(e_e(e_dZeNdjdZeNdjdZeNdjdZeleIdejZddetejdZezdZedZedZeeMee-d\ZZeleIde{djddjZeedj"dZdZeNdjdZeNdZeNdjZeNdjdZeNdjdZeZeNdjdZdvj/ge3D]Z1e1dkr e1^q ZeleceMeefeMdeHdeUjjdZesefejeBddvjd<Zedkr dZeKdZeKdZeMee-dZeseddezjeZemeseZeseddezjeZemeseZedeBjdeejd Zed ed ed ed edededededededndS(su pyparsing module - Classes and methods to define and execute parsing grammars The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. With pyparsing, you don't need to learn a new syntax for defining grammars or matching expressions - the parsing module provides a library of classes that you use to construct the grammar directly in Python. Here is a program to parse "Hello, World!" (or any greeting of the form C{", !"}):: from pyparsing import Word, alphas # define grammar of a greeting greet = Word( alphas ) + "," + Word( alphas ) + "!" hello = "Hello, World!" print hello, "->", greet.parseString( hello ) The program outputs the following:: Hello, World! -> ['Hello', ',', 'World', '!'] The Python representation of the grammar is quite readable, owing to the self-explanatory class names, and the use of '+', '|' and '^' operators. The parsed results returned from C{parseString()} can be accessed as a nested list, a dictionary, or an object with named attributes. The pyparsing module handles some of the problems that are typically vexing when writing text parsers: - extra or missing whitespace (the above program will also handle "Hello,World!", "Hello , World !", etc.) - quoted strings - embedded comments s1.5.6s26 June 2011 10:53s*Paul McGuire iN(treftAndtCaselessKeywordtCaselessLiteralt CharsNotIntCombinetDicttEachtEmptyt FollowedBytForwardt GoToColumntGrouptKeywordtLineEndt LineStarttLiteralt MatchFirsttNoMatchtNotAnyt OneOrMoretOnlyOncetOptionaltOrtParseBaseExceptiontParseElementEnhancetParseExceptiontParseExpressiontParseFatalExceptiont ParseResultstParseSyntaxExceptiont ParserElementt QuotedStringtRecursiveGrammarExceptiontRegextSkipTot StringEndt StringStarttSuppresstTokentTokenConvertertUpcasetWhitetWordtWordEndt WordStartt ZeroOrMoret alphanumstalphast alphas8bitt anyCloseTagt anyOpenTagt cStyleCommenttcoltcommaSeparatedListtcommonHTMLEntityt countedArraytcppStyleCommenttdblQuotedStringtdblSlashCommentt delimitedListtdictOftdowncaseTokenstemptytgetTokensEndLocthexnumst htmlCommenttjavaStyleCommenttkeepOriginalTexttlinetlineEndt lineStarttlinenot makeHTMLTagst makeXMLTagstmatchOnlyAtColtmatchPreviousExprtmatchPreviousLiteralt nestedExprtnullDebugActiontnumstoneOftopAssoctoperatorPrecedencet printablestpunc8bittpythonStyleCommentt quotedStringt removeQuotestreplaceHTMLEntityt replaceWitht restOfLinetsglQuotedStringtsranget stringEndt stringStartttraceParseActiont unicodeStringt upcaseTokenst withAttributet indentedBlocktoriginalTextForiicCs#tg|D]}|df^q S(Ni(tdict(tstc((s-/usr/lib/python2.7/site-packages/pyparsing.pytlscCs@t|tr|Syt|SWntk r;t|SXdS(sDrop-in replacement for str(obj) that tries to be Unicode friendly. It first tries str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It then < returns the unicode object | encodes it with the default encoding | ... >. N(t isinstancetunicodetstrtUnicodeEncodeError(tobj((s-/usr/lib/python2.7/site-packages/pyparsing.pyt_ustros  s8sum len enumerate sorted reversed list tuple set any allcCscd}gdjD]}d|d^q}x/t||D]\}}|j||}q=W|S(s/Escape &, <, >, ", ', etc. in a string of data.s&><"'samp gt lt quot apost&t;(tsplittziptreplace(tdatat from_symbolsRgt to_symbolstfrom_tto_((s-/usr/lib/python2.7/site-packages/pyparsing.pyt _xml_escapes 't _ConstantscBseZRS((t__name__t __module__(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR{st ABCDEFabcdefi\tcBsPeZdZdd d dZdZdZdZddZdZ RS( s7base exception class for all parsing runtime exceptionsicCsI||_|dkr*||_d|_n||_||_||_dS(NR(tloctNonetmsgtpstrt parserElement(tselfRRRtelem((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__init__s      cCsm|dkrt|j|jS|dkr>t|j|jS|dkr]t|j|jSt|dS(ssupported attributes by name are: - lineno - returns the line number of the exception text - col - returns the column number of the exception text - line - returns the line containing the exception text RHR5tcolumnREN(scolscolumn(RHRRR5REtAttributeError(Rtaname((s-/usr/lib/python2.7/site-packages/pyparsing.pyt __getattr__s   cCs d|j|j|j|jfS(Ns"%s (at char %d), (line:%d, col:%d)(RRRHR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__str__scCs t|S(N(Ro(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__repr__ss>!}) cCs/t||r|Stj|}t|_|S(N(Rjtobjectt__new__tTruet_ParseResults__doinit(tclsttoklisttnametasListtmodaltretobj((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs  cCs|jrdt|_d|_d|_i|_||trI||_n |g|_t|_ n|dk r|r|sd|j|s  cCs||trB|jj|t|g|j|<|d}nZ||trg||j|<|}n5|jj|tt|dg|j|<|}||trt||_ndS(Ni( RRtgetRRRRtwkrefR(RtkRRjtsub((s-/usr/lib/python2.7/site-packages/pyparsing.pyt __setitem__Gs&   /c Cst|ttfrt|j}|j|=t|trl|dkrV||7}nt||d}ntt|j|}|jx||j D]d}|j |}xN|D]F}x=t |D]/\}\}} t || | |k||s||jdd|S(sReturns current column within a string, counting newlines as line separators. The first column is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. s ii(Rtrfind(Rtstrg((s-/usr/lib/python2.7/site-packages/pyparsing.pyR5ms cCs|jdd|dS(sReturns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}} for more information on parsing strings containing s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. s ii(tcount(RR ((s-/usr/lib/python2.7/site-packages/pyparsing.pyRHys cCsR|jdd|}|jd|}|dkrB||d|!S||dSdS(sfReturns the line of text containing loc within a string, counting newlines as line separators. s iiN(R tfind(RR tlastCRtnextCR((s-/usr/lib/python2.7/site-packages/pyparsing.pyREs  cCsAdt|dt|dt||t||fGHdS(NsMatch s at loc s(%d,%d)(RoRHR5(tinstringRtexpr((s-/usr/lib/python2.7/site-packages/pyparsing.pyt_defaultStartDebugActionscCs'dt|dt|jGHdS(NsMatched s -> (RoRlR(RtstartloctendlocRttoks((s-/usr/lib/python2.7/site-packages/pyparsing.pyt_defaultSuccessDebugActionscCsdt|GHdS(NsException raised:(Ro(RRRtexc((s-/usr/lib/python2.7/site-packages/pyparsing.pyt_defaultExceptionDebugActionscGsdS(sG'Do-nothing' debug action, to suppress debugging output during parsing.N((targs((s-/usr/lib/python2.7/site-packages/pyparsing.pyROscs"dgfd}|S(Nics]xVy|dSWqtk rUdkrOdcd7d5Z?d6Z@d7ZAd8ZBd9ZCRS(:s)Abstract base level parser element class.s cCs |t_dS(s/Overrides the default whitespace chars N(RtDEFAULT_WHITE_CHARS(tchars((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetDefaultWhitespaceCharsscCst|_d|_d|_d|_||_t|_t j |_ t|_ t |_t |_t|_t |_t |_t|_d|_t|_d|_d|_t|_t |_dS(NR(NNN(Rt parseActionRt failActiontstrReprt resultsNamet saveAsListRtskipWhitespaceRR!t whiteCharstcopyDefaultWhiteCharsRtmayReturnEmptytkeepTabst ignoreExprstdebugt streamlinedt mayIndexErrorterrmsgt modalResultst debugActionstret callPreparset callDuringTry(Rtsavelist((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs(                   cCsEtj|}|j|_|j|_|jrAtj|_n|S(sMake a copy of this C{ParserElement}. Useful for defining different parse actions for the same parsing pattern, using copies of the original parse element.(RR$R.R+RR!R*(Rtcpy((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs    cCs>||_d|j|_t|dr:|j|j_n|S(s6Define name for this expression, for use in debugging.s Expected t exception(RR2thasattrR:R(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetNames  cCsE|j}|jdr.|d }t}n||_| |_|S(s%Define name for referencing matching tokens as a nested attribute of the returned parse results. NOTE: this returns a *copy* of the original C{ParserElement} object; this is so that the client can define a basic element, such as an integer, and reference it in multiple places with different names. You can also set results names using the abbreviated syntax, C{expr("name")} in place of C{expr.setResultsName("name")} - see L{I{__call__}<__call__>}. t*i(RtendswithRR'R3(RRtlistAllMatchestnewself((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetResultsNames     csa|r9|jttfd}|_||_n$t|jdr]|jj|_n|S(sMethod to invoke the Python pdb debugger when this element is about to be parsed. Set C{breakFlag} to True to enable, False to disable. cs)ddl}|j||||S(Ni(tpdbt set_trace(RRt doActionst callPreParseRB(t _parseMethod(s-/usr/lib/python2.7/site-packages/pyparsing.pytbreakers  t_originalParseMethod(t_parseRRHR;(Rt breakFlagRG((RFs-/usr/lib/python2.7/site-packages/pyparsing.pytsetBreaks   cOs;tttt||_d|ko1|d|_|S(sVDefine action to perform when successfully matching parse element definition. Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: - s = the original string being parsed (see note below) - loc = the location of the matching substring - toks = a list of the matched tokens, packaged as a ParseResults object If the functions in fns modify the tokens, they can return them as the return value from fn, and the modified list of tokens will replace the original. Otherwise, fn does not need to return any value. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{parseString}} for more information on parsing strings containing s, and suggested methods to maintain a consistent view of the parsed string, the parse location, and line and column positions within the parsed string. R7(RtmapR R$R7(Rtfnstkwargs((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetParseActionscOsJ|jtttt|7_|jp@d|ko@|d|_|S(saAdd parse action to expression's list of parse actions. See L{I{setParseAction}}.R7(R$RRLR R7(RRMRN((s-/usr/lib/python2.7/site-packages/pyparsing.pytaddParseAction's$"cCs ||_|S(sDefine action to perform if parsing fails at this expression. Fail acton fn is a callable function that takes the arguments C{fn(s,loc,expr,err)} where: - s = string being parsed - loc = location where expression match was attempted and failed - expr = the parse expression that failed - err = the exception thrown The function returns no value. It may throw C{ParseFatalException} if it is desired to stop parsing immediately.(R%(Rtfn((s-/usr/lib/python2.7/site-packages/pyparsing.pyt setFailAction-s cCsmt}x`|rht}xM|jD]B}y(x!|j||\}}t}q+Wqtk r`qXqWq W|S(N(RRR.RIR(RRRt exprsFoundtetdummy((s-/usr/lib/python2.7/site-packages/pyparsing.pyt_skipIgnorables:s    cCsp|jr|j||}n|jrl|j}t|}x-||krh|||krh|d7}q?Wn|S(Ni(R.RVR)R*R(RRRtwttinstrlen((s-/usr/lib/python2.7/site-packages/pyparsing.pytpreParseGs    cCs |gfS(N((RRRRD((s-/usr/lib/python2.7/site-packages/pyparsing.pyt parseImplSscCs|S(N((RRRt tokenlist((s-/usr/lib/python2.7/site-packages/pyparsing.pyt postParseVsc Cs|j}|s|jr_|jdr?|jd|||n|rc|jrc|j||}n|}|}yUy|j|||\}}Wn/tk rt|t||j |nXWqt k r[d} |jdrt j d} |jd|||| n|jrU| dkr<t j d} n|j|||| nqXn|r|jr|j||}n|}|}|js|t|kry|j|||\}}Wqtk rt|t||j |qXn|j|||\}}|j|||}t||jd|jd|j} |jr|sj|jr|r6yrxk|jD]`} | ||| }|dk r}t||jd|jot|ttfd|j} q}q}WWqt k r2|jdr,t j d} |jd|||| nqXqxn|jD]`} | ||| }|dk r@t||jd|jot|ttfd|j} q@q@Wn|r|jdr|jd||||| qn|| fS(NiiiRR(R/R%R4R6RYRZRRRR2RRtsystexc_infoR1R\RR'R(R3R$R7RjR( RRRRDREt debuggingtpreloct tokensStartttokensterrt retTokensRQ((s-/usr/lib/python2.7/site-packages/pyparsing.pyt _parseNoCacheZsz   &      %$        #cCsNy|j||dtdSWn)tk rIt|||j|nXdS(NRDi(RIRRRR2(RRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyttryParses cCs|||||f}|tjkratj|}t|trI|n|d|djfSyA|j||||}|d|djftj|<|SWn1tk rtjd}|tj|<nXdS(Nii( Rt _exprArgCacheRjt ExceptionRReRR]R^(RRRRDREtlookupRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt _parseCaches  !  cCstjjdS(N(RRgtclear(((s-/usr/lib/python2.7/site-packages/pyparsing.pyt resetCachescCs%tjs!tt_tjt_ndS(sEnables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of both valid results and parsing exceptions. This speedup may break existing programs that use parse actions that have side-effects. For this reason, packrat parsing is disabled when you first import pyparsing. To activate the packrat feature, your program must call the class method C{ParserElement.enablePackrat()}. If your program uses C{psyco} to "compile as you go", you must call C{enablePackrat} before calling C{psyco.full()}. If you do not do this, Python will crash. For best results, call C{enablePackrat()} immediately after importing pyparsing. N(Rt_packratEnabledRRjRI(((s-/usr/lib/python2.7/site-packages/pyparsing.pyt enablePackrats  cCstj|js |jnx|jD]}|jq*W|jsV|j}nyW|j|d\}}|r|j||}t t }|j||nWn6t k rtj rqt jd}|nX|SdS(sExecute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built. If you want the grammar to require that the entire input string be successfully parsed, then set C{parseAll} to True (equivalent to ending the grammar with C{StringEnd()}). Note: C{parseString} implicitly calls C{expandtabs()} on the input string, in order to report proper column numbers in parse actions. If the input string contains tabs and the grammar uses parse actions that use the C{loc} argument to index into the string being parsed, you can ensure you have a consistent view of the input string by: - calling C{parseWithTabs} on your grammar before calling C{parseString} (see L{I{parseWithTabs}}) - define your parse action using the full C{(s,loc,toks)} signature, and reference the input string using the parse action's C{s} argument - explictly expand the tabs in your input string before calling C{parseString} iiN(RRlR0t streamlineR.R-t expandtabsRIRYRR$Rtverbose_stacktraceR]R^(RRtparseAllRTRRbtseR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt parseStrings&       ccs|js|jnx|jD]}|jq W|jsRt|j}nt|}d}|j}|j}t j d} yx||kra| |kray.|||} ||| dt \} } Wnt k r| d}qX| |krT| d7} | | | fV|rK|||} | |kr>| }qQ|d7}q^| }q| d}qWWn6t k rt jrqtjd}|nXdS(s"Scan the input string for expression matches. Each match will return the matching tokens, start location, and end location. May be called with optional C{maxMatches} argument, to clip scanning after 'n' matches are found. If C{overlap} is specified, then overlapping matches will be reported. Note that the start and end locations are reported relative to the string being parsed. See L{I{parseString}} for more information on parsing strings with embedded tabs.iREiN(R0RoR.R-RoRpRRYRIRRlRRRRqR]R^(RRt maxMatchestoverlapRTRXRt preparseFntparseFntmatchesR`tnextLocRbtnextlocR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt scanString sD                c Cs3g}d}t|_yx|j|D]}\}}}|j|||!|rt|trs||j7}qt|tr||7}q|j|n|}q(W|j||g|D]}|r|^q}djt t t |SWn6t k r.t jrq/tjd}|nXdS(sExtension to C{scanString}, to modify matching text with modified tokens that may be returned from a parse action. To use C{transformString}, define a grammar and attach a parse action to it that modifies the returned token list. Invoking C{transformString()} on a target string will then scan for matches, and replace the matched text patterns according to the logic in the parse action. C{transformString()} returns the resulting transformed string.iRiN(RR-R|RRjRRRRRLRot_flattenRRRqR]R^( RRRtlastEttRgRTtoR((s-/usr/lib/python2.7/site-packages/pyparsing.pyttransformString?s*      cCssy6tg|j||D]\}}}|^qSWn6tk rntjrUqotjd}|nXdS(sAnother extension to C{scanString}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. iN(RR|RRRqR]R^(RRRuRRgRTR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt searchStringas6  cCsat|trt|}nt|tsQtjdt|tdddSt ||gS(s*Implementation of + operator - returns Ands4Cannot combine element of type %s with ParserElementt stackleveliN( RjRRRtwarningstwarnttypet SyntaxWarningRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRps cCsYt|trt|}nt|tsQtjdt|tdddS||S(sHImplementation of + operator when left operand is not a C{ParserElement}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRzs cCsjt|trt|}nt|tsQtjdt|tdddSt |t j |gS(s<Implementation of - operator, returns C{And} with error stops4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRRRt _ErrorStop(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__sub__s cCsYt|trt|}nt|tsQtjdt|tdddS||S(sHImplementation of - operator when left operand is not a C{ParserElement}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__rsub__s csEt|tr|d}}n-t|tr7|d d }|dd kr_d|df}nt|dtr|dd kr|ddkrtS|ddkrtS|dtSqLt|dtrt|dtr|\}}||8}qLtdt|dt|dntdt||dkrgtdn|dkrtdn||kodknrtdn|rfd |r |dkr|}qt g||}qA|}n(|dkr.}nt g|}|S( sImplementation of * operator, allows use of C{expr * 3} in place of C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples may also include C{None} as in: - C{expr*(n,None)} or C{expr*(n,)} is equivalent to C{expr*n + ZeroOrMore(expr)} (read as "at least n instances of C{expr}") - C{expr*(None,n)} is equivalent to C{expr*(0,n)} (read as "0 to n instances of C{expr}") - C{expr*(None,None)} is equivalent to C{ZeroOrMore(expr)} - C{expr*(1,None)} is equivalent to C{OneOrMore(expr)} Note that C{expr*(None,n)} does not raise an exception if more than n exprs exist in the input stream; that is, C{expr*(None,n)} does not enforce a maximum number of expr occurrences. If this behavior is desired, then write C{expr*(None,n) + ~expr} iiis7cannot multiply 'ParserElement' and ('%s','%s') objectss0cannot multiply 'ParserElement' and '%s' objectss/cannot multiply ParserElement by negative values@second tuple value must be greater or equal to first tuple values+cannot multiply ParserElement by 0 or (0,0)cs2|dkr$t|dStSdS(Ni(R(tn(tmakeOptionalListR(s-/usr/lib/python2.7/site-packages/pyparsing.pyRs N(NN( RjRttupleRR.RRRt ValueErrorR(RRt minElementst optElementsR((RRs-/usr/lib/python2.7/site-packages/pyparsing.pyt__mul__sD#  &  )      cCs |j|S(N(R(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__rmul__scCsat|trt|}nt|tsQtjdt|tdddSt ||gS(s4Implementation of | operator - returns C{MatchFirst}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__or__s cCsYt|trt|}nt|tsQtjdt|tdddS||BS(sHImplementation of | operator when left operand is not a C{ParserElement}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__ror__s cCsat|trt|}nt|tsQtjdt|tdddSt ||gS(s,Implementation of ^ operator - returns C{Or}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__xor__s cCsYt|trt|}nt|tsQtjdt|tdddS||AS(sHImplementation of ^ operator when left operand is not a C{ParserElement}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__rxor__s cCsat|trt|}nt|tsQtjdt|tdddSt ||gS(s.Implementation of & operator - returns C{Each}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__and__s cCsYt|trt|}nt|tsQtjdt|tdddS||@S(sHImplementation of & operator when left operand is not a C{ParserElement}s4Cannot combine element of type %s with ParserElementRiN( RjRRRRRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__rand__s cCs t|S(s0Implementation of ~ operator - returns C{NotAny}(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt __invert__scCs |j|S(sShortcut for C{setResultsName}, with C{listAllMatches=default}:: userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno") could be written as:: userdata = Word(alphas)("name") + Word(nums+"-")("socsecno") If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be passed as C{True}. (RA(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__call__s cCs t|S(sSuppresses the output of this C{ParserElement}; useful to keep punctuation from cluttering up returned output. (R&(R((s-/usr/lib/python2.7/site-packages/pyparsing.pytsuppress*scCs t|_|S(sDisables the skipping of whitespace before matching the characters in the C{ParserElement}'s defined pattern. This is normally only used internally by the pyparsing module, but may be needed in some whitespace-sensitive grammars. (RR)(R((s-/usr/lib/python2.7/site-packages/pyparsing.pytleaveWhitespace0s cCst|_||_t|_|S(s/Overrides the default whitespace chars (RR)R*RR+(RR"((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetWhitespaceChars8s   cCs t|_|S(sOverrides default behavior to expand C{}s to spaces before parsing the input string. Must be called before C{parseString} when the input grammar contains elements that match C{} characters.(RR-(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt parseWithTabs@s cCsZt|tr:||jkrV|jj|jqVn|jjt|j|S(sDefine expression to be ignored (e.g., comments) while doing pattern matching; may be called repeatedly, to define multiple comment or other ignorable patterns. (RjR&R.RR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pytignoreGs cCs1|p t|pt|ptf|_t|_|S(sBEnable display of debugging messages while doing pattern matching.(RRRR4RR/(Rt startActiont successActiontexceptionAction((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetDebugActionsSs    cCs)|r|jtttn t|_|S(s~Enable display of debugging messages while doing pattern matching. Set C{flag} to True to enable, False to disable.(RRRRRR/(Rtflag((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetDebug[s cCs|jS(N(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRdscCs t|S(N(Ro(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRgscCst|_d|_|S(N(RR0RR&(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRojs  cCsdS(N((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pytcheckRecursionoscCs|jgdS(sXCheck defined expressions for valid structure, check for infinite recursive definitions.N(R(Rt validateTrace((s-/usr/lib/python2.7/site-packages/pyparsing.pytvalidaterscCsy|j}Wn6tk rHt|d}|j}|jnXy|j||SWn'tk rtjd}|nXdS(sExecute the parse expression on the given file or filename. If a filename is specified (instead of a file object), the entire file is opened, read, and closed before parsing. trbiN(treadRtopentcloseRtRR]R^(Rtfile_or_filenameRrt file_contentstfR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt parseFilevs   cCstdd|j|S(NRi(RR2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt getExceptionscCs7|dkr#|j|_}|Std|dS(Nt myExceptionsno such attribute (RRR(RRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cCst|tr+||kp*|j|jkSt|trsy!|jt|dttSWqtk rotSXnt t||kSdS(NRr( RjRt__dict__RRtRoRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__eq__s cCs ||k S(N((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__ne__scCstt|S(N(thashtid(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__hash__scCs ||kS(N((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__req__scCs ||k S(N((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__rne__s(DR|R}RR!RRqR#t staticmethodRRR<RARRKRORPRRRVRYRZR\ReRfRjRIRgRlRmRnRtt_MAX_INTR|RRRRRRRRRRRRRRRRRRRRRRRRRRoRRRRRRRRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs          M      .3 "  D                  cBs eZdZdZdZRS(sJAbstract C{ParserElement} subclass, for defining atomic matching patterns.cCstt|jdtdS(NR8(RR'RR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscCs,tt|j|}d|j|_|S(Ns Expected (RR'R<RR2(RRRg((s-/usr/lib/python2.7/site-packages/pyparsing.pyR<s(R|R}RRR<(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR's cBseZdZdZRS(s"An empty token, will always match.cCs2tt|jd|_t|_t|_dS(NR(RRRRRR,RR1(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs  (R|R}RR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscBs#eZdZdZedZRS(sA token that will never match.cCs;tt|jd|_t|_t|_d|_dS(NRsUnmatchable token( RRRRRR,RR1R2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs    cCs%|j}||_||_|dS(N(RRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs   (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cBs#eZdZdZedZRS(s*Token to exactly match a specified string.cCstt|j||_t||_y|d|_Wn0tk rntj dt ddt |_ nXdt |j|_d|j|_t|_t|_dS(Nis2null string passed to Literal; use Empty() insteadRis"%s"s Expected (RRRtmatchRtmatchLentfirstMatchCharRRRRRt __class__RoRR2RR,R1(Rt matchString((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs      cCsp|||jkrK|jdks7|j|j|rK||j|jfS|j}||_||_|dS(Ni(RRt startswithRRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs$   (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cBsQeZdZedZeedZedZdZ dZ e e Z RS(sToken to exactly match a specified string as a keyword, that is, it must be immediately followed by a non-keyword character. Compare with C{Literal}:: Literal("if") will match the leading C{'if'} in C{'ifAndOnlyIf'}. Keyword("if") will not; it will only match the leading C{'if'} in C{'if x=1'}, or C{'if(y==2)'} Accepts two optional constructor arguments in addition to the keyword string: C{identChars} is a string of characters that would be valid identifier characters, defaulting to all alphanumerics + "_" and "$"; C{caseless} allows case-insensitive matching, default is C{False}. s_$cCstt|j||_t||_y|d|_Wn'tk retj dt ddnXd|j|_ d|j |_ t |_t |_||_|r|j|_|j}nt||_dS(Nis2null string passed to Keyword; use Empty() insteadRis"%s"s Expected (RR RRRRRRRRRRR2RR,R1tcaselesstuppert caselessmatchtsett identChars(RRRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs"      c Csk|jr||||j!j|jkrF|t||jkse|||jj|jkrF|dks||dj|jkrF||j|jfSn|||jkrF|jdks|j|j|rF|t||jks|||j|jkrF|dks2||d|jkrF||j|jfS|j }||_ ||_ |dS(Nii( RRRRRRRRRRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs #9)$3#   cCs%tt|j}tj|_|S(N(RR RtDEFAULT_KEYWORD_CHARSR(RRh((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCs |t_dS(s,Overrides the default Keyword chars N(R R(R"((s-/usr/lib/python2.7/site-packages/pyparsing.pytsetDefaultKeywordChars%s( R|R}RR/RRRRRZRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s     cBs#eZdZdZedZRS(sToken to match a specified string, ignoring case of letters. Note: the matched results will always be in the case of the given match string, NOT the case of the input text. cCsItt|j|j||_d|j|_d|j|_dS(Ns'%s's Expected (RRRRt returnStringRR2(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR0s cCs\||||j!j|jkr7||j|jfS|j}||_||_|dS(N(RRRRRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ7s #   (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR+s cBs#eZejdZedZRS(cCs#tt|j||dtdS(NR(RRRR(RRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRAscCs||||j!j|jkrp|t||jks\|||jj|jkrp||j|jfS|j}||_||_|dS(N( RRRRRRRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZDs#9   (R|R}R RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR@scBs>eZdZddddeddZedZdZRS(sToken for matching words composed of allowed character sets. Defined with string containing all allowed initial characters, an optional string containing allowed body characters (if omitted, defaults to the initial character set), and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. An optional C{exclude} parameter can list characters that might be found in the input C{bodyChars} string; useful to define a word of all printables except for one or two characters, for instance. iic Cstt|j|rdjg|D]}||kr&|^q&}|rdjg|D]}||krZ|^qZ}qn||_t||_|r||_t||_n||_t||_|dk|_ |dkrt dn||_ |dkr||_ n t |_ |dkrG||_ ||_ nt||_d|j|_t|_||_d|j|jkr|dkr|dkr|dkr|j|jkrdt|j|_net|jdkrdtj|jt|jf|_n%d t|jt|jf|_|jrbd |jd |_nytj|j|_Wqd|_qXndS( NRiisZcannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permitteds Expected t s[%s]+s%s[%s]*s [%s][%s]*s\b(RR+RRt initCharsOrigRt initCharst bodyCharsOrigt bodyCharst maxSpecifiedRtminLentmaxLenRRoRR2RR1t asKeywordt_escapeRegexRangeCharstreStringRR5tescapetcompileR( RRRtmintmaxtexactRt excludeCharsRh((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZsT.4             :  c Cs|jrd|jj||}|sH|j}||_||_|n|j}||jfS|||jkr|j}||_||_|n|}|d7}t|}|j }||j } t | |} x*|| kr|||kr|d7}qWt } |||j kr+t} n|jrY||krY|||krYt} n|jr|dkr||d|ks||kr|||krt} qn| r|j}||_||_|n||||!fS(Nii(R5RRRRtendtgroupRRRRRRRRRR( RRRRDtresultRtstartRXt bodycharstmaxloctthrowException((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZsH               %  <     cCsytt|jSWnnX|jdkrd}|j|jkrsd||j||jf|_qd||j|_n|jS(NcSs&t|dkr|d dS|SdS(Nis...(R(Rg((s-/usr/lib/python2.7/site-packages/pyparsing.pyt charsAsStrs s W:(%s,%s)sW:(%s)(RR+RR&RRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs (N( R|R}RRRRRRZR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR+Ns 6 -cBsDeZdZeejdZddZedZ dZ RS(sToken for matching strings that match a given regular expression. Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. s[A-Z]icCs?tt|jt|trt|dkrMtjdtddn||_ ||_ y+t j |j |j |_ |j |_ Wq tjk rtjd|tddq XnIt|tjr||_ t||_ |_ ||_ n tdt||_d|j|_t|_t|_dS( sThe parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.is0null string passed to Regex; use Empty() insteadRis$invalid pattern (%s) passed to RegexsCRegex may only be constructed with a string or a compiled RE objects Expected N(RR"RRjRRRRRtpatterntflagsR5RRt sre_constantsterrortcompiledREtypeRlRRoRR2RR1RR,(RRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs.          c Cs|jj||}|s?|j}||_||_|n|j}|j}t|j}|rx|D]}|||||jd d jgtt|j d dd D]3}d tj|j | t|j |f^qd7_n|rc|jdtj|7_n|r|jdtj|7_djt|j d|j djddjdd}tj|jd||_n|jdtj|j 7_y+tj|j|j|_|j|_Wn4t j!k rdtjd|jtddnXt"||_#d|j#|_$t%|_&t'|_(dS(s Defined with the following parameters: - quoteChar - string of one or more characters defining the quote delimiting string - escChar - character to escape quotes, typically backslash (default=None) - escQuote - special quote sequence to escape an embedded quote string (such as SQL's "" to escape an embedded ") (default=None) - multiline - boolean indicating whether quotes can span multiple lines (default=False) - unquoteResults - boolean indicating whether the matched text should be unquoted (default=True) - endQuoteChar - string of one or more characters defining the end of the quote delimited string (default=None => same as quoteChar) is$quoteChar cannot be the empty stringRis'endQuoteChar cannot be the empty strings %s(?:[^%s%s]Rs%s(?:[^%s\n\r%s]is|(?:s)|(?:is%s[^%s]t)s|(?:%s)s|(?:%s.)t^s\^t-s\-s([%s])s)*%ss$invalid pattern (%s) passed to Regexs Expected N()RR RRRRRRt SyntaxErrorRt quoteChart quoteCharLentfirstQuoteChart endQuoteChartendQuoteCharLentescChartescQuotetunquoteResultsR5t MULTILINEtDOTALLRRRRRRRRttescCharReplacePatternRRRRRoRR2RR1RR,( RRRRt multilineRRRtcharset((s-/usr/lib/python2.7/site-packages/pyparsing.pyRsf             ( %o?   cCs|||jkr(|jj||p+d}|sX|j}||_||_|n|j}|j}|j r||j |j !}t |t r|jrtj|jd|}n|jr|j|j|j}qqn||fS(Ns\g<1>(RR5RRRRRRRRRRRjRRRRRRtR(RRRRDRRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZds .         !cCsSytt|jSWnnX|jdkrLd|j|jf|_n|jS(Ns.quoted string, starting with %s ending with %s(RR RR&RRR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRsN( R|R}RRRRRRZR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR sJ cBs5eZdZddddZedZdZRS(sToken for matching words composed of characters *not* in a given set. Defined with string containing all disallowed characters, and an optional minimum, maximum, and/or exact length. The default value for C{min} is 1 (a minimum value < 1 is not valid); the default values for C{max} and C{exact} are 0, meaning no maximum or exact length restriction. iicCstt|jt|_||_|dkr@tdn||_|dkra||_n t |_|dkr||_||_nt ||_ d|j |_ |jdk|_ t|_dS(Nisfcannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permittedis Expected (RRRRR)tnotCharsRRRRRoRR2R,R1(RRRRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs           cCs|||jkr7|j}||_||_|n|}|d7}|j}t||jt|}x*||kr|||kr|d7}qoW|||jkr|j}||_||_|n||||!fS(Ni(RRRRRRRR(RRRRDRRtnotcharstmaxlen((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs$          cCsvytt|jSWnnX|jdkrot|jdkr\d|jd |_qod|j|_n|jS(Nis !W:(%s...)s!W:(%s)(RRRR&RRR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs(R|R}RRRRZR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cBsXeZdZidd6dd6dd6dd6d d 6Zd d d d dZedZRS(sSpecial matching class for matching whitespace. Normally, whitespace is ignored by pyparsing grammars. This class is included when some whitespace structures are significant. Define with a string containing the whitespace characters to be matched; default is C{" \t\r\n"}. Also takes optional C{min}, C{max}, and C{exact} arguments, as defined for the C{Word} class.sRss ss ss ss s iicCstt|j||_|jdjg|jD]}||jkr2|^q2djg|jD]}tj|^qg|_t |_ d|j|_ ||_ |dkr||_ n t|_ |dkr||_ ||_ ndS(NRs Expected i(RR*Rt matchWhiteRRR*t whiteStrsRRR,R2RRR(RtwsRRRRh((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs ;/       cCs|||jkr7|j}||_||_|n|}|d7}||j}t|t|}x-||kr|||jkr|d7}qlW|||jkr|j}||_||_|n||||!fS(Ni(RRRRRRRR(RRRRDRRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs"      "    (R|R}RRRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR*s t_PositionTokencBseZdZRS(cCs8tt|j|jj|_t|_t|_ dS(N( RRRRR|RRR,RR1(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s (R|R}R(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scBs,eZdZdZdZedZRS(sXToken to advance to a specific column of input text; useful for tabular report scraping.cCs tt|j||_dS(N(RR RR5(Rtcolno((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscCst|||jkrt|}|jrB|j||}nxE||kr||jrt|||jkr|d7}qEWn|S(Ni(R5RR.RVtisspace(RRRRX((s-/usr/lib/python2.7/site-packages/pyparsing.pyRYs  7cCs^t||}||jkr6t||d|n||j|}|||!}||fS(NsText not in expected column(R5R(RRRRDtthiscoltnewlocR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ s  (R|R}RRRYRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  cBs,eZdZdZdZedZRS(sQMatches if current position is at the beginning of a line within the parse stringcCs<tt|j|jtjjddd|_dS(Ns RsExpected start of line(RRRRRR!RtR2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR*scCs<tt|j||}||dkr8|d7}n|S(Ns i(RRRY(RRRR`((s-/usr/lib/python2.7/site-packages/pyparsing.pyRY/s cCsf|dkp5||j|dkp5||ddks\|j}||_||_|n|gfS(Niis (RYRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ5s     (R|R}RRRYRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR(s  cBs#eZdZdZedZRS(sKMatches if current position is at the end of a line within the parse stringcCs<tt|j|jtjjddd|_dS(Ns RsExpected end of line(RRRRRR!RtR2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRBscCs|t|krT||dkr0|ddfS|j}||_||_|nA|t|krt|dgfS|j}||_||_|dS(Ns i(RRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZGs       (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR@s cBs#eZdZdZedZRS(sCMatches if current position is at the beginning of the parse stringcCs tt|jd|_dS(NsExpected start of text(RR%RR2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR[scCsU|dkrK||j|dkrK|j}||_||_|qKn|gfS(Ni(RYRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ_s     (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR%Ys cBs#eZdZdZedZRS(s=Matches if current position is at the end of the parse stringcCs tt|jd|_dS(NsExpected end of text(RR$RR2(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRlscCs|t|kr6|j}||_||_|n]|t|krV|dgfS|t|krr|gfS|j}||_||_|dS(Ni(RRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZps        (R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR$js cBs&eZdZedZedZRS(swMatches if the current position is at the beginning of a Word, and is not preceded by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordStart(alphanums)}. C{WordStart} will also match at the beginning of the string being parsed, or at the beginning of a line. cCs/tt|jt||_d|_dS(NsNot at the start of a word(RR-RRt wordCharsR2(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscCsg|dkr]||d|jks6|||jkr]|j}||_||_|q]n|gfS(Nii(RRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs     (R|R}RRTRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR-s cBs&eZdZedZedZRS(saMatches if the current position is at the end of a Word, and is not followed by any character in a given set of C{wordChars} (default=C{printables}). To emulate the C{} behavior of regular expressions, use C{WordEnd(alphanums)}. C{WordEnd} will also match at the end of the string being parsed, or at the end of a line. cCs8tt|jt||_t|_d|_dS(NsNot at the end of a word(RR,RRRRR)R2(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cCst|}|dkru||kru|||jksN||d|jkru|j}||_||_|qun|gfS(Nii(RRRRR(RRRRDRXR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZs     (R|R}RRTRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR,s cBsqeZdZedZdZdZdZdZdZ dZ edZ gd Z d Z RS( sTAbstract subclass of ParserElement, for combining and post-processing parsed tokens.cCstt|j|t|tr1||_nWt|trUt|g|_n3yt||_Wntk r|g|_nXt |_ dS(N( RRRRjRtexprsRRRRR6(RRR8((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs  cCs |j|S(N(R(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscCs|jj|d|_|S(N(RRRR&(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs cCsPt|_g|jD]}|j^q|_x|jD]}|jq8W|S(s~Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on all contained expressions.(RR)RRR(RRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs  %cCst|trb||jkrtt|j|x(|jD]}|j|jdq>Wqn>tt|j|x%|jD]}|j|jdqW|S(Ni(RjR&R.RRRR(RRRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyRscCs\ytt|jSWnnX|jdkrUd|jjt|jf|_n|jS(Ns%s:(%s)( RRRR&RRR|RoR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs%c Csdtt|jx|jD]}|jqWt|jdkr`|jd}t||jr|j r|jdkr|j r|j|jdg|_d|_ |j |j O_ |j |j O_ n|jd}t||jr`|j r`|jdkr`|j r`|jd |j|_d|_ |j |j O_ |j |j O_ q`n|S(Niiii(RRRoRRRjRR$R'RR/R&R,R1(RRTR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRos.        cCstt|j||}|S(N(RRRA(RRR?R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRA scCs@||g}x|jD]}|j|qW|jgdS(N(RRR(RRttmpRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCs>tt|j}g|jD]}|j^q|_|S(N(RRRR(RRRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s%(R|R}RRRRRRRRRoRARR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyRs    cBsWeZdZdefdYZedZedZdZdZ dZ RS(sRequires all given C{ParseExpression}s to be found in the given order. Expressions may be separated by whitespace. May be constructed using the C{'+'} operator. RcBseZdZRS(cOs'tt|j|||jdS(N(RRRR(RRRN((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s(R|R}R(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCs}tt|j||t|_x'|jD]}|js,t|_Pq,q,W|j|dj|dj |_ t|_ dS(Ni( RRRRR,RRRR*R)R6(RRR8RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR! s   c CsG|jdj|||dt\}}t}x |jdD]}t|tjr`t}q<n|ry|j|||\}}Wqtk rqtk rt j d}t|qt k rtt |t ||j|qXn|j|||\}}|s,|jr<||7}q<q<W||fS(NiREi(RRIRRjRRRRRR]R^RRRR2R( RRRRDt resultlistt errorStopRTt exprtokensR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ, s((   +cCs+t|trt|}n|j|S(N(RjRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRE scCs@||g}x+|jD] }|j||jsPqqWdS(N(RRR,(RRtsubRecCheckListRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyRJ s   cCset|dr|jS|jdkr^ddjg|jD]}t|^q8d|_n|jS(NRt{Rt}(R;RR&RRRRo(RRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyRQ s 9( R|R}RRRRRRZRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s   cBsAeZdZedZedZdZdZdZ RS(sRequires that at least one C{ParseExpression} is found. If two expressions match, the expression that matches the longest string will be used. May be constructed using the C{'^'} operator. cCsPtt|j||t|_x'|jD]}|jr,t|_Pq,q,WdS(N(RRRRR,RR(RRR8RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR` s    c Cs7d}d}d}x|jD]}y|j||}Wntk r|tjd} | j|kr| }| j}qqtk rt||krt|t||j |}t|}qqX||kr|}|} qqW|dkr$|dk r |q$t||d|n| j |||S(Niiis no defined alternatives to match( RRRfRR]R^RRRR2RI( RRRRDt maxExcLoct maxMatchLoct maxExceptionRTtloc2Rct maxMatchExp((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZh s.       cCs+t|trt|}n|j|S(N(RjRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__ixor__ scCset|dr|jS|jdkr^ddjg|jD]}t|^q8d|_n|jS(NRRs ^ R(R;RR&RRRRo(RRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s 9cCs3||g}x|jD]}|j|qWdS(N(RR(RRR RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s( R|R}RRRRRZRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR[ s     cBsAeZdZedZedZdZdZdZ RS(sRequires that at least one C{ParseExpression} is found. If two expressions match, the first one listed is the one that will match. May be constructed using the C{'|'} operator. cCsbtt|j|||rUt|_x3|jD]}|jr2t|_Pq2q2Wn t|_dS(N(RRRRR,RR(RRR8RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s    c Csd}d}x|jD]}y|j|||}|SWqtk ro}|j|kr|}|j}qqtk rt||krt|t||j|}t|}qqXqW|dk r|nt||d|dS(Nis no defined alternatives to match(RRRIRRRRR2( RRRRDRRRTRRc((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ s"   cCs+t|trt|}n|j|S(N(RjRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt__ior__ scCset|dr|jS|jdkr^ddjg|jD]}t|^q8d|_n|jS(NRRs | R(R;RR&RRRRo(RRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s 9cCs3||g}x|jD]}|j|qWdS(N(RR(RRR RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s( R|R}RRRRRZRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s    cBs8eZdZedZedZdZdZRS(sRequires all given C{ParseExpression}s to be found, but in any order. Expressions may be separated by whitespace. May be constructed using the C{'&'} operator. cCsbtt|j||t|_x'|jD]}|js,t|_Pq,q,Wt|_t|_dS(N( RRRRR,RRR)tinitExprGroups(RRR8RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s    cCs|jr,g|jD]}t|tr|j^q}g|jD]!}|jrA||krA|^qA}|||_g|jD]}t|tr|j^q|_g|jD]}t|t r|j^q|_ g|jD]$}t|ttt fs|^q|_ |j |j 7_ t |_n|}|j }|j} g} t } x| r*|| |j|j } g} x| D]}y|j||}Wntk r| j|qX| j|||kr|j|q|| kr| j|qqWt| t| krUt } qUqUW|rrdjg|D]}t|^q>}t||d|n| g|jD]*}t|tr|j| kr|^q7} g}x6| D].}|j|||\}}|j|qWtg}x|D]}i}xW|jD]I}||jkrt||}|t||7}|||   cCset|dr|jS|jdkr^ddjg|jD]}t|^q8d|_n|jS(NRRs & R(R;RR&RRRRo(RRT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s 9cCs3||g}x|jD]}|j|qWdS(N(RR(RRR RT((s-/usr/lib/python2.7/site-packages/pyparsing.pyR& s(R|R}RRRRZRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  : cBs_eZdZedZedZdZdZdZ dZ gdZ dZ RS( sWAbstract subclass of C{ParserElement}, for combining and post-processing parsed tokens.cCstt|j|t|tr4t|}n||_d|_|dk r|j |_ |j |_ |j |j |j |_ |j|_|j|_|jj|jndS(N(RRRRjRRRRR&R1R,RR*R)R(R6R.textend(RRR8((s-/usr/lib/python2.7/site-packages/pyparsing.pyR. s        cCsG|jdk r+|jj|||dtStd||j|dS(NRER(RRRIRRR2(RRRRD((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ= scCs>t|_|jj|_|jdk r:|jjn|S(N(RR)RRRR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRC s  cCst|trc||jkrtt|j||jdk r`|jj|jdq`qn?tt|j||jdk r|jj|jdn|S(Ni(RjR&R.RRRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRJ s cCs6tt|j|jdk r2|jjn|S(N(RRRoRR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRoV scCsV||kr"t||gn||g}|jdk rR|jj|ndS(N(R!RRR(RRR ((s-/usr/lib/python2.7/site-packages/pyparsing.pyR\ s  cCsA||g}|jdk r0|jj|n|jgdS(N(RRRR(RRR ((s-/usr/lib/python2.7/site-packages/pyparsing.pyRc scCskytt|jSWnnX|jdkrd|jdk rdd|jjt|jf|_n|jS(Ns%s:(%s)( RRRR&RRRR|Ro(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi s%( R|R}RRRRRZRRRoRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR, s      cBs#eZdZdZedZRS(sLookahead matching of the given parse expression. C{FollowedBy} does *not* advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list.cCs#tt|j|t|_dS(N(RR RRR,(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRy scCs|jj|||gfS(N(RRf(RRRRD((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ} s(R|R}RRRRZ(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR t s cBs,eZdZdZedZdZRS(sLookahead to disallow matching with the given parse expression. C{NotAny} does *not* advance the parsing position within the input string, it only verifies that the specified parse expression does *not* match at the current position. Also, C{NotAny} does *not* skip over leading whitespace. C{NotAny} always returns a null token list. May be constructed using the '~' operator.cCsBtt|j|t|_t|_dt|j|_ dS(NsFound unwanted token, ( RRRRR)RR,RoRR2(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  cCs\y|jj||Wnttfk r0n"X|j}||_||_||gfS(N(RRfRRRRR(RRRRDR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ s   cCsIt|dr|jS|jdkrBdt|jd|_n|jS(NRs~{R(R;RR&RRoR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s (R|R}RRRRZR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  cBs8eZdZdZedZdZedZRS(s<Optional repetition of zero or more of the given expression.cCs#tt|j|t|_dS(N(RR.RRR,(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCsg}y|jj|||dt\}}t|jdk}xa|r`|j||}n|}|jj|||\}}|s|jrE||7}qEqEWnttfk rnX||fS(NREi( RRIRRR.RVRRR(RRRRDRbthasIgnoreExprsR`t tmptokens((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ s$cCsIt|dr|jS|jdkrBdt|jd|_n|jS(NRRs]...(R;RR&RRoR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCs(tt|j||}t|_|S(N(RR.RARR((RRR?R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRA s ( R|R}RRRRZRRRA(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR. s    cBs/eZdZedZdZedZRS(s2Repetition of one or more of the given expression.cCs|jj|||dt\}}y}t|jdk}xa|rZ|j||}n|}|jj|||\}}|s|jr?||7}q?q?Wnttfk rnX||fS(NREi( RRIRRR.RVRRR(RRRRDRbR,R`R-((s-/usr/lib/python2.7/site-packages/pyparsing.pyRZ s$cCsIt|dr|jS|jdkrBdt|jd|_n|jS(NRRs}...(R;RR&RRoR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCs(tt|j||}t|_|S(N(RRRARR((RRR?R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRA s (R|R}RRRZRRRA(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  t _NullTokencBs eZdZeZdZRS(cCstS(N(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCsdS(NR((R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s(R|R}RR R(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR. s cBs/eZdZedZedZdZRS(sOptional matching of the given expression. A default return string can also be specified, if the optional expression is not found. cCs2tt|j|dt||_t|_dS(NR8(RRRRRRR,(RRtdefault((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCsy(|jj|||dt\}}Wnottfk r|jtk r|jjrt|jg}|j||jj|SdS(N(RRRR R(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  N( R|R}RRRR:RRoRRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR Z s       R<cBseZdZRS(cCsdS(Ns...((R((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s(R|R}R(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR< scBseZdZedZRS(sGAbstract subclass of C{ParseExpression}, for converting parsed results.cCs#tt|j|t|_dS(N(RR(RRR((RRR8((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s(R|R}RRR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR( scBs eZdZdZdZRS(s,Converter to upper case all matching tokens.cGs0tt|j|tjdtdddS(NsAUpcase class is deprecated, use upcaseTokens parse action insteadRi(RR)RRRtDeprecationWarning(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCstttj|S(N(RRLtstringR(RRRR[((s-/usr/lib/python2.7/site-packages/pyparsing.pyR\ s(R|R}RRR\(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR) s cBs/eZdZdedZdZdZRS(sConverter to concatenate all matching tokens to a single string. By default, the matching patterns must also be contiguous in the input string; this can be disabled by specifying C{'adjacent=False'} in the constructor. RcCsQtt|j||r)|jn||_t|_||_t|_dS(N( RRRRtadjacentRR)t joinStringR6(RRRAR@((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s    cCs6|jrtj||ntt|j||S(N(R@RRRR(RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cCsq|j}|2|tdj|j|jgd|j7}|jrit|jdkri|gS|SdS(NRRi( RRRRRAR3R'RR(RRRR[tretToks((s-/usr/lib/python2.7/site-packages/pyparsing.pyR\ s  1!(R|R}RRRRR\(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cBs eZdZdZdZRS(s}Converter to return the matched tokens as a list - useful for returning tokens of C{ZeroOrMore} and C{OneOrMore} expressions.cCs#tt|j|t|_dS(N(RR RRR((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCs|gS(N((RRRR[((s-/usr/lib/python2.7/site-packages/pyparsing.pyR\ s(R|R}RRR\(((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s cBs eZdZdZdZRS(sConverter to return a repetitive expression as a list, but also as a dictionary. Each element can also be referenced using the first token in the expression as its key. Useful for tabular report scraping when the first column can be used as a item key. cCs#tt|j|t|_dS(N(RRRRR((RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR scCsTx9t|D]+\}}t|dkr1q n|d}t|trct|dj}nt|dkrtd|||nX|S(s&Decorator for debugging parse actions.csj}|d\}}}t|dkrI|djjd|}ntjjd|t||||fy|}Wn>tk rtj d}tjjd||fnXtjjd||f|S( Niiit.s">>entering %s(line: '%s', %d, %s) is<gS(Ni(R RR?(RgRIRR(t arrayExprR(s-/usr/lib/python2.7/site-packages/pyparsing.pytcountFieldParseActionI s -cSst|dS(Ni(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRiN starrayLenR7N( R RR+RPRORR<RPR(RtintExprRW((RVRs-/usr/lib/python2.7/site-packages/pyparsing.pyR8A s    cCsMg}x@|D]8}t|tr8|jt|q |j|q W|S(N(RjRR+R}R(tLRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR}U s  cs/tfd}|j|dtS(s?Helper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousLiteral(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches a previous literal, will also match the leading C{"1:1"} in C{"1:10"}. If this is not desired, use C{matchPreviousExpr}. Do *not* use with packrat parsing enabled. csr|rct|dkr'|d>qnt|j}tg|D]}t|^qF>n t>dS(Nii(RR}RRRR(RgRIRttflatttt(trep(s-/usr/lib/python2.7/site-packages/pyparsing.pytcopyTokenToRepeaterk s *R7(R RPR(RR^((R]s-/usr/lib/python2.7/site-packages/pyparsing.pyRM^ s  csCt|j}|>fd}|j|dtS(sjHelper to define an expression that is indirectly defined from the tokens matched in a previous expression, that is, it looks for a 'repeat' of a previous expression. For example:: first = Word(nums) second = matchPreviousExpr(first) matchExpr = first + ":" + second will match C{"1:1"}, but not C{"1:2"}. Because this matches by expressions, will *not* match the leading C{"1:1"} in C{"1:10"}; the expressions are evaluated first, and then compared, so C{"1"} is compared with C{"10"}. Do *not* use with packrat parsing enabled. cs8t|jfd}j|dtdS(Ncs7t|j}|kr3tdddndS(NRi(R}RR(RgRIRt theseTokens(t matchTokens(s-/usr/lib/python2.7/site-packages/pyparsing.pytmustMatchTheseTokens s R7(R}RROR(RgRIRRa(R](R`s-/usr/lib/python2.7/site-packages/pyparsing.pyR^ sR7(R RRPR(Rte2R^((R]s-/usr/lib/python2.7/site-packages/pyparsing.pyRLx s  cCsUx$dD]}|j|t|}qW|jdd}|jdd}t|S(Ns\^-]s s\ns s\t(Rtt_bslashRo(RgRh((s-/usr/lib/python2.7/site-packages/pyparsing.pyR s  c Cs|r!d}d}t}nd}d}t}t|ttfr^t|}n4t|tr||j}ntjdt ddd}x|t |d krG||}xt ||d D]f\} } || |r||| d =Pq||| r||| d =|j || | }PqqW|d 7}qW| r|ryt |t d j |krtd d j g|D]} t| ^qStd j g|D]} tj| ^qSWqtjd t ddqXntg|D]} || ^qS(soHelper to quickly define a set of alternative Literals, and makes sure to do longest-first testing when there is a conflict, regardless of the input order, but returns a C{MatchFirst} for best performance. Parameters: - strs - a string of space-delimited literals, or a list of string literals - caseless - (default=False) - treat all literals as caseless - useRegex - (default=True) - as an optimization, will generate a Regex object; otherwise, will generate a C{MatchFirst} object (if C{caseless=True}, or if creating a C{Regex} raises an exception) cSs|j|jkS(N(R(Rtb((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scSs|jj|jS(N(RR(RRd((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scSs ||kS(N((RRd((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scSs |j|S(N(R(RRd((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi ss2Invalid argument to oneOf, expected string or listRiiiRs[%s]t|s7Exception creating Regex for oneOf, building MatchFirst(RRRjRRRRrRRRRRRRR"RR5RR( tstrsRtuseRegextisequaltmaskstparseElementClasstsymbolsRtcurRRtsym((s-/usr/lib/python2.7/site-packages/pyparsing.pyRQ sF         ! !03 cCsttt||S(sHelper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{Dict}, C{ZeroOrMore}, and C{Group} tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, thereby leaving the significant key text. The value pattern can include named results, so that the C{Dict} results can include named token fields. (RR.R (RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR= scCsptjd}|j}t|_|d||d}|rVd}n d}|j||S(sHelper to return the original, untokenized text for a given expression. Useful to restore the parsed fields of an HTML start tag into the raw tag text itself, or to revert separate tokens with intervening whitespace back to the original matching input text. Simpler to use than the parse action C{L{keepOriginalText}}, and does not require the inspect module to chase up the call stack. By default, returns a string containing the original parsed text. If the optional C{asString} argument is passed as C{False}, then the return value is a C{ParseResults} containing any results names that were originally matched, and a single token containing the original matched text from the input string. So if the expression passed to C{L{originalTextFor}} contains expressions with defined results names, you must set C{asString} to C{False} if you want to preserve those results name values.cSs|S(N((RgRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi st_original_startt _original_endcSs||j|j!S(N(RnRo(RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scSs3|2|jd||j|j!|d=|d=dS(NiRnRo(RRnRo(RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyt extractText s(RRORRR6(RtasStringt locMarkert endlocMarkert matchExprRp((s-/usr/lib/python2.7/site-packages/pyparsing.pyRe s     cCst|jdS(siHelper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty.cSs|dS(Ni((R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi s(R(RO(R((s-/usr/lib/python2.7/site-packages/pyparsing.pytungroup ss\[]-*.$+^?()~ RcCs |ddS(Nii((RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi ss\]s\\0?[xX][0-9a-fA-F]+cCstt|dddS(Niii(tunichrR(RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi ss \\0[0-7]+cCstt|dddS(Niii(RvR(RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi siRRRtnegatetbodyRcCs\t|trXdjgtt|dt|ddD]}t|^q=p[|S(NRii(RjRRRtordRv(tpRh((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scCsEy6djgtj|jD]}t|^qSWndSXdS(sHelper to easily define string ranges for use in Word construction. Borrows syntax from regexp '[]' string range definitions:: srange("[0-9]") -> "0123456789" srange("[a-z]") -> "abcdefghijklmnopqrstuvwxyz" srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_" The input string must be enclosed in []'s, and the returned string is the expanded character set joined into a single string. The values enclosed in the []'s may be:: a single character an escaped character with a leading backslash (such as \- or \]) an escaped hex character with a leading '\x' (\x21, which is a '!' character) (\0x## is also supported for backwards compatibility) an escaped octal character with a leading '\0' (\041, which is a '!' character) a range of any of the above, separated by a dash ('a-z', etc.) any combination of the above ('aeiouy', 'a-zA-Z0-9_$', etc.) RN(Rt_reBracketExprRtRxt _expanded(Rgtpart((s-/usr/lib/python2.7/site-packages/pyparsing.pyR] s6csfd}|S(srHelper method for defining parse actions that require matching at a specific column in the input text. cs2t||kr.t||dndS(Nsmatched token not at column %d(R5R(R tlocnR(R(s-/usr/lib/python2.7/site-packages/pyparsing.pyt verifyCol, s((RR((Rs-/usr/lib/python2.7/site-packages/pyparsing.pyRK( scsfd}|S(sHelper method for common parse actions that simply return a literal value. Especially useful when used with C{transformString()}. csgS(N((R(treplStr(s-/usr/lib/python2.7/site-packages/pyparsing.pyt _replFunc5 s((RR((Rs-/usr/lib/python2.7/site-packages/pyparsing.pyRZ1 scCs|ddd!S(sHelper parse action for removing quotation marks from parsed quoted strings. To use, add this parse action to quoted string using:: quotedString.setParseAction( removeQuotes ) iii((RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRX9 scCs&gtt|D]}|j^qS(s4Helper parse action to convert tokens to upper case.(RLRoR(RgRIRR\((s-/usr/lib/python2.7/site-packages/pyparsing.pyRb@ scCs&gtt|D]}|j^qS(s4Helper parse action to convert tokens to lower case.(RLRotlower(RgRIRR\((s-/usr/lib/python2.7/site-packages/pyparsing.pyR>D scCsLy t}Wntk r,tdnX|2|t|||!7}|S(sDEPRECATED - use new helper method C{originalTextFor}. Helper parse action to preserve original parsed text, overriding any nested parse actions.sJincorrect usage of keepOriginalText - may only be called as a parse action(R@RRR(RgR5RR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRDH s  cCsmddl}|j}zJxC|dD]+}|ddkr&|djd}|Sq&WtdWd~XdS( siMethod to be called from within a parse action to determine the end location of the parsed tokens.iNiiReiRsRincorrect usage of getTokensEndLoc - may only be called from within a parse action(tinspecttstacktf_localsR(RtfstackRR((s-/usr/lib/python2.7/site-packages/pyparsing.pyR@T s  c CsQt|tr+|}t|d| }n |j}tttd}|rtjj t }t d|dt t t|t d|tddtgjdj d t d }nd jgtD]}|d kr|^q}tjj t t|B}t d|dt t t|j ttt d|tddtgjdj d t d }ttd |d }|jdd j|jddjjjd|}|jdd j|jddjjjd|}||_||_||fS(sRInternal helper to construct opening and closing tag expressions, given a tag nameRs_-:Rttagt=t/R/R?cSs|ddkS(NiR((RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRiq sRRcSs|ddkS(NiR((RgRIR((s-/usr/lib/python2.7/site-packages/pyparsing.pyRix ssRs(RjRR RR+R0R/R:RRORXR&RR.R RRRARRTRWR>Rt_LRtttitleRrR<R( ttagStrtxmltresnamet tagAttrNamet tagAttrValuetopenTagRhtprintablesLessRAbracktcloseTag((s-/usr/lib/python2.7/site-packages/pyparsing.pyt _makeTagsd s" o.{AA  cCs t|tS(sRHelper to construct opening and closing tag expressions for HTML, given a tag name(RR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRI scCs t|tS(sQHelper to construct opening and closing tag expressions for XML, given a tag name(RR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRJ scsT|r|n |jgD]\}}||f^q#fd}|S(s Helper to create a validating parse action to be used with start tags created with C{makeXMLTags} or C{makeHTMLTags}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{} or C{
}. Call C{withAttribute} with a series of attribute names and values. Specify the list of filter attributes names and values as: - keyword arguments, as in C{(align="right")}, or - as an explicit dict with C{**} operator, when an attribute name is also a Python reserved word, as in C{**{"class":"Customer", "align":"right"}} - a list of name-value tuples, as in ( ("ns1:class", "Customer"), ("ns2:align","right") ) For attribute names with a namespace prefix, you must use the second form. Attribute names are matched insensitive to upper/lower case. To verify that the attribute exists, but without specifying a value, pass C{withAttribute.ANY_VALUE} as the value. c sx~D]v\}}||kr8t||d|n|tjkr|||krt||d||||fqqWdS(Nsno matching attribute s+attribute '%s' has value '%s', must be '%s'(RRct ANY_VALUE(RgRIRbtattrNamet attrValue(tattrs(s-/usr/lib/python2.7/site-packages/pyparsing.pytpa s   (R(RtattrDictRRR((Rs-/usr/lib/python2.7/site-packages/pyparsing.pyRc s   %cCst}|td|tdB}xt|D]\}}|d d \}}}} |dkr|d kst|dkrtdn|\} } nt} |tjkr|dkrt||t |t |} q|dkr[|d k r4t|||t |t ||} qt||t |t |} q|dkrt|| || |t || || |} qtdn+|tj kr|dkr t |t st |}nt|j| t || } q|dkrz|d k rSt||| t |t || } qt|| t |t | } q|dkrt|| | | | t || | | | } qtdn td | r| j| n| | |B>| }q4W||>|S( s#Helper method for constructing grammars of expressions made up of operators working in a precedence hierarchy. Operators may be unary or binary, left- or right-associative. Parse actions can also be attached to operator expressions. Parameters: - baseExpr - expression representing the most basic element for the nested - opList - list of tuples, one for each operator precedence level in the expression grammar; each tuple is of the form (opExpr, numTerms, rightLeftAssoc, parseAction), where: - opExpr is the pyparsing expression for the operator; may also be a string, which will be converted to a Literal; if numTerms is 3, opExpr is a tuple of two expressions, for the two operators separating the 3 terms - numTerms is the number of terms for this operator (must be 1, 2, or 3) - rightLeftAssoc is the indicator whether the operator is right or left associative, using the pyparsing-defined constants opAssoc.RIGHT and opAssoc.LEFT. - parseAction is the parse action to be associated with expressions matching this operator expression (the parse action tuple member may be omitted) t(Riiis@if numterms=3, opExpr must be a tuple or list of two expressionsis6operator must be unary (1), binary (2), or ternary (3)s2operator must indicate right or left associativityN(N(R R&RRRRRRtLEFTR R RtRIGHTRjRRRO(tbaseExprtopListRtlastExprRtoperDeftopExprtaritytrightLeftAssocRtopExpr1topExpr2tthisExprRt((s-/usr/lib/python2.7/site-packages/pyparsing.pyRS sP    '  /'   $  /'     s4"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))*"s string enclosed in double quotess4'(?:[^'\n\r\\]|(?:'')|(?:\\x[0-9a-fA-F]+)|(?:\\.))*'s string enclosed in single quotessq(?:"(?:[^"\n\r\\]|(?:"")|(?:\\x[0-9a-fA-F]+)|(?:\\.))*")|(?:'(?:[^'\n\r\\]|(?:'')|(?:\\x[0-9a-fA-F]+)|(?:\\.))*')s*quotedString using single or double quotestuRRc Cs||krtdn|d krt|trt|trt|dkrt|dkr|d k rtt|t||tj ddj d}q|t j t||tj j d}q|d k r9tt|t |t |ttj ddj d}qttt |t |ttj ddj d}qtdnt}|d k r|tt|t||B|Bt|>n,|tt|t||Bt|>|S( sHelper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default="("); can also be a pyparsing expression - closer - closing character for a nested list (default=")"); can also be a pyparsing expression - content - expression for items within the nested lists (default=None) - ignoreExpr - expression for ignoring opening and closing delimiters (default=quotedString) If an expression is not provided for the content argument, the nested expression will capture all whitespace-delimited content between delimiters as a list of separate values. Use the C{ignoreExpr} argument to define expressions that may contain opening or closing characters that should not be treated as opening or closing characters for nesting, such as quotedString or a comment expression. Specify multiple expressions using an C{L{Or}} or C{L{MatchFirst}}. The default is L{quotedString}, but if no expressions are to be ignored, then pass C{None} for this argument. s.opening and closing strings cannot be the sameiRcSs|djS(Ni(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRiscSs|djS(Ni(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRiscSs|djS(Ni(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi scSs|djS(Ni(R(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRi$ssOopening and closing arguments must be strings if no content expression is givenN(RRRjRRRRRRR!ROR?RRR R R&R.(topenertclosertcontentR1R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRN s2  $  $    3,c sfd}fd}fd}ttjdj}ttj|}tj|}tj|} |rtt||t|t|t|| } n0tt|t|t|t|} |jt t| S(sHelper method for defining space-delimited indentation blocks, such as those used to define block statements in Python source code. Parameters: - blockStatementExpr - expression defining syntax of statement that is repeated within the indented block - indentStack - list created by caller to manage indentation stack (multiple statementWithIndentedBlock expressions within a single grammar should share a common indentStack) - indent - boolean indicating whether block must be indented beyond the the current level; set to False for block of left-most statements (default=True) A valid block must contain at least one C{blockStatement}. css|t|krdSt||}|dkro|dkrZt||dnt||dndS(Nisillegal nestingsnot a peer entry(RR5RR(RgRIRtcurCol(t indentStack(s-/usr/lib/python2.7/site-packages/pyparsing.pytcheckPeerIndent>scsEt||}|dkr/j|nt||ddS(Nisnot a subentry(R5RR(RgRIRR(R(s-/usr/lib/python2.7/site-packages/pyparsing.pytcheckSubIndentFscsn|t|krdSt||}oH|dkoH|dks`t||dnjdS(Niisnot an unindent(RR5RR(RgRIRR(R(s-/usr/lib/python2.7/site-packages/pyparsing.pyt checkUnindentMs &s ( RRRRRROR RRRc( tblockStatementExprRRRRRtNLtINDENTtPEERtUNDENTtsmExpr((Rs-/usr/lib/python2.7/site-packages/pyparsing.pyRd.s8 $s#[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]s[\0xa1-\0xbf\0xd7\0xf7]s_:Rpsgt lt amp nbsp quottentityRqs><& "cCs |jtkrt|jpdS(N(Rt_htmlEntityMapR(R((s-/usr/lib/python2.7/site-packages/pyparsing.pyRihss/\*(?:[^*]*\*+)+?/sC style commentss.*s \/\/(\\\n|.)*s // comments:/(?:\*(?:[^*]*\*+)+?/|/[^\n]*(?:\n[^\n]*)*?(?:(?s tokens = stokens.columns = stokens.tables = tSQLiRR(( t simpleSQLRtRRltcolumnsttablesRRRR]R^RER(t teststringRbR[Rc((s-/usr/lib/python2.7/site-packages/pyparsing.pyttest}s    tselecttfroms_$RKRTR=RRsSELECT * from XYZZY, ABCsselect * from SYS.XYZZYsSelect A from Sys.dualsSelect AA,BB,CC from Sys.dualsSelect A, B, C from Sys.dualsXelect A, B, C from Sys.dualsSelect A, B, C frox Sys.dualtSelectsSelect ^^^ frox Sys.duals'Select A, B, C from Sys.dual, Table2 (Rt __version__t__versionTime__t __author__R?tweakrefRRRR]RR5Rt__all__t version_infot_PY3KtmaxsizeRRlRtchrRvRotascii_lowercasetascii_uppercaseR0tmaxinttxrangeRRt lowercaset uppercasetsingleArgBuiltinst __builtin__RrtfnameRtgetattrRRzRR{tdigitsRPRAR/RcRt printableRht whitespaceRTRhRRRRR!RRR5RHRERRRROR RR'RRRRR RRR+R"R RR*RR RRR%R$R-R,RRRRRRR RR.RR.R0RR#R R<R(R)RR RR&RR`RR<RR8R}RMRLRRRQR=ReRuR<R?RGRFR_R^ROt _escapedPunct_printables_less_backslasht_escapedHexChart_escapedOctChart _singleChart _charRangeRAR{R|R]RKRZRXRbR>RDR@RRIRJRcRRRRRRSR:R\RWRaRNRdR1RUR3R2RoR7RfRsRRYR4RBRR[R;R9RCRVt _noncommat _commasepitemR6R|Rt selectTokent fromTokentidentt columnNametcolumnNameListt tableNamet tableNameListR(((s-/usr/lib/python2.7/site-packages/pyparsing.pyt;s                   40  a       <CtF9eE>;XH$'" "AH   "      ;  !.@                G4 4  /  .8+