Fixed some problems in the generated c++/lr parser
This commit is contained in:
parent
b777ffc52d
commit
832dcd813d
|
@ -91,7 +91,7 @@ enum Action {
|
|||
/*********************************************
|
||||
* Translate a Symbol to a readable string *
|
||||
*********************************************/
|
||||
std::string to_string({{name}}_Symbol s) {
|
||||
inline std::string to_string({{name}}_Symbol s) {
|
||||
switch (s) {
|
||||
{{#symbols}}
|
||||
case {{name}}_Symbol::{{symbol}}:
|
||||
|
@ -149,14 +149,14 @@ Value {{name}}<Value>::parse() {
|
|||
}
|
||||
|
||||
stateStack.push(TABLE[stateStack.top()][verr] >> 2);
|
||||
valueStack.emplace(std::move(errorVal));
|
||||
valueStack.emplace(Token{ {{name}}_Symbol::V_error, std::move(errorVal)});
|
||||
|
||||
while (tok != {{name}}_Symbol::T_EOF && (TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
|
||||
tok = lex();
|
||||
}
|
||||
if ((TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
|
||||
throw SyntaxError("Syntax error: could not recover");
|
||||
}
|
||||
while (tok.symbol != {{name}}_Symbol::T_EOF && (TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
|
||||
tok = lex();
|
||||
}
|
||||
if ((TABLE[stateStack.top()][static_cast<std::uint64_t>(tok.symbol)] & 0x3) == ERROR) {
|
||||
throw SyntaxError("Syntax error: could not recover");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHIFT:
|
||||
|
|
Loading…
Reference in New Issue