X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/db427c6775f4d2babcabadbbea93117f593259c6..234b917a6149413bbbeab7dccfaeab5f16e43fe1:/src/domtool.lex diff --git a/src/domtool.lex b/src/domtool.lex index 5130ad9..66d0185 100644 --- a/src/domtool.lex +++ b/src/domtool.lex @@ -54,7 +54,7 @@ val strStart = ref 0 %% %header (functor DomtoolLexFn(structure Tokens : Domtool_TOKENS)); %full -%s COMMENT STRING; +%s COMMENT STRING DOC; id = [a-z_][A-Za-z0-9_]*; cid = [A-Z][A-Za-z0-9_]*; @@ -92,6 +92,14 @@ lineComment = #[^\n]*\n; str := #"\n" :: !str; continue()); . => (str := String.sub (yytext, 0) :: !str; continue()); + "{{" => (YYBEGIN DOC; strStart := yypos; str := []; continue()); + "}}" => (YYBEGIN INITIAL; + Tokens.DOC (String.implode (List.rev (!str)), !strStart, yypos + 1)); + "\n" => (lineNum := !lineNum + 1; + linePos := yypos :: ! linePos; + str := #"\n" :: !str; continue()); + . => (str := String.sub (yytext, 0) :: !str; continue()); + "(" => (Tokens.LPAREN (yypos, yypos + size yytext)); ")" => (Tokens.RPAREN (yypos, yypos + size yytext)); @@ -117,6 +125,11 @@ lineComment = #[^\n]*\n; "let" => (Tokens.LET (yypos, yypos + size yytext)); "in" => (Tokens.IN (yypos, yypos + size yytext)); "end" => (Tokens.END (yypos, yypos + size yytext)); + "with" => (Tokens.WITH (yypos, yypos + size yytext)); + + "extern" => (Tokens.EXTERN (yypos, yypos + size yytext)); + "type" => (Tokens.TYPE (yypos, yypos + size yytext)); + "val" => (Tokens.VAL (yypos, yypos + size yytext)); "Root" => (Tokens.ROOT (yypos, yypos + size yytext));