index 0a7c7206d24a156bb1706003641fadc217076f84..2830663f03d8f13843eaa7543e1c18c50ebeccc5 100644 (file)
#ifndef SDB_PARSER_PARSER_H
#define SDB_PARSER_PARSER_H 1
-/* TODO: move SDB_PARSE_* constants here as well */
-#include "frontend/parser.h"
-
#include "core/store.h"
#include "parser/ast.h"
#include "utils/llist.h"
extern "C" {
#endif
+/* parser modes */
+enum {
+ /* parser accepts any command statement */
+ SDB_PARSE_DEFAULT = 0,
+
+ /* parser accepts any conditional statement */
+ SDB_PARSE_COND = 1 << 1,
+
+ /* parser accepts any arithmetic expression */
+ SDB_PARSE_ARITH = 1 << 2,
+};
+
/*
* sdb_parser_parse:
* Parse the specified query of the specified length. If len is a negative
int
sdb_parser_analyze(sdb_ast_node_t *node, sdb_strbuf_t *errbuf);
+/*
+ * sdb_parser_analyze_conditional:
+ * Semantical analysis of a conditional node.
+ *
+ * Returns:
+ * - 0 on success
+ * - a negative value else; an error message will be written to the provided
+ * error buffer
+ */
+int
+sdb_parser_analyze_conditional(sdb_ast_node_t *node, sdb_strbuf_t *errbuf);
+
+/*
+ * sdb_parser_analyze_arith:
+ * Semantical analysis of an arithmetic node.
+ *
+ * Returns:
+ * - 0 on success
+ * - a negative value else; an error message will be written to the provided
+ * error buffer
+ */
+int
+sdb_parser_analyze_arith(sdb_ast_node_t *node, sdb_strbuf_t *errbuf);
+
/*
* Low-level interface.
*/