(* -*- sml -*- *) open Tokens LexUtils val eof = make_eof EOF type lexresult = (svalue, pos) token type arg = lexresult arg %% %header (functor MetaLexFun(Tokens: Meta_TOKENS)); %arg ({push,dump,inc,dec,pos,<<,<<$,...}); %s PROC TRACE STR COMMENT; %% " (<" (<" (<" (<" (<" (<" (<" (<" (<" (<" (<" (<" (<[^<]+ => (push yytext; <<$(dump()) "text" TEXT); "<" => (push yytext; continue()); "?>" => (<"?>\n" => (<[^\?]+ => (push yytext; <<$(dump()) "c0" CODE); "?" => (push yytext; continue()); "\"" => (<<$(dump()) "str" STRING before YYBEGIN TRACE); "\\\"" => (push yytext; continue()); (.|\n) => (push yytext; continue()); "?>" => (<"?>\n" => (<"(*" => (YYBEGIN COMMENT; continue()); "\"" => (YYBEGIN STR; continue()); ".<" => (<">." => (<"(" => (<")" => (<"{" => (<"}" => (<"[" => (<"]" => (<"let" => (<"in" => (<";" => (<"," => (<"=" => (<[ \t\n]+ => (<<$yytext "c1" CODE); [A-Za-z_']+ => (<<$yytext "c2" CODE); . => (<<$yytext "c3" CODE); "*)" => (YYBEGIN TRACE; continue()); "\n" => (continue()); . => (continue()); . => (print ("\n"^pos2str(pos())^": Error: unrecognized character #\""^ Char.toString (String.sub(yytext,0))^"\"\n"); raise LexError);