The docs of `eventParser` show how the matched portion of the input string `s`, 
starting at index `start` with length `length` can be accessed inside the 
handlers. Note that PEGs are matched eagerly, one can only be sure that a match 
is legitimate if `length >= 0` in the `leave` handler. To use this for actual 
parsing, it takes some external data structure like a stack or probably your 
synatx tree.

Alternatively, you could take a look at zevv's NPeg on github.

Reply via email to