X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fxpath_internal_parser.mly;h=6395b6e38b1e366473b13d9d04f1ef33d8e94e33;hp=9830e76c5a07fedb7dccb5c68422c14ccd828284;hb=fe2ba1820282783ae8c10fbbbd2b65d3dc4c67f2;hpb=58417b0684f351a8a24e4e3ad54bde715036209d diff --git a/src/xpath/xpath_internal_parser.mly b/src/xpath/xpath_internal_parser.mly index 9830e76..6395b6e 100644 --- a/src/xpath/xpath_internal_parser.mly +++ b/src/xpath/xpath_internal_parser.mly @@ -14,12 +14,8 @@ (* *) (***********************************************************************) -(* - Time-stamp: -*) - open Ast - open Tree.Common + open Tree %} %token TAG @@ -103,12 +99,7 @@ step: axis_test: AXIS COLONCOLON test { let a, (t,k) = $1, $3 in match a with - Attribute when Utils.QNameSet.is_finite t -> - [ a, ((Utils.QNameSet.fold - (fun t a -> - Utils.QNameSet.add - (Utils.QName.attribute t) a) - t Utils.QNameSet.empty), k) ] + | Attribute -> [ a, (t, NodeKind.Attribute) ] | Preceding|Following -> [ (Descendant true, (t,k)); if a == Preceding then @@ -124,27 +115,26 @@ axis_test: let _ = Format.flush_str_formatter () in let () = Format.fprintf Format.str_formatter "%a" Ast.print_axis $1 in let a = Format.flush_str_formatter () in - [Child, (Utils.QNameSet.singleton (Utils.QName.of_string a),NodeKind.Element)] + [Child, (QNameSet.singleton (QName.of_string a),NodeKind.Element)] } | ATTNAME { [(Attribute, - (Utils.QNameSet.singleton (Utils.QName.of_string $1), + (QNameSet.singleton (QName.of_string $1), NodeKind.Attribute))] } ; test: NODE { node, NodeKind.Node } | TEXT { text, NodeKind.Text } -| STAR { star, NodeKind.Element } -| COMMENT { Utils.QNameSet.singleton(Utils.QName.comment), +| STAR { node, NodeKind.Element } +| COMMENT { QNameSet.singleton(QName.comment), NodeKind.Comment } | PI { (if $1 = "" then star - else Utils.QNameSet.singleton( - Utils.QName.processing_instruction ( - Utils.QName.of_string $1) + else QNameSet.singleton( + QName.of_string $1 )), NodeKind.ProcessingInstruction } -| TAG { Utils.QNameSet.singleton(Utils.QName.of_string $1), +| TAG { QNameSet.singleton(QName.of_string $1), NodeKind.Element } ; @@ -176,7 +166,7 @@ expr: | expr LTE expr { Binop($1, Lte, $3) } | expr GT expr { Binop($1, Gt, $3) } | expr GTE expr { Binop($1, Gte, $3) } -| TAG LP arg_list RP { Fun_call(Utils.QName.of_string $1, $3) } +| TAG LP arg_list RP { Fun_call(QName.of_string $1, $3) } | LP expr RP { $2 } | path { Path $1 } ;