index ba5d3b1b57313ca5e1e88cacd1e059e6f127a4f7..1404690a1256354f078ab87f863e516d57ff270e 100644 (file)
* find queries (terminated by semicolon).
*/
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif /* HAVE_CONFIG_H */
+
#include "tools/sysdb/input.h"
#include <string.h>
# undef YY_INPUT
#endif
#define YY_INPUT(buf, result, max_size) \
- sdb_input_readline((buf), &(result), (max_size))
+ sdb_input_readline((buf), (size_t *)&(result), (max_size))
#define APPEND() \
do { \
%x CSC
-whitespace ([ \t\n\r\f]+)
+newline ([\n\r]+)
simple_comment ("--"[^\n\r]*)
/*
csc_inside ([^*/]+|[^*]\/|\*[^/])
csc_end \*\/
-identifier ([A-Za-z_][A-Za-z_0-9$]*)
+/*
+ * Strings.
+ */
+/* TODO: fully support SQL strings */
+string ('([^']|'')*')
%%
-{whitespace} { APPEND(); }
+ /*
+ * Here, we only care about syntax elements that may include semicolons
+ * and escape their meaning as a query terminator.
+ */
+
{simple_comment} { APPEND(); }
{csc_start} { APPEND(); BEGIN(CSC); }
<CSC>{csc_end} { APPEND(); BEGIN(INITIAL); }
<CSC><<EOF>> { return -1; }
-{identifier} { APPEND(); }
+{string} { APPEND(); }
/*
* The following rules are specific to the command line tool.
*/
-";" { APPEND(); sdb_input_exec_query(); }
+";" { APPEND(); sdb_input_exec_query(); }
-. { APPEND(); }
+. { APPEND(); }
+{newline} { APPEND(); }
%%