From 7b301fce8e4d0e3bf9e3e80e8c4a8e412cc459d3 Mon Sep 17 00:00:00 2001 From: wesuRage Date: Sat, 14 Dec 2024 23:02:22 -0300 Subject: [PATCH] feat(rename): renamed functions for better reading --- include/frontend/parser/core.h | 6 +++--- src/frontend/parser/parser.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/frontend/parser/core.h b/include/frontend/parser/core.h index 049b3ac..788523a 100644 --- a/include/frontend/parser/core.h +++ b/include/frontend/parser/core.h @@ -17,9 +17,9 @@ typedef struct { Parser parser_new(); bool not_eof(Parser *parser); -Token at(Parser *parser); -Token eat(Parser *parser); -Token next(Parser *parser); +Token current_token(Parser *parser); +Token consume_token(Parser *parser); +Token next_token(Parser *parser); Token expect(Parser *parser, TokenType expected_type, const char *err); void error(Parser *parser, const char *message); AstNode *produce_ast(Parser *parser, Token *tokens, int token_count); diff --git a/src/frontend/parser/parser.c b/src/frontend/parser/parser.c index c878028..bac0a65 100644 --- a/src/frontend/parser/parser.c +++ b/src/frontend/parser/parser.c @@ -99,7 +99,7 @@ bool not_eof(Parser *parser) { * @param parser The parser instance. * @return The current token. */ -Token at(Parser *parser) { +Token current_token(Parser *parser) { return parser->tokens[parser->index]; } @@ -112,7 +112,7 @@ Token at(Parser *parser) { * @param parser The parser instance. * @return The current token before advancing. */ -Token eat(Parser *parser) { +Token consume_token(Parser *parser) { return parser->tokens[parser->index++]; } @@ -125,7 +125,7 @@ Token eat(Parser *parser) { * @param parser The parser instance. * @return The next token in the stream. */ -Token next(Parser *parser) { +Token next_token(Parser *parser) { if (parser->index + 1 >= parser->token_count) { return current_token(parser); }