X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fwww%2Flambdadelta%2Fbin%2Fxhtbl%2FtextLexer.mll;h=0f61349c370398241db06b174427f847d347a51a;hb=5cdcab1eddf82a94fc9911cbadb1132ffc8ae4b6;hp=7557e7bb80f5ee317f34a18620fabc67b19bb697;hpb=2a5e0b799cd6aae5d920c67a5ddc9d9888cf7e80;p=helm.git diff --git a/helm/www/lambdadelta/bin/xhtbl/textLexer.mll b/helm/www/lambdadelta/bin/xhtbl/textLexer.mll index 7557e7bb8..0f61349c3 100644 --- a/helm/www/lambdadelta/bin/xhtbl/textLexer.mll +++ b/helm/www/lambdadelta/bin/xhtbl/textLexer.mll @@ -1,21 +1,20 @@ { module S = String + module O = Options module TP = TextParser - let trim s = S.sub s 1 (S.length s - 2) - let out s = if !O.debug_lexer then prerr_endline s } let SPC = ['\r' '\n' '\t' ' ']+ -let QT = '"' -let STR = QT [^'"']* QT +let QT = "\"" let NUM = ['0'-'9']+ rule token = parse | SPC { token lexbuf } - | STR as s { out s; TP.TEXT (trim s) } + | QT { let s = str lexbuf in + out s; TP.TEXT s } | NUM as s { out s; TP.NUM (int_of_string s) } | "{" { out "{"; TP.OC } | "}" { out "}"; TP.CC } @@ -28,8 +27,13 @@ rule token = parse | "class" { out "class"; TP.CSS } | "(*" { block lexbuf; token lexbuf } | eof { TP.EOF } +and str = parse + | QT { "" } + | "\\\"" { "\"" ^ str lexbuf } + | _ as c { S.make 1 c ^ str lexbuf } and block = parse | "*)" { () } | "(*" { block lexbuf; block lexbuf } - | STR { block lexbuf } + | QT { let _ = str lexbuf in + block lexbuf } | _ { block lexbuf }