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]* "
);
const int kTagNumber = 0;
parser.enable_ast(true, { { "NUMBER", kTagNumber } });
parser.enable_ast(true);
function<long (const Ast&)> eval = [&](const Ast& ast) {
if (ast.tag == kTagNumber) {
if (ast.name == "NUMBER") {
return stol(ast.token);
} else {
const auto& nodes = ast.nodes;