]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/matitaScriptLexer.ml
1) Matitaweb now disambiguates scripts as it runs them
[helm.git] / matitaB / matita / matitaScriptLexer.ml
index a7ce7142f8e8df3a0df306977bedc420cdeeb1d9..205d14d578aa5fb3fc6d484cdc99a605f53d54ac 100644 (file)
@@ -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)*)