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.
David Majda 86769a6c5c Error handling: Make |?| return |null| on unsuccessful match
Before this commit, the |?| operator returned an empty string upon
unsuccessful match. This commit changes the returned value to |null|. It
also updates the PEG.js grammar and the example grammars, which used the
value returned by |?| quite often.

Returning |null| is possible because it no longer indicates a match
failure.

I expect that this change will simplify many real-world grammars, as an
empty string is almost never desirable as a return value (except some
lexer-level rules) and it is often translated into |null| or some other
value in action code.

Implements part of #198.
11 years ago
..
generate-bytecode.js Error handling: Make |?| return |null| on unsuccessful match 11 years ago
generate-javascript.js Error handling: Use a special value (not |null|) to indicate failure 11 years ago
remove-proxy-rules.js Move options handling from passes to |PEG.compiler.compile| 11 years ago
report-left-recursion.js Make |GrammarError| require work also in the browser version 11 years ago
report-missing-rules.js Make |GrammarError| require work also in the browser version 11 years ago