Can I make PEG.js return a default value instead of throwing a parse error?
basically I would like to have
/ anything:.* {return anything}
in my grammar, but if any rule partially mathes it will still throw a Parse error.
So
start
= digits:[0-9]+
/ anything:.* {return "hello world"+anything}
will still throw a parse error on "546aueu". Try at http://pegjs.org/online
how can I tell make a parser return something instead of throwing an error.
As far as i know it should try to match the first rule and if it fails it should match the secon.
Thans for any help and suggestions.