Code

grammar.y: Added some (very) short documentation for each statement.
[sysdb.git] / src / frontend / scanner.l
index 948b6badf155e848c5182ad1ca38f8004a49eb3f..c0d167c00c0df1da371d8762098acd57c7ce5abc 100644 (file)
 
 %{
 
+#if HAVE_CONFIG_H
+#      include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include "frontend/connection.h"
 #include "frontend/parser.h"
 #include "frontend/grammar.h"
@@ -70,6 +74,8 @@ csc_inside    ([^*/]+|[^*]\/|\*[^/])
 csc_end                \*\/
 
 identifier     ([A-Za-z_][A-Za-z_0-9$]*)
+/* TODO: fully support SQL strings */
+string         ('[^']*')
 
 %%
 
@@ -88,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 */ }