diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-03 13:11:32 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-03 13:49:24 (GMT) |
commit | 088896f27f460b6ac03c2d64df148e3617c1e519 (patch) | |
tree | 5b0c250c54a6ede082f765d507d749fad52b0756 /vhdlparser/VhdlParser.cc | |
parent | d75455eef7c91f11c2b9061d9a086ce93c4231b2 (diff) | |
download | Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.zip Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.tar.gz Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.tar.bz2 |
Switched back to version 6.2 of JavaCC for VHDL parser generation.
Diffstat (limited to 'vhdlparser/VhdlParser.cc')
-rw-r--r-- | vhdlparser/VhdlParser.cc | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/vhdlparser/VhdlParser.cc b/vhdlparser/VhdlParser.cc index 39a1308..c695c93 100644 --- a/vhdlparser/VhdlParser.cc +++ b/vhdlparser/VhdlParser.cc @@ -1,5 +1,6 @@ /* VhdlParser.cc */ -#include "./VhdlParser.h" +#include "VhdlParser.h" +#include "TokenMgrError.h" namespace vhdl { namespace parser { unsigned int jj_la1_0[] = { @@ -12753,26 +12754,16 @@ void VhdlParser::parseInline() { VhdlParser::VhdlParser(TokenManager *tm){ head = NULL; + errorHandlerCreated = false; ReInit(tm); } - VhdlParser::~VhdlParser() +VhdlParser::~VhdlParser() { - if (token_source) delete token_source; - if (head) { - Token *next, *t = head; - while (t) { - next = t->next; - delete t; - t = next; - } - } - if (errorHandlerCreated) { - delete errorHandler; - } + clear(); } void VhdlParser::ReInit(TokenManager *tm){ - if (head) delete head; + clear(); errorHandler = new ErrorHandler(); errorHandlerCreated = true; hasError = false; @@ -12794,6 +12785,24 @@ void VhdlParser::ReInit(TokenManager *tm){ } +void VhdlParser::clear(){ + //Since token manager was generate from outside, + //parser should not take care of deleting + //if (token_source) delete token_source; + if (head) { + Token *next, *t = head; + while (t) { + next = t->next; + delete t; + t = next; + } + } + if (errorHandlerCreated) { + delete errorHandler; + } +} + + Token * VhdlParser::jj_consume_token(int kind) { Token *oldToken; if ((oldToken = token)->next != NULL) token = token->next; @@ -12873,26 +12882,23 @@ int VhdlParser::jj_ntk_f(){ } -void VhdlParser::jj_add_error_token(int kind, int pos) { + void VhdlParser::jj_add_error_token(int kind, int pos) { } - /** Generate ParseException. */ void VhdlParser::parseError() { fprintf(stderr, "Parse error at: %d:%d, after token: %s encountered: %s\n", token->beginLine, token->beginColumn, addUnicodeEscapes(token->image).c_str(), addUnicodeEscapes(getToken(1)->image).c_str()); } - void VhdlParser::enable_tracing() { + void VhdlParser::enable_tracing() { } - /** Disable tracing. */ - - void VhdlParser::disable_tracing() { + void VhdlParser::disable_tracing() { } -void VhdlParser::jj_rescan_token(){ + void VhdlParser::jj_rescan_token(){ jj_rescan = true; for (int i = 0; i < 114; i++) { JJCalls *p = &jj_2_rtns[i]; @@ -13023,7 +13029,7 @@ void VhdlParser::jj_rescan_token(){ } -void VhdlParser::jj_save(int index, int xla){ + void VhdlParser::jj_save(int index, int xla){ JJCalls *p = &jj_2_rtns[index]; while (p->gen > jj_gen) { if (p->next == NULL) { p = p->next = new JJCalls(); break; } |