peggyjs / peggy

Peggy: Parser generator for JavaScript
https://peggyjs.org/
MIT License
883 stars 63 forks source link

posAssertion doesn't work #511

Closed bjornkihlberg closed 2 months ago

bjornkihlberg commented 2 months ago

In the peggy documentation it is stated that image but this doesn't seem to work. Is the documentation out of date?

How to reproduce

  1. Install peggy
    npm i -D peggy
  2. Code

    const ab_parser = peggy.generate('posAssertion = "a" &"b"')
    
    ab_parser.parse("ab")

    Generates the error SyntaxError: Expected end of input but "b" found.

bjornkihlberg commented 2 months ago

Never mind, I just realized that the examples have the match and rest patterns to make these work.