Ñò tQ³Kc@sídZddkiZddkZddkZdZdddddd d d d d dddddddddddddgZdZdZdZ dZ dZ d Z d!Z d"Zd#Zd$Zd%Zd&Zd'Zd(Zd)Zd*Zd+Zd,Zd-Zd.Zd/Zd0Zd1Zd2„Zd3„Zeiƒd4Z d4Z!d4Z"e!od5GHd6GHd7GHnd8d9d:gZ#d;„Z$d<e%fd=„ƒYZ&d>e'fd?„ƒYZ(d@e'fdA„ƒYZ)dBe'fdC„ƒYZ*dDe'fdE„ƒYZ+dFdHdG„ƒYZ,dS(IsLParse C++ header files and generate a data structure representing the class iÿÿÿÿNs1.05tNUMBERtNAMEt OPEN_PARENt CLOSE_PARENt OPEN_BRACEt CLOSE_BRACEtCOLONt SEMI_COLONtCOMMAtCOMMENT_SINGLELINEtCOMMENT_MULTILINEt PRECOMP_MACROtPRECOMP_MACRO_CONTtASTERISKt AMPERSTANDtEQUALStMINUStPLUStDIVIDEt CHAR_LITERALtSTRING_LITERALtOPERATOR_DIVIDE_OVERLOADtNEW_LINEs ~[].|!?%@s[0-9][0-9XxA-Fa-f]*s[<>A-Za-z_][A-Za-z0-9_]*s/=s\(s\)t{t}t;t:t,s\#.*s.*\\\ns\/\/.*\ns\*s\-s\+s/[^/]t&t=s'.'s"([^"\\]|\\.)*"s)/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/cCs|iit|iƒ7_dS(s\n+N(tlexertlinenotlentvalue(tt((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyt t_NEWLINEkscCs dG|GHdS(Ns Lex error: ((tv((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pytt_errorosis*****************************s* Debugging namestack mode *s***************************** tpublict protectedtprivatecCslt|ƒdjotS|ddjotSt|ƒdjo'|ddjo|ddjotStS(s.Determines if a namestack is an enum namestackitenumittypedef(R tFalsetTrue(t nameStack((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pytis_enum_namestackƒs5t CppParseErrorcBseZRS((t__name__t __module__(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR/stCppClasscBs eZdZd„Zd„ZRS(s»Takes a name stack and turns it into a class Contains the following Keys: self['name'] - Name of the class self['inherits'] - List of Classes that this one inherits where the values are of the form {"access": Anything in supportedAccessSpecifier "class": Name of the class self['methods'] - Dictionary where keys are from supportedAccessSpecifier and values are a lists of CppMethod's self['properties'] - Dictionary where keys are from supportedAccessSpecifier and values are lists of CppVariable's self['enums'] - Dictionary where keys are from supportedAccessSpecifier and values are lists of CppEnum's An example of how this could look is as follows: #self = { 'name': "" 'namespace': [] 'inherits':[] 'methods': { 'public':[], 'protected':[], 'private':[] }, 'properties': { 'public':[], 'protected':[], 'private':[] }, 'enums': { 'public':[], 'protected':[], 'private':[] } } c Cs¿t|ƒdjo dGHdS|d|d<||dtrtnt inheritClassRFR)tpropertytmethod((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyt__repr__æs8     (R0R1t__doc__RGRN(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR2s( .t CppMethodcBseZdZd„ZRS(søTakes a name stack and turns it into a method Contains the following Keys: self['rtnType'] - Return type of the method (ex. "int") self['name'] - Name of the method (ex. "getSize") self['parameters'] - List of CppVariables c Csvto dG|GHndi||idƒd ƒ|d|it|d|id ƒ!ƒƒ||id ƒd}qÚt|ƒ}t|iƒƒo|i|ƒnPqÚW||d R-t paramsStacktparamstparam((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRG s, $0   # (R0R1RORG(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRPsRZcBseZdZd„ZRS(sGTakes a name stack and turns it into a method Contains the following Keys: self['type'] - Type for the variable (ex. "const string &") self['name'] - Name of the variable (ex. "numItems") self['defaltValue'] - Default value of the variable, this key will only exist if there is a default value cCs1to dG|GHnt|ƒdjodSd|jogdi||idƒd ƒ|d<||idƒd|dt>(RWR RXR;treplace(R>R-((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRG,s  $((R0R1RORG(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRZ#stCppEnumcBseZdZd„ZRS(s½Takes a name stack and turns it into an Enum Contains the following Keys: self['name'] - Name of the enum (ex. "ItemState") self['values'] - List of values where the values are a dictionary of the form {"name": name of the key (ex. "PARSING_HEADER"), "value": Specified value of the enum, this key will only exist if a value for a given enum value was defined } cCsNt|ƒdjpd|jp d|jodSg}||idƒd|idƒ!}xât|ƒoÔg}d|jo.||idƒ }||idƒd}n |}g}t|ƒdjo|ih|dd6ƒq^t|ƒdjoA|dd jo0|ih|dd6d i|d ƒd 6ƒq^q^Wt|ƒo||d R-t valueListt valueStackRAt preBraceStacktpostBraceStacktvar((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRGGs@-#  $5    (R0R1RORG(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRc<s t CppHeadercBsPeZdZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS( s®Parsed C++ class header Variables produced: self.classes - Dictionary of classes found in a given header file where the key is the name of the class tfilec Cs0|djoT||_tii|iƒdd |_d}|ddjotdƒ‚q–n6|djod|_d|_|}n td ƒ‚d|_d|_h|_g|_ g|_ g|_ d |_ d |_ tod G|i GHnd |_t|iƒo"d it|iƒiƒƒ}nd |_d |_todG|iGHdG|iGHnti|ƒd }d }ysxltodtiƒ}|pPn|i}|i}|idjot|i ƒo¢t|i ƒ o‘to dGHn|i d djo_t|i ƒdjoI|i d|_|id7_|i i|i dƒ|i d7_ n|i ƒn+|i i|i!ƒtodG|i!GHntodG|iGdG|idGHn|id7_nê|idjoÙt|i ƒo't|i ƒo|i i|i!ƒnjt|i ƒoO|i d djpd|i jo+t|i ƒd jo|i i"ƒq€n|i ƒtodG|iGdG|idGHn|id8_n|idjo|i i|i!ƒq„|idjo|i i|i!ƒq„|idjo|i i|i!ƒq„|idjo|i i|i!ƒq„|idjo|i i|i!ƒq„|id jo|i i|i!ƒq„|id!jo|i i|i!ƒq„|id"jo|i i|i!ƒq„|id#jp |id$jp|id%jo^|i!djo|i i|i!ƒqë|i!t#jo|i!|_që|i i|i!ƒq„|id&jo4t|i ƒd joq„n|i i|i!ƒq„|id'jo|i ƒq„q„WWn8t$d(|i|i|i!d)i|i ƒfƒ‚nXdS(*NRliiþÿÿÿts.hs*file must be a header file and end with .htstrings???s&Arg type must be either file or stringisinit nameStack to: R(s sinit braceDepth to: sinit namespacebraceDepth to: Rsgoing to evaluateStack at {R4is appending sbraceDepth += 1 s => RR6RRsbraceDepth -= 1 RRRRRRRRRRR RRs@Not able to parse %s on line %d evaluating "%s" Error around: %sRQ(%theaderFileNametostpathtsplitt mainClasst ExceptiontcurClasst curNamespacetclassesR-t prevNameStackR?topeningBracketNStclosingBracketNStdebug_namestacktcurAccessSpecifierR RXtopent readlinest braceDepthtnamespaceBraceDepthtdebug_braceDepthtlextinputR,ttokenRtlexposR^R.R<t evaluateStackR!RYR=R/(R>RotargTypet headerFileStrtcurLinetcurCharttok((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRGus                 "       ! * 4 0cCs±|i|_d|ijp d|ijpd|ijog|_dStodG|iGHnt|iƒo#tod|i|ifGq”nt|iƒdjo%to dGHnto d GHndS|idd jog|_dS|idd jo|iƒn{t|iƒdjog|_to d GHndSt|iƒo|i ƒn)d |ijo|i ƒn |i ƒg|_todG|iGHndS(s Evaluates the current name stacktiftreturntforNs"inside evaluateStack. nameStack = s%s (%s) is (Empty Stack)s-Empty namestack. Returning from evaluateStackR4R6s;returning from evaluateStack due to len(self.curClass) == 0RRs*returning from evaluateStack. nameStack = ( R-RxR{R RuRWR|tevaluateClassStackR.tevaluateEnumStacktevaluateMethodStacktevaluatePropertyStack(R>((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR†ösB 0        cCsmtodG|iGHnt|i|iƒ}t|iƒƒo!|d|_||i|itnewClass((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR#s cCsctodG|iGHnt|iƒ}t|iƒƒo&|i|id|ii|ƒndS(s%Create a method out of the name stacks(inside evaluateMethodStack. nameStack = R8N( R{R-RPR RHRwRuR|R<(R>t newMethod((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR‘1s cCsLt|iƒ}t|iƒƒo&|i|id|ii|ƒndS(s'Create a Property out of the name stackR9N(RZR-R RHRwRuR|R<(R>tnewVar((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR’9scCsÐtodG|iGHnt|iƒ}t|iƒƒo“|i|id|ii|ƒ|i dƒo]d}|i dƒo|d}nx+|dD]}||g|_|i ƒqšW|d=qÌndS(s$Create an Enum out of the name stacks&inside evaluateEnumStack. nameStack = R:ReR)R3N( R{R-RcR RHRwRuR|R<thas_keyR’(R>tnewEnumt instanceTypetinstance((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyR?s" cCs;d}x.|iiƒD]}|t|i|ƒ7}qW|S(NRm(RwRHRI(R>RJt className((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRNPs ( R0R1RORGR†RR‘R’RRN(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyRkns -    ((-ROtply.lexR‚Rptsyst __version__ttokenstt_ignorett_NUMBERtt_NAMEtt_OPERATOR_DIVIDE_OVERLOADt t_OPEN_PARENt t_CLOSE_PARENt t_OPEN_BRACEt t_CLOSE_BRACEt t_SEMI_COLONtt_COLONtt_COMMAtt_PRECOMP_MACROtt_PRECOMP_MACRO_CONTtt_COMMENT_SINGLELINEt t_ASTERISKtt_MINUStt_PLUStt_DIVIDEt t_AMPERSTANDtt_EQUALStt_CHAR_LITERALtt_STRING_LITERALtt_COMMENT_MULTILINER#R%RWR{RR=R.RtR/tdictR2RPRZRcRk(((sM/home/ecochran/Desktop/IrrHaskell-0.1.1/InterfaceGenerator/CppHeaderParser.pyt/sŒ         t 2