ó %œ‡Uc@s÷dZddlZddlZddlZddlZdgZdd"d„ƒYZejdƒZejdƒZ ejdƒZ ejd ƒZ ejd ƒZ ejd ƒZ ejd ƒZejd ejƒZejdejƒZejdejƒZejdƒZejdƒZejdƒZe ee gZejdejƒZejdejƒZeeeegZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"dd„Z$ejdƒZ%d „Z&dd!„Z'dS(#skSimple module for extracting GNOME style doc comments from C sources, so I can use them for other purposes.iÿÿÿÿNtextracttGtkDoccBsƒeZd„Zd„Zd„Zd„Zgd„Zd„Zd„Zd„Z d„Z d „Z d „Z gd „Z d „ZRS( cCs@d|_d|_g|_g|_d|_dgf|_dS(Nt(tNonetnamet block_typetparamst annotationst descriptiontret(tself((s0/usr/share/pygobject27/2.0/codegen/docextract.pyt__init__ s      cCs ||_dS(N(R(R R((s0/usr/share/pygobject27/2.0/codegen/docextract.pytset_namescCs ||_dS(N(R(R R((s0/usr/share/pygobject27/2.0/codegen/docextract.pytset_typescCs|jS(N(R(R ((s0/usr/share/pygobject27/2.0/codegen/docextract.pytget_typescCs2|dkrd}n|jj|||fƒdS(Ns...tVarargs(Rtappend(R RRR((s0/usr/share/pygobject27/2.0/codegen/docextract.pyt add_params  cCs?|jdd|jdd||jddf|jdtj|ƒrPqqW|S(N(tcomment_empty_line_patternR/R"tcomment_end_pattern(R(R*((s0/usr/share/pygobject27/2.0/codegen/docextract.pytskip_to_nonblank‡s  cCs|r|jƒ}nt||ƒ}|rtj|ƒ rtjd|ƒ}xÇtD]¼}|j|ƒ}|rS|j|jdƒƒt |jdƒƒ}x|D]}|j |ƒq W|t krÓ|j dƒn8|t krï|j dƒn|tkr |j dƒn|SqSWn|S(NRiitsignaltpropertytfunction(R"R<R;R/tcomment_line_lead_patternR3tidentifier_patternsR R0R8Rtsignal_name_patternR tproperty_name_patterntfunction_name_pattern(R(R*R+tpatternR/RR((s0/usr/share/pygobject27/2.0/codegen/docextract.pyR$—s(      cCs«|r|jƒ}nt||ƒ}| s:tj|ƒr>|Stjd|ƒ}tj|ƒ}xE|r¦|r¦|jdƒ}g}tj|ƒ}|rÂt |jdƒƒ}tjd|ƒ}n|j }|jdƒj ƒdkr|j ||ƒ|j }n|j|jdƒ||ƒ|jƒ}xg|r“tj|ƒsQtj|ƒrUPntjd|ƒ}tj|ƒrzPn||ƒ|jƒ}q-Wtj|ƒ}qbW|S(NRiitreturns(R"R<R;R/R@R3t param_patternR0tannotations_patternR8RtlowerRRRR:(R(R*R+R/RRtannotation_matcht append_func((s0/usr/share/pygobject27/2.0/codegen/docextract.pyR%ºs>     cCs t||ƒ}| s%tj|ƒr)|Stjd|ƒ}|d dkrX|d}nd}x§|rtj|ƒr†|dkr†|Sx!tD]}|j|ƒr|SqW|j|ƒ|}|jƒ}| sßtj|ƒrã|Stjd|ƒ}|sad}qaqaWdS(NRi s Description:s non-emptys ( R<R;R/R@R3tno_colon_return_patterntfinal_section_patternsRR"(R(R*R+t prev_lineRE((s0/usr/share/pygobject27/2.0/codegen/docextract.pyR&s*     c Csöxï|rñtj|ƒ rñtjd|ƒ}tjtƒxÿtD]÷}|j|ƒ}|r?|tksr|tkrâ|jdƒ}g}t j|ƒ}|rÆt |jdƒƒ}t jd|ƒ}n|j ||ƒ|j }nP|t krd}|j|jdƒ|jdƒfƒn|j|ƒ|j}Pq?q?Wtjƒ|jƒ}t} x•| rí|rítj|ƒ rítjd|ƒ}|s—d}nx'tD]}|j|ƒržt} PqžqžW| rËPn|rÞ||ƒn|jƒ}qYWqW|S(NRiis (R;R/R@R3RMRRLtreturn_patternR0RHR8RRtrename_to_patternRRRtpopR"tFalsetTrue( R(R*R+RER/RRRJRKtfinished((s0/usr/share/pygobject27/2.0/codegen/docextract.pyR'1sR             cCsºx³tj|ƒD]¢}|d kr(qntjj||ƒ}tjj|ƒr_t||ƒnt|ƒdkr|ddkrtjj d|dƒt t |dƒ|ƒqqWdS( Nt.s..iiþÿÿÿs.cs Processing s tr(RUs..( tostlistdirtpathtjointisdirt parse_dirRtsyststderrtwriteR,topen(tdirR)tfileRY((s0/usr/share/pygobject27/2.0/codegen/docextract.pyR\ƒs "cCs1|si}nx|D]}t||ƒqW|S(N(R\(tdirsR)Ra((s0/usr/share/pygobject27/2.0/codegen/docextract.pyRs   s"^$cCswd}|jƒ}x^|rrtj|ƒ}|ržd}|jdƒ}|jdƒ}|dkrc|j|ƒ}|s›tƒ}|j|ƒ||| i s @Returns: it@t:(RR"ttmpl_section_patternR/R0tgetRR tstringR1RtfindRR(R(R)R+R*R/t sect_typet sect_nametpos((s0/usr/share/pygobject27/2.0/codegen/docextract.pyt parse_tmpl”s6        "cCs¸|si}nx¢|D]š}x‘tj|ƒD]€}|dkrDq,ntjj||ƒ}tjj|ƒrqq,nt|ƒdkr,|ddkr,tt|dƒ|ƒq,q,WqW|S(NRUs..iiþÿÿÿs.sgmlRV(RUs..(RWRXRYRZR[RRnR`(RcR)RaRbRY((s0/usr/share/pygobject27/2.0/codegen/docextract.pyt extract_tmpl¶s   "!(((t__doc__R]RWRitret__all__RtcompileR9R;R@R:RDRBRCt IGNORECASEROtdeprecated_patternRPRGRHR.RARLt since_patternRMR,R8R#R<R$R%R&R'R\RRRgRnRo(((s0/usr/share/pygobject27/2.0/codegen/docextract.pytsB0 *    # F 1 R  "