Code

frontend: Added basic support for semantic AST analysis.
[sysdb.git] / src / include / frontend / parser.h
index d2dfb01f723985d54cf03866740db3479bbec448..e1c9c6fa81e5d3b4e2b6eef91d14b8ed0fc3b3f9 100644 (file)
@@ -29,6 +29,7 @@
 #define SDB_FRONTEND_PARSER_H 1
 
 #include "core/store.h"
+#include "frontend/connection.h"
 #include "utils/llist.h"
 
 #ifdef __cplusplus
@@ -38,8 +39,8 @@ extern "C" {
 /* parser modes */
 enum {
        SDB_PARSE_DEFAULT = 0,
-       SDB_PARSE_COND,
-       SDB_PARSE_EXPR,
+       SDB_PARSE_COND    = 1 << 1,
+       SDB_PARSE_EXPR    = 1 << 2,
 };
 
 /* YY_EXTRA data */
@@ -69,6 +70,17 @@ sdb_fe_parse_matcher(const char *cond, int len);
 sdb_store_expr_t *
 sdb_fe_parse_expr(const char *expr, int len);
 
+/*
+ * sdb_fe_analyze:
+ * Analyze a parsed node, checking for semantical errors.
+ *
+ * Returns:
+ *  - 0 if the node is semantically correct
+ *  - a negative value else
+ */
+int
+sdb_fe_analyze(sdb_conn_node_t *node);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif