From ecf560c2b814bd8be89e5259f2e9a6b3b30d6f45 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Wed, 8 Jun 2022 08:42:55 +0500 Subject: [PATCH] end -> newline --- config.c | 4 ++-- lexer.c | 10 +++++----- lexer.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.c b/config.c index d6504a5..5731713 100644 --- a/config.c +++ b/config.c @@ -162,12 +162,12 @@ static int command(void) static int commands(void) { - accept(TOK_END); + accept(TOK_NEW_LN); while (1) { CHECK_NULL(accept(TOK_EOF)); CHECK_OK(command()); - CHECK_OK_NULL(accept(TOK_END)); + CHECK_OK_NULL(accept(TOK_NEW_LN)); } } diff --git a/lexer.c b/lexer.c index 6ac2720..245fe54 100644 --- a/lexer.c +++ b/lexer.c @@ -222,13 +222,13 @@ static inline Token get_tok(Lexer *ctx, enum TokenType type) .col = ctx->tok_pos.col }; } -static inline Token read_end(Lexer *ctx) +static inline Token read_new_line(Lexer *ctx) { Token tok = get_tok(ctx, TOK_NULL); while (peek_char(ctx) == '\n') { next_char(ctx); - tok.type = TOK_END; + tok.type = TOK_NEW_LN; } return tok; @@ -364,7 +364,7 @@ Token lexer_get_token(Lexer *ctx) ATTEMPT_READ_CHAR(ctx, tok, '*', TOK_STAR); ATTEMPT_READ_CHAR(ctx, tok, '.', TOK_DOT); - ATTEMPT_READ(ctx, read_end); + ATTEMPT_READ(ctx, read_new_line); ATTEMPT_READ(ctx, read_symbol); ATTEMPT_READ(ctx, read_digit); ATTEMPT_READ(ctx, read_block); @@ -390,8 +390,8 @@ char *lexer_token_type_str(enum TokenType type) return ""; case TOK_ERR: return ""; - case TOK_END: - return ""; + case TOK_NEW_LN: + return ""; case TOK_BLK_OPEN: return block_open; case TOK_BLK_CLS: diff --git a/lexer.h b/lexer.h index 8c58700..08a6a17 100644 --- a/lexer.h +++ b/lexer.h @@ -11,12 +11,12 @@ typedef struct Lexer Lexer; typedef struct { - int line, col; + unsigned int line, col; enum TokenType { TOK_NULL, TOK_EOF, TOK_ERR, - TOK_END, + TOK_NEW_LN, TOK_BLK_OPEN, TOK_BLK_CLS, TOK_SLASH,