X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fxpath%2Fxpath_internal_parser.mly;h=9830e76c5a07fedb7dccb5c68422c14ccd828284;hb=d0165b2cd48fb800c0e3bcacfc85e452233f4525;hp=72a07fb6b9a0afa417ad425cdb2f7bbf3a95863a;hpb=818d907b0cbcae06a07cc2ba7833a0917894d418;p=tatoo.git diff --git a/src/xpath/xpath_internal_parser.mly b/src/xpath/xpath_internal_parser.mly index 72a07fb..9830e76 100644 --- a/src/xpath/xpath_internal_parser.mly +++ b/src/xpath/xpath_internal_parser.mly @@ -15,7 +15,7 @@ (***********************************************************************) (* - Time-stamp: + Time-stamp: *) open Ast @@ -30,7 +30,7 @@ %token FLOAT %token AXIS %token RB LB LP RP -%token SLASH SLASHSLASH COLONCOLON STAR PIPE +%token SLASH SLASHSLASH COLONCOLON STAR PIPE DOT DOTDOT %token EQ NEQ LT GT LTE GTE OR AND ADD SUB DIV MOD %token NODE TEXT COMMENT %token COMMA @@ -91,7 +91,9 @@ relative_path: ; step: - axis_test pred_list { + DOT { [ (Self, (node, NodeKind.Node), []) ] } +| DOTDOT { [ (Parent, (node, NodeKind.Node), []) ] } +| axis_test pred_list { match $1 with (a,b) :: r -> (a,b,$2) :: (List.map (fun (a,b) -> (a,b,[])) r) | [] -> assert false @@ -136,10 +138,11 @@ test: | COMMENT { Utils.QNameSet.singleton(Utils.QName.comment), NodeKind.Comment } -| PI { Utils.QNameSet.singleton( - Utils.QName.processing_instruction ( - Utils.QName.of_string $1) - ), NodeKind.ProcessingInstruction +| PI { (if $1 = "" then star + else Utils.QNameSet.singleton( + Utils.QName.processing_instruction ( + Utils.QName.of_string $1) + )), NodeKind.ProcessingInstruction } | TAG { Utils.QNameSet.singleton(Utils.QName.of_string $1), NodeKind.Element