X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbin%2Fxhtbl%2FtextLexer.mll;fp=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbin%2Fxhtbl%2FtextLexer.mll;h=4b06e4c402f61044f1f17a99c2713e41fa1e45c2;hb=d2545ffd201b1aa49887313791386add78fa8603;hp=0000000000000000000000000000000000000000;hpb=57ae1762497a5f3ea75740e2908e04adb8642cc2;p=helm.git diff --git a/matita/matita/contribs/lambdadelta/bin/xhtbl/textLexer.mll b/matita/matita/contribs/lambdadelta/bin/xhtbl/textLexer.mll new file mode 100644 index 000000000..4b06e4c40 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/bin/xhtbl/textLexer.mll @@ -0,0 +1,47 @@ +{ + module S = String + + module O = Options + module TP = TextParser + + let out s = if !O.debug_lexer then prerr_endline s +} + +let SPC = ['\r' '\n' '\t' ' ']+ +let QT = "\"" +let NUM = ['0'-'9']+ + +rule token = parse + | SPC { token lexbuf } + | QT { let s = str lexbuf in + out s; TP.TEXT s } + | NUM as s { out s; TP.NUM (int_of_string s) } + | "(*" { block lexbuf; token lexbuf } + | "{" { out "{"; TP.OC } + | "}" { out "}"; TP.CC } + | "[" { out "["; TP.OB } + | "]" { out "]"; TP.CB } + | "*" { out "*"; TP.SR } + | "^" { out "^"; TP.CF } + | "+" { out "+"; TP.PS } + | "(" { out "("; TP.OP } + | ")" { out ")"; TP.CP } + | "@" { out ")"; TP.AT } + | "space" { out "space"; TP.SPACE } + | "name" { out "name"; TP.NAME } + | "table" { out "table"; TP.TABLE } + | "class" { out "class"; TP.CSS } + | "uri" { out "uri"; TP.URI } + | "ext" { out "ext"; TP.EXT } + | eof { TP.EOF } +and str = parse + | QT { "" } + | "\\\\" { "\\" ^ str lexbuf } + | "\\\"" { "\"" ^ str lexbuf } + | _ as c { S.make 1 c ^ str lexbuf } +and block = parse + | "*)" { () } + | "(*" { block lexbuf; block lexbuf } + | QT { let _ = str lexbuf in + block lexbuf } + | _ { block lexbuf }