You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

432 B

Backtracking

Unlike in regular expressions, there is no backtracking in PEG.js expressions.

For example, using the input "hi!":


// This will fail
HI = "hi" / "hi!"

// This will pass
HI = "hi!" / "hi"

// This will also pass
HI = w:"hi" !"!" { return w } / "hi!"

For more information on backtracking in PEG.js, checkout this excellent answer on Stack Overflow.