2 #include "VhdlParserTokenManager.h"
3 #include "VhdlParserErrorHandler.hpp"
4 #include "VhdlParser.h"
5 #include "VhdlParserIF.h"
6 #include "CharStream.h"
8 using namespace vhdl::parser;
10 static VhdlParser * myParser=0;
12 void VhdlParserIF::parseVhdlfile(const char* inputBuffer,bool inLine)
14 JAVACC_STRING_TYPE s =inputBuffer;
15 CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1);
16 VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
17 myParser=new VhdlParser(tokenManager);
18 VhdlErrorHandler *myErr=new VhdlErrorHandler();
19 myParser->setErrorHandler(myErr);
24 myParser->parseInline();
28 myParser->design_file();
31 catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
32 // fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
33 // fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
38 void VhdlParser::error_skipto(int kind)
43 Token *t = myParser->getNextToken();// step to next token
44 op=myParser->getToken(1); // get first token
46 //fprintf(stderr,"\n %s",t->image.data());
47 } while (op->kind != kind);
48 myParser->hasError=false;
49 // The above loop consumes tokens all the way up to a token of
50 // "kind". We use a do-while loop rather than a while because the
51 // current token is the one immediately before the erroneous token
52 // (in our case the token immediately before what should have been