Fixed build errors.

pull/3/head
yhirose 9 years ago
parent 65d1d99b2b
commit 02957c3668
  1. 3
      lint/peglint.cc
  2. 9
      test/test.cc

@ -89,13 +89,14 @@ int main(int argc, const char** argv)
};
if (opt_ast) {
peg.enable_ast(opt_optimize_ast_nodes);
peg.enable_ast();
std::shared_ptr<peglib::Ast> ast;
if (!peg.parse_n(source.data(), source.size(), ast)) {
return -1;
}
ast = peglib::AstOptimizer(opt_optimize_ast_nodes).optimize(ast);
peglib::AstPrint().print(*ast);
} else {
if (!peg.parse_n(source.data(), source.size())) {

@ -453,7 +453,7 @@ TEST_CASE("Calculator test with AST", "[general]")
" ~_ <- [ \t\r\n]* "
);
parser.enable_ast(true);
parser.enable_ast();
function<long (const Ast&)> eval = [&](const Ast& ast) {
if (ast.name == "NUMBER") {
@ -477,6 +477,7 @@ TEST_CASE("Calculator test with AST", "[general]")
shared_ptr<Ast> ast;
auto ret = parser.parse("1+2*3*(4-5+6)/7-8", ast);
ast = peglib::AstOptimizer(true).optimize(ast);
auto val = eval(*ast);
REQUIRE(ret == true);
@ -492,7 +493,7 @@ TEST_CASE("Ignore semantic value test", "[general]")
" _ <- [ \t\r\n]* "
);
parser.enable_ast(false);
parser.enable_ast();
shared_ptr<Ast> ast;
auto ret = parser.parse("Hello World", ast);
@ -512,7 +513,7 @@ TEST_CASE("Ignore semantic value of 'or' predicate test", "[general]")
" ~_ <- [ \t\r\n]* "
);
parser.enable_ast(false);
parser.enable_ast();
shared_ptr<Ast> ast;
auto ret = parser.parse("Hello World.", ast);
@ -531,7 +532,7 @@ TEST_CASE("Ignore semantic value of 'and' predicate test", "[general]")
" ~_ <- [ \t\r\n]* "
);
parser.enable_ast(false);
parser.enable_ast();
shared_ptr<Ast> ast;
auto ret = parser.parse("Hello World.", ast);

Loading…
Cancel
Save