X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fxpath%2Fulexer.ml;h=02b6e02055cc5a9aa620dc56c1dff520895bb564;hp=aa66179b20e2bdb23b30a3e874660f59634b001c;hb=fe2ba1820282783ae8c10fbbbd2b65d3dc4c67f2;hpb=30bc0bb1291426e5e26eb2dee1ffc41e4c246349 diff --git a/src/xpath/ulexer.ml b/src/xpath/ulexer.ml index aa66179..02b6e02 100644 --- a/src/xpath/ulexer.ml +++ b/src/xpath/ulexer.ml @@ -13,10 +13,6 @@ (* *) (***********************************************************************) -(* - Time-stamp: -*) - open Xpath_internal_parser module L = Ulexing @@ -54,7 +50,7 @@ let return lexbuf tok = (tok, L.loc lexbuf) let return_loc i j tok = (tok, (i,j)) let regexp ncname_char = - xml_letter | xml_digit | [ '-' '_' ] | xml_combining_char | xml_extender | "\\." + xml_letter | xml_digit | [ '-' '_' '.'] | xml_combining_char | xml_extender let hexa_digit = function | '0'..'9' as c -> (Char.code c) - (Char.code '0') @@ -81,15 +77,15 @@ let keyword_or_tag s = try List.assoc s [ "self", AXIS Ast.Self; - "descendant", AXIS Ast.Descendant; + "descendant", AXIS (Ast.Descendant false); "child", AXIS Ast.Child; - "descendant-or-self", AXIS Ast.DescendantOrSelf; + "descendant-or-self", AXIS (Ast.Descendant true); "attribute", AXIS Ast.Attribute; "following-sibling", AXIS Ast.FollowingSibling; "preceding-sibling", AXIS Ast.PrecedingSibling; "parent", AXIS Ast.Parent; - "ancestor", AXIS Ast.Ancestor; - "ancestor-or-self", AXIS Ast.AncestorOrSelf; + "ancestor", AXIS (Ast.Ancestor false); + "ancestor-or-self", AXIS (Ast.Ancestor true); "preceding", AXIS Ast.Preceding; "following", AXIS Ast.Following; "and", AND; @@ -121,8 +117,18 @@ let rec token = lexer | ">=" -> GTE | "=" -> EQ | "!=" -> NEQ + | ".." -> DOTDOT + | "." -> DOT | "node()" -> NODE | "text()" -> TEXT + | "comment()" -> COMMENT + | '@' ncname -> let l = L.utf8_lexeme lexbuf in + ATTNAME (String.sub l 1 (String.length l - 1)) + | "processing-instruction()" -> PI "" + | "processing-instruction('"ncname"')" + | "processing-instruction(\""ncname"\")"-> + let s = L.utf8_lexeme lexbuf in + PI (String.sub s 24 (String.length s - 26)) | ncname -> keyword_or_tag (L.utf8_lexeme lexbuf) | float -> let s = L.utf8_lexeme lexbuf in @@ -165,5 +171,3 @@ and string start double = lexer | _ -> store_lexeme lexbuf; string start double lexbuf - -