pull/222/head
yhirose 2 years ago
parent b368726b40
commit 970537730f
  1. BIN
      docs/native.wasm
  2. 7
      peglib.h
  3. 6
      test/test2.cc

Binary file not shown.

@ -1125,7 +1125,7 @@ public:
count++;
}
while (n - i > 0 && count < max_) {
while (count < max_) {
c.push_capture_scope();
auto se = scope_exit([&]() { c.pop_capture_scope(); });
auto save_sv_size = vs.size();
@ -2936,11 +2936,6 @@ inline size_t Recovery::parse_core(const char *s, size_t n,
if (success(len)) {
c.recovered = true;
if (c.log) {
c.error_info.output_log(c.log, c.s, c.l);
c.error_info.clear();
}
}
// Cut

@ -1452,20 +1452,20 @@ rrr | sss
TEST(ErrorTest, Error_recovery_2) {
parser pg(R"(
START <- ENTRY ((',' ENTRY) / %recover((!(',' / Space) .)+))* (_ / %recover(.*))
START <- ENTRY (',' ENTRY)* _*
ENTRY <- '[' ITEM (',' ITEM)* ']'
ITEM <- WORD / NUM / %recover((!(',' / ']') .)+)
NUM <- [0-9]+ ![a-z]
WORD <- '"' [a-z]+ '"'
~_ <- Space*
~_ <- Space
Space <- [ \n]
)");
EXPECT_TRUE(!!pg);
std::vector<std::string> errors{
R"(1:6: syntax error, unexpected ']', expecting ','.)",
R"(1:6: syntax error, unexpected ']', expecting <Space>.)",
R"(1:18: syntax error, unexpected 'z', expecting <NUM>.)",
R"(1:24: syntax error, unexpected ',', expecting '"'.)",
R"(1:31: syntax error, unexpected 'ccc', expecting '"', <NUM>.)",

Loading…
Cancel
Save