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); }