X* Methods

33 views
Skip to first unread message

Cecil Phillip

unread,
May 23, 2013, 8:39:48 AM5/23/13
to sprache...@googlegroups.com
What's the difference between the X* methods and the non X* methods? For instance XMany vs Many?


nblum...@nblumhardt.com

unread,
May 26, 2013, 7:13:40 AM5/26/13
to sprache...@googlegroups.com
Hi Cecil - IIRC the X indicates eXclusive: if the parser starts parsing an element (or an option in the case of XOr) and succeeds, it will not backtrack to try alternatives on failure. This improves error message quality.

E.g. if I have a grammar AB | C, the using XOr to parse broken input "AD" will give an error on the D, stating that B was expected, instead of backtracking to try C and then failing with the error message that A was found but C was expected.

HTH!

Nick
Reply all
Reply to author
Forward
0 new messages