00001 #include "treeparser.h" 00002 00003 #include "streeconstant.h" 00004 #include "streevariable.h" 00005 #include "testers.h" 00006 #include "rtreeactionrule.h" 00007 #include "parser.tab.h" 00008 00009 extern int yyparse(); 00010 extern int yydebug; 00011 extern void* yymyresult; 00012 extern FILE* yyin; 00013 extern ParseType parseRules; 00014 extern RuleSystem* factor; 00015 extern int yylineno; 00016 00017 void* XParser::parse(const string &fileName, ParseType iparseRules, RuleSystem *ifactor, bool iyydebug = 0){ 00018 parseRules = iparseRules; 00019 yydebug = iyydebug; 00020 factor = ifactor; 00021 00022 yylineno = 1; 00023 00024 yyin = fopen(fileName.c_str(), "r"); 00025 if (yyin == NULL) throw string("ERROR: XParser::parse - error opening file: ") 00026 +string(fileName); 00027 if (yyparse()) 00028 throw "PARSE"; 00029 fclose(yyin); 00030 return yymyresult; 00031 };