]> git.lizzy.rs Git - nothing.git/blobdiff - src/script/parser.h
TODO(#330)
[nothing.git] / src / script / parser.h
index b94041420f35abed876bd15189d6d61b5d5ae57f..21247dae5757a019dac8a1f8e0c4a192557ef6fe 100644 (file)
@@ -4,27 +4,28 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include "script/expr.h"
+#include "script/tokenizer.h"
 
 struct ParseResult
 {
     bool is_error;
+    const char *end;
     union {
         struct Expr expr;
-        struct {
-            const char *error;
-            size_t error_cursor;
-        };
+        const char *error_message;
     };
 };
 
-struct ParseResult parse_success(struct Expr expr);
+struct ParseResult parse_success(struct Expr expr,
+                                 const char *end);
 struct ParseResult parse_failure(const char *error,
-                                 size_t error_cursor);
+                                 const char *end);
 
-struct ParseResult create_expr_from_str(const char *str,
-                                        size_t *cursor,
-                                        size_t n);
+struct ParseResult read_expr_from_string(Gc *gc, const char *str);
+struct ParseResult read_expr_from_file(Gc *gc, const char *filename);
 
-void print_parse_error(FILE *stream, const char *str, struct ParseResult result);
+void print_parse_error(FILE *stream,
+                       const char *str,
+                       struct ParseResult result);
 
 #endif  // PARSER_H_