X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fxpath_internal_parser.mly;h=fe38f67d41c342b450b09a5beae0eaaf96e47722;hp=04ecf369521831159d72a8125c3e12a609edd959;hb=97cc08246d4a73e9cc9070f645a351799b7340d1;hpb=30bc0bb1291426e5e26eb2dee1ffc41e4c246349 diff --git a/src/xpath/xpath_internal_parser.mly b/src/xpath/xpath_internal_parser.mly index 04ecf36..fe38f67 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 @@ -68,14 +68,14 @@ simple_path: absolute_path: SLASH relative_path { $2 } -| SLASHSLASH relative_path { (DescendantOrSelf, node, []) :: $2 } +| SLASHSLASH relative_path { $2 @ [(Descendant true, node, [])] } ; relative_path: step { [ $1 ] } | relative_path SLASH step { $3 :: $1 } | relative_path SLASHSLASH step { $3 - :: (DescendantOrSelf, node, []) + :: (Descendant true, node, []) :: $1 } ; @@ -84,7 +84,16 @@ step: ; axis_test: - AXIS COLONCOLON test { $1, $3 } + AXIS COLONCOLON test { let a, t = $1, $3 in + if a == Attribute && Utils.QNameSet.is_finite t then + (a, Utils.QNameSet.fold + (fun t a -> + Utils.QNameSet.add + (Utils.QName.add_attribute_prefix t) a) + t Utils.QNameSet.empty) + else + (a, t) + } | test { Child, $1 } | AXIS { let _ = Format.flush_str_formatter () in