X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fxpath_internal_parser.mly;h=3651d2cd9e547a0e2ff239bdcbe61c40f64da233;hp=a05beb28a91d55310da1a1877902fd3671cfcf64;hb=238dc42c2cb6324b103585556c3f5f9150ee221e;hpb=e13f5deae217f945b44fa345ef4f0008e1780787 diff --git a/src/xpath/xpath_internal_parser.mly b/src/xpath/xpath_internal_parser.mly index a05beb2..3651d2c 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 @@ -23,6 +23,7 @@ %} %token TAG +%token ATTNAME %token STRING %token INT %token FLOAT @@ -68,7 +69,7 @@ simple_path: absolute_path: SLASH relative_path { $2 } -| SLASHSLASH relative_path { (Descendant true, node, []) :: $2 } +| SLASHSLASH relative_path { $2 @ [(Descendant true, node, [])] } ; relative_path: @@ -84,7 +85,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 @@ -92,6 +102,8 @@ axis_test: let a = Format.flush_str_formatter () in Child, Utils.QNameSet.singleton (Utils.QName.of_string a) } +| ATTNAME { (Attribute, + Utils.QNameSet.singleton (Utils.QName.of_string $1)) } ; test: @@ -142,4 +154,3 @@ arg_list1: expr { [ $1 ] } | arg_list1 COMMA expr { $3 :: $1 } ; -