diff options
author | 2008-08-21 15:27:04 -0400 | |
---|---|---|
committer | 2008-08-21 15:27:04 -0400 | |
commit | 7a98ce3ccaa8e808bcbfc166eda9c9350776fabd (patch) | |
tree | 4acd04558981e546c6623e1199442683eb273eba /src/lacweb.lex | |
parent | a2e5705c43f9705768652845b30fc3605cbb4873 (diff) |
Relational operators; string literals for SQL
Diffstat (limited to 'src/lacweb.lex')
-rw-r--r-- | src/lacweb.lex | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/lacweb.lex b/src/lacweb.lex index 5c8b9d11..cd4e75f4 100644 --- a/src/lacweb.lex +++ b/src/lacweb.lex @@ -59,6 +59,7 @@ in end end +val strEnder = ref #"\"" val str = ref ([] : char list) val strStart = ref 0 @@ -141,16 +142,25 @@ notags = [^<{\n]+; <COMMENT> "*)" => (if exitComment () then YYBEGIN INITIAL else (); continue ()); -<INITIAL> "\"" => (YYBEGIN STRING; strStart := pos yypos; str := []; continue()); +<INITIAL> "\"" => (YYBEGIN STRING; strEnder := #"\""; strStart := pos yypos; str := []; continue()); +<INITIAL> "'" => (YYBEGIN STRING; strEnder := #"'"; strStart := pos yypos; str := []; continue()); <STRING> "\\\"" => (str := #"\"" :: !str; continue()); -<STRING> "\"" => (if !xmlString then - (xmlString := false; YYBEGIN XMLTAG) - else - YYBEGIN INITIAL; - Tokens.STRING (String.implode (List.rev (!str)), !strStart, pos yypos + 1)); +<STRING> "\\'" => (str := #"'" :: !str; continue()); <STRING> "\n" => (newline yypos; str := #"\n" :: !str; continue()); -<STRING> . => (str := String.sub (yytext, 0) :: !str; continue()); +<STRING> . => (let + val ch = String.sub (yytext, 0) + in + if ch = !strEnder then + (if !xmlString then + (xmlString := false; YYBEGIN XMLTAG) + else + YYBEGIN INITIAL; + Tokens.STRING (String.implode (List.rev (!str)), !strStart, pos yypos + 1)) + else + (str := ch :: !str; + continue ()) + end); <INITIAL> "<" {id} ">"=> (let val tag = String.substring (yytext, 1, size yytext - 2) @@ -299,6 +309,10 @@ notags = [^<{\n]+; <INITIAL> "BY" => (Tokens.BY (pos yypos, pos yypos + size yytext)); <INITIAL> "HAVING" => (Tokens.HAVING (pos yypos, pos yypos + size yytext)); +<INITIAL> "UNION" => (Tokens.UNION (pos yypos, pos yypos + size yytext)); +<INITIAL> "INTERSECT" => (Tokens.INTERSECT (pos yypos, pos yypos + size yytext)); +<INITIAL> "EXCEPT" => (Tokens.EXCEPT (pos yypos, pos yypos + size yytext)); + <INITIAL> "TRUE" => (Tokens.TRUE (pos yypos, pos yypos + size yytext)); <INITIAL> "FALSE" => (Tokens.FALSE (pos yypos, pos yypos + size yytext)); <INITIAL> "AND" => (Tokens.CAND (pos yypos, pos yypos + size yytext)); |