From 3dbe235f65987ae2bb34c6859926f33791feab67 Mon Sep 17 00:00:00 2001 From: c Date: Tue, 13 Feb 2024 11:49:26 -0500 Subject: Definitions may now be parsed. --- src/include/parser.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/include') diff --git a/src/include/parser.h b/src/include/parser.h index 257189d..839e372 100644 --- a/src/include/parser.h +++ b/src/include/parser.h @@ -47,37 +47,41 @@ tree_t* parser_parse_init(parser_t* parser); /* Get tree for a block. */ tree_t* parser_parse_block(parser_t* parser); +/* Get tree for a keyword. */ tree_t* parser_parse_kwd(parser_t* parser); /* Get tree for an expression.*/ tree_t* parser_parse_expr(parser_t* parser); -/* - Check whether the current token matches the given type. - - If it doesn't, return 0 and throw error. -*/ -int parser_match(parser_t* parser, token_type_t type); - -/* Steps the parser forward by one token, then check whether the new token matches the given type. */ -int parser_nxt_token_match(parser_t* parser, token_type_t type); - /* Return the tree for an integer. */ tree_t* parser_parse_lint(parser_t* parser); /* Return the tree for a string. */ tree_t* parser_parse_lstr(parser_t* parser); -/* Return the tree for a definition's arguments. */ -tree_t* parser_parse_darg(parser_t* parser); +/* Return the tree for a call. */ +tree_t* parser_parse_call(parser_t* parser); + +/* Return the tree for a call's arguments. */ +tree_t* parser_parse_carg(parser_t* parser); /* Return the tree for a definition. */ tree_t* parser_parse_def(parser_t* parser); -/* Return the tree for a call's arguments. */ -tree_t* parser_parse_carg(parser_t* parser); +/* Return the tree for a definition tag. */ +tree_t* parser_parse_tag(parser_t* parser); -/* Return the tree for a call. */ -tree_t* parser_parse_call(parser_t* parser); +/* Return the tree for a definition's arguments. */ +tree_t* parser_parse_darg(parser_t* parser); + +/* + Check whether the current token matches the given type. + - If it doesn't, return 0 and throw error. +*/ +int parser_match(parser_t* parser, token_type_t type); + +/* Steps the parser forward by one token, then check whether the new token matches the given type. */ +int parser_nxt_token_match(parser_t* parser, token_type_t type); /* Parse. */ void parser_parse(parser_t* parser); -- cgit v1.2.3