X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/a22c187b7b983dad6b0e2c34cd0ab74e95c2411b..1a4e5a6c9a8fbbdc980cf0661c444ddc2910544a:/src/domtool.lex diff --git a/src/domtool.lex b/src/domtool.lex index 765a6ab..6bf3475 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)); @@ -103,6 +111,7 @@ lineComment = #[^\n]*\n; "->" => (Tokens.ARROW (yypos, yypos + size yytext)); "=>" => (Tokens.DARROW (yypos, yypos + size yytext)); + "<-" => (Tokens.LARROW (yypos, yypos + size yytext)); "=" => (Tokens.EQ (yypos, yypos + size yytext)); "," => (Tokens.COMMA (yypos, yypos + size yytext)); @@ -116,6 +125,12 @@ 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)); + "where" => (Tokens.WHERE (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));