Fixed crash.

This commit is contained in:
yhirose 2015-07-30 18:47:27 -04:00
parent dba1c42826
commit e778187df8

View File

@ -453,11 +453,10 @@ TEST_CASE("Calculator test with AST", "[general]")
" ~_ <- [ \t\r\n]* " " ~_ <- [ \t\r\n]* "
); );
const int kTagNumber = 0; parser.enable_ast(true);
parser.enable_ast(true, { { "NUMBER", kTagNumber } });
function<long (const Ast&)> eval = [&](const Ast& ast) { function<long (const Ast&)> eval = [&](const Ast& ast) {
if (ast.tag == kTagNumber) { if (ast.name == "NUMBER") {
return stol(ast.token); return stol(ast.token);
} else { } else {
const auto& nodes = ast.nodes; const auto& nodes = ast.nodes;