Code

frontend: Require strings instead of identifiers.
[sysdb.git] / src / frontend / scanner.l
index 6c2bfa148fd802ff4365187015d7636895af86bf..c0d167c00c0df1da371d8762098acd57c7ce5abc 100644 (file)
@@ -74,6 +74,8 @@ csc_inside    ([^*/]+|[^*]\/|\*[^/])
 csc_end                \*\/
 
 identifier     ([A-Za-z_][A-Za-z_0-9$]*)
+/* TODO: fully support SQL strings */
+string         ('[^']*')
 
 %%
 
@@ -92,9 +94,17 @@ identifier   ([A-Za-z_][A-Za-z_0-9$]*)
                /* XXX */
                if (! strcasecmp(yytext, "LIST"))
                        return LIST;
+               else if (! strcasecmp(yytext, "FETCH"))
+                       return FETCH;
 
+               yylval->str = strdup(yytext);
                return IDENTIFIER;
        }
+{string} {
+               yytext[yyleng - 1] = '\0';
+               yylval->str = strdup(yytext + 1);
+               return STRING;
+       }
 
 .      { /* do nothing for now */ }