Code

frontend: Let sdb_fe_parse() return a list of parsed node objects.
[sysdb.git] / src / frontend / scanner.l
index cd7ea8513109fd266437b10dfaf5a2428b55aec3..f300e46d73160d906f841dd3c421f125d3a93fcc 100644 (file)
@@ -27,6 +27,7 @@
 
 %{
 
+#include "frontend/connection.h"
 #include "frontend/parser.h"
 #include "frontend/grammar.h"
 #include "utils/error.h"
@@ -35,6 +36,8 @@
 
 #include <string.h>
 
+#define YY_EXTRA_TYPE sdb_fe_yyextra_t *
+
 void
 sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *msg);
 
@@ -94,7 +97,7 @@ identifier    ([A-Za-z_][A-Za-z_0-9$]*)
 %%
 
 sdb_fe_yyscan_t
-sdb_fe_scanner_init(const char *str)
+sdb_fe_scanner_init(const char *str, sdb_fe_yyextra_t *yyext)
 {
        yyscan_t scanner;
 
@@ -105,6 +108,8 @@ sdb_fe_scanner_init(const char *str)
                return NULL;
        }
 
+       sdb_fe_yyset_extra(yyext, scanner);
+
        /* the newly allocated buffer state (YY_BUFFER_STATE) is stored inside the
         * scanner and, thus, will be freed by yylex_destroy */
        yy_scan_string(str, scanner);