2 #include <ozulis/core/assert.hh>
3 #include <moulette/bison/parser.hh>
4 #include <moulette/bison/lexer-extra.hh>
5 #include <moulette/bison/lexer.hh>
6 #include "test-parser.hh"
8 int moulette_parse(yyscan_t yyscanner
, moulette::TestParser
& ctx
);
12 TestParser::TestParser()
19 TestParser::parseBuffer(const std::string
& buffer
,
20 const boost::filesystem::path
& path
)
27 moulette_lex_init_extra(&extra
, &scanner
);
28 moulette__scan_string(buffer
.c_str(), scanner
);
29 assert_msg(!moulette_parse(scanner
, parser
), _("parse error"));
30 moulette_lex_destroy(scanner
);
35 TestParser::parseFile(const boost::filesystem::path
& path
)
37 if (!boost::filesystem::is_regular_file(path
))
45 moulette_lex_init_extra(&extra
, &scanner
);
47 FILE * stream
= fopen(path
.string().c_str(), "r");
49 moulette_set_in(stream
, scanner
);
50 assert_msg(!moulette_parse(scanner
, parser
), _("parse error"));
51 moulette_lex_destroy(scanner
);