From 06fcbfd8d3f1c1cd0ae76d726778cebc3bcde9bd Mon Sep 17 00:00:00 2001 From: Sergio Queiroz Date: Fri, 27 May 2016 15:00:23 -0300 Subject: Fixing a bug reported by Matthew Allen. Result of p = m.Lc(m.P"A", m.P(true), 1) + m.P("B") was "nil" instead of "2" --- lpcode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lpcode.c') diff --git a/lpcode.c b/lpcode.c index 1ee6ed1..70a8d3c 100644 --- a/lpcode.c +++ b/lpcode.c @@ -192,10 +192,13 @@ int checkaux (TTree *tree, int pred) { if (!checkaux(sib1(tree), pred)) return 0; /* else return checkaux(sib2(tree), pred); */ tree = sib2(tree); goto tailcall; - case TChoice: case TLabChoice: /* labeled failure */ + case TChoice: if (checkaux(sib2(tree), pred)) return 1; /* else return checkaux(sib1(tree), pred); */ tree = sib1(tree); goto tailcall; + case TLabChoice: /* labeled failure */ + /* in a labeled ordered choice we do not know whether sib2 will be evaluated */ + tree = sib1(tree); goto tailcall; case TCapture: case TGrammar: case TRule: /* return checkaux(sib1(tree), pred); */ tree = sib1(tree); goto tailcall; -- cgit v1.2.3-55-g6feb