From 4176dea8503cc8eebfa24b14aaefc3a8dc643230 Mon Sep 17 00:00:00 2001 From: s-over-4 Date: Tue, 29 Aug 2023 10:17:27 -0400 Subject: g --- src/include/parser.h | 7 ++++--- src/include/tree.h | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/include') diff --git a/src/include/parser.h b/src/include/parser.h index 0ba2038..deb6c7c 100644 --- a/src/include/parser.h +++ b/src/include/parser.h @@ -4,6 +4,8 @@ #include "lexer.h" #include "tree.h" +#include + typedef struct PARSER_STRUC { lexer_t* lexer; // lexer used by the parser token_t* token; // current token @@ -12,9 +14,8 @@ typedef struct PARSER_STRUC { parser_t* parser_init(lexer_t* lexer); void parser_destroy(parser_t* parser); -// expect token, or die -void parser_token_expect(parser_t* parser, int token); -void parser_token_expectf(parser_t* parser, int (*expected_token)(token_t*)); +// expect token(s), or die +void parser_token_expect(parser_t* parser, int token, ...); // do the parse tree_t* parser_parse(parser_t* parser); diff --git a/src/include/tree.h b/src/include/tree.h index fde66ea..a2b71da 100644 --- a/src/include/tree.h +++ b/src/include/tree.h @@ -21,15 +21,17 @@ typedef struct TREE_STRUC { struct { // === DEFINITIONS === char* type; // the definition type char** tags; // the definition tags + size_t tags_size; // the number of tags char* name; // the definition name + struct TREE_STRUC** args; // the arguments the definition will accept + size_t args_size; // the number of arguments struct TREE_STRUC* value; // value of definition - // :D lines line up :D } def; struct { // === CALLS === char* target; // name of definition being called struct TREE_STRUC** args; // arguments passed to definition - size_t args_size; // size of arguments + size_t args_size; // the number of arguments } call; // === TYPES === -- cgit v1.2.3