mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Fixed crash.
This commit is contained in:
parent
dba1c42826
commit
e778187df8
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user