X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matitaB%2Fmatita%2FmatitaScriptLexer.ml;h=205d14d578aa5fb3fc6d484cdc99a605f53d54ac;hb=dee464f8cd331524663167659d1fad01e558d4e1;hp=a7ce7142f8e8df3a0df306977bedc420cdeeb1d9;hpb=d83fa3d6e3604bcc596840219f3998d795630d66;p=helm.git diff --git a/matitaB/matita/matitaScriptLexer.ml b/matitaB/matita/matitaScriptLexer.ml index a7ce7142f..205d14d57 100644 --- a/matitaB/matita/matitaScriptLexer.ml +++ b/matitaB/matita/matitaScriptLexer.ml @@ -342,3 +342,35 @@ let get_hot_spots = in aux 0 (aux_basic None None None) let get_hot_spots s = get_hot_spots (Ulexing.from_utf8_string s) + +(*let xmarkup = "\005" +let ymarkup = "\006" +let regexp tag_cont = ident_letter | xml_digit | "_" | "-" +let regexp tagname = ident_letter tag_cont* +let regexp opentag = xmarkup tagname +let regexp closetag = xmarkup "/" tagname ymarkup +let regexp attribute = tagname "=" qstring + +let rec to_xy = + lexer + | closetag -> xmarkup ^ ymarkup ^ xmarkup ^ to_xy lexbuf + | opentag -> + let tag = + Ulexing.utf8_sub_lexeme lexbuf 1 + (Ulexing.lexeme_length lexbuf - 1) in + xmarkup ^ ymarkup ^ tag ^ to_xy_inner lexbuf + | eof -> "" + | _ -> let lexeme = Ulexing.utf8_lexeme lexbuf in + prerr_endline ("matched " ^ lexeme); lexeme ^ to_xy lexbuf + +and to_xy_inner = + lexer + | utf8_blank+ -> to_xy_inner lexbuf + | attribute -> let lexeme = Ulexing.utf8_lexeme lexbuf in + ymarkup ^ lexeme ^ to_xy_inner lexbuf + | ">" -> xmarkup ^ to_xy lexbuf + | eof -> "" + | _ -> to_xy lexbuf +;; + +let to_xy s = to_xy (Ulexing.from_utf8_string s)*)