diff --git a/src/frontend/scanner.l b/src/frontend/scanner.l
index 87367f6e4324886fa0e2b0aa93a457c918326b68..dd2a86cf5273b4e5e3c450c02306820b282a1a46 100644 (file)
--- a/src/frontend/scanner.l
+++ b/src/frontend/scanner.l
csc_end \*\/
identifier ([A-Za-z_][A-Za-z_0-9$]*)
csc_end \*\/
identifier ([A-Za-z_][A-Za-z_0-9$]*)
+/* TODO: fully support SQL strings */
+string ('[^']*')
%%
%%
}
{identifier} {
}
{identifier} {
- /* XXX */
- if (! strcasecmp(yytext, "LIST"))
+ /* XXX: simplify handling of reserved words */
+ if (! strcasecmp(yytext, "AND"))
+ return AND;
+ else if (! strcasecmp(yytext, "FETCH"))
+ return FETCH;
+ else if (! strcasecmp(yytext, "LIST"))
return LIST;
return LIST;
+ else if (! strcasecmp(yytext, "LOOKUP"))
+ return LOOKUP;
+ else if (! strcasecmp(yytext, "NOT"))
+ return NOT;
+ else if (! strcasecmp(yytext, "OR"))
+ return OR;
+ else if (! strcasecmp(yytext, "WHERE"))
+ return WHERE;
yylval->str = strdup(yytext);
return IDENTIFIER;
}
yylval->str = strdup(yytext);
return IDENTIFIER;
}
+{string} {
+ yytext[yyleng - 1] = '\0';
+ yylval->str = strdup(yytext + 1);
+ return STRING;
+ }
+
+= { return CMP_EQUAL; }
+!= { return CMP_NEQUAL; }
+=~ { return CMP_REGEX; }
+!~ { return CMP_NREGEX; }
-. { /* do nothing for now */ }
+. { /* XXX: */ return yytext[0]; }
%%
%%