From b3ffc28cc73d5536deeef0408041b14786a9c63b Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 17 Jun 2014 20:09:44 +0200 Subject: [PATCH] Removed shift/reduce conflict in the xpath parser. --- lib/oga/xpath/parser.y | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/oga/xpath/parser.y b/lib/oga/xpath/parser.y index eb66f90..1f3956b 100644 --- a/lib/oga/xpath/parser.y +++ b/lib/oga/xpath/parser.y @@ -16,9 +16,13 @@ preclow rule xpath + : paths { val[0] } + | /* none */ { nil } + ; + + paths : T_SLASH path { s(:absolute, val[1]) } | path { val[0] } - | /* none */ { nil } ; path @@ -49,7 +53,7 @@ rule ; predicate - : T_LBRACK xpath T_RBRACK { val[1] } + : T_LBRACK paths T_RBRACK { val[1] } ; operator @@ -68,8 +72,8 @@ rule ; call_args - : xpath { val } - | xpath T_COMMA call_args { [val[0], *val[2]] } + : paths { val } + | paths T_COMMA call_args { [val[0], *val[2]] } ; string