AstNode * makeObject() { AstNode *object; AstNode *equMeth, *construct, *destruct; AstNode *declator, *fparam; AstNode *ret, *eq; Literal *classLit, *oLit, *equalsLit; /* * Build the * int equals(Object o) { return this == o; } * method. */ classLit = makeLiteral(OBJECT_NAME, 0); oLit = makeLiteral("o", 0); fparam = makeFormalParam(makeNameId(classLit), makeNameId(oLit), 0); equalsLit = makeLiteral("equals", 0); declator = makeMethDeclator(makeNameId(equalsLit), makeSeq(fparam), 0); eq = makeBinaryOp(EQU_OP, makeThis(0), makeExprId(oLit), 0); ret = makeReturnSt(eq, 0); equMeth = makeMethDecl(makeInt(0), declator, makeSeq(ret), 0); /* * Build * Object() { return; } * constructor */ declator = makeConstDeclator(makeNameId(classLit), NULL, 0); construct = makeConstDecl(declator, makeSeq(makeReturnSt(NULL, 0)), 0); /* * Build * ~Object() { return; } * destructor */ destruct = makeDestructor(makeNameId(classLit), makeSeq(makeReturnSt(NULL, 0)), 0); /* * Link the class all together. */ object = makeClass(makeNameId(classLit), NULL, appendSeq(appendSeq(makeSeq(equMeth), makeSeq(construct)), makeSeq(destruct)), 0); return object; }
YY_ACTION(void) yy_5_primary(char *yytext, int yyleng) { yyprintf((stderr, "do yy_5_primary\n")); push(makeClass(yytext)); ; }
void Parser_Perl::parse() { QString continuation; QString *name=new QString(); QString parent; PerlSymbol *parentSymbol=NULL; const char *line; int line_skip = 0; char const *longStringLiteral = NULL; while ((line = (const char *) fileReadLine ()) != NULL) { const char *cp = line; char const *keyword; //int indent; cp = skipSpace (cp); if (*cp == '\0') /* skip blank line */ continue; /* Skip comment if we are not inside a multi-line string. */ if (*cp == '#' && !longStringLiteral) continue; /* Deal with line continuation. */ if (!line_skip) continuation=""; continuation+=QString(line); //vStringStripTrailing(continuation); cp = line = continuation.toLatin1().data(); cp = skipSpace (cp); line_skip = 0; /* Deal with def and class keywords. */ keyword = findDefinitionOrClass (cp); //printf("LINE_:%s\n",line); if (keyword) { bool found = false; bool is_class = false; if (!strncmp (keyword, "sub ", 4) && isspace(keyword[3])) { cp = skipSpace (keyword + 4); found = true; } else if (!strncmp (keyword, "package", 7) && isspace(keyword[7])) { cp = skipSpace (keyword + 7); found = true; is_class = true; } if (found) { PerlSymbol *symbol = NULL; if (is_class) { symbol = makeClass (cp, 0); parentSymbol=symbol; } else symbol = makeFunction(cp, name, parentSymbol); } } /* Find global and class variables */ #ifdef SHOW_VARIABLES //char const *variable = findVariable(line); char const* variable; if (variable) { const char *start = variable; vStringClear (name); while (isIdentifierCharacter ((int) *start)) { vStringPut (name, (int) *start); ++start; } vStringTerminate (name); PerlSymbol *symbol = NULL; PerlSymbol *parentSymbol = getParent(indent); symbol = new PerlSymbol(parentSymbol, vStringToQString(name)); symbol->setIndent(indent); symbol->setLine(this->getSourceLineNumber()); symbol->setIconType(Symbol::IconVar); } #endif /* Find and parse imports */ #ifdef SHOW_IMPORTS parseImports(line); #endif } /* Clean up all memory we allocated. */ if(name)delete name; }
void makeSetupCode( char *infname = "root://eoscms//eos/cms/store/caf/user/yjlee/pPb2013/promptReco/PA2013_HiForest_PromptRecofirstPR_forestv68.root" ){ TFile *inf = TFile::Open(infname); TTree *hltTree = (TTree*) inf->Get("hltanalysis/HltTree"); TTree *skimTree = (TTree*) inf->Get("skimanalysis/HltTree"); TTree *photonTree = (TTree*) inf->Get("multiPhotonAnalyzer/photon"); TTree *evtTree = (TTree*) inf->Get("hiEvtAnalyzer/HiTree"); TTree *jetTree = (TTree*) inf->Get("akPu3PFJetAnalyzer/t"); TTree *hitTree = (TTree*) inf->Get("rechitanalyzer/zdcrechit"); TTree *digiTree = (TTree*) inf->Get("rechitanalyzer/zdcdigi"); TTree *noiseTree = (TTree*) inf->Get("hcalNoise/hbhenoise"); TTree *trackTree = (TTree*) inf->Get("ppTrack/trackTree"); TTree *metTree = (TTree*) inf->Get("anaMET/metTree"); TTree *pfTree = (TTree*) inf->Get("pfcandAnalyzer/pfTree"); TTree *muonTree = (TTree*) inf->Get("muonTree/HLTMuTree"); // Add Dummy for skimTree if (hltTree) makeClass(hltTree,"Hlt",""); if (skimTree) makeClass(skimTree,"Skim",""); if (photonTree) makeClass(photonTree,"Photon",""); if (evtTree) makeClass(evtTree,"Evt",""); if (trackTree) makeClass(trackTree,"Track",""); if (jetTree) makeClass(jetTree,"Jet",""); // if (hitTree) makeClass(hitTree,"Hit",""); if (metTree) makeClass(metTree,"Met",""); if (pfTree) makeClass(pfTree,"PF",""); if (noiseTree) makeClass(noiseTree,"Noise",""); if (digiTree) makeClass(digiTree,"Digi",""); if (muonTree) makeClass(muonTree,"Muon",""); }
YY_ACTION(void) yy_5_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR) { yyprintf((stderr, "do yy_5_primary\n")); push(makeClass(yytext)); ; }