yhirose / cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library
MIT License
880 stars 112 forks source link

Infinite loop problem #211

Closed yhirose closed 2 years ago

yhirose commented 2 years ago

The grammar was not exactly that one because I recover from the screen retyping it and omitted some elements, can you try with the one shown bellow and delete the = inside the second '='* (not the first one as shown by your screenshoot) with the Auto refresh checkbox checked (tested on Firefox too and it get frozen and asking to kill the page):

start <- _ STRING_LONG* !.
_ <- [ \t\n\r]*
STRING_LONG <-
     '[' '='* '[' ( ! (']' '='* ']') . )* ']' '='* ']' _

Input:

[==[]=]==]

Originally posted by @mingodad in https://github.com/yhirose/cpp-peglib/issues/207#issuecomment-1147765110

yhirose commented 2 years ago

Shorter example to reproduce this problem.

S <- A*
A <- 'a' ''*
aa