Skip to content

Commit 4892ac7

Browse files
committed
Change missing TokenTypes to correct prefix
For some reason the last two tokens still contained "TOKEN" instead of "TOK". This is obviously inconsistent.
1 parent 3c74508 commit 4892ac7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lexer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ void next_token(struct Lexer* const lexer) {
140140
next = new_token(TOK_OPEN_CURLY);
141141
break;
142142
case '}':
143-
next = new_token(TOKEN_CLOSE_CURLY);
143+
next = new_token(TOK_CLOSE_CURLY);
144144
break;
145145

146146
case '-':
147147
skip_delimiter(lexer->fptr);
148148

149-
next = new_token(TOKEN_DELIMITER);
149+
next = new_token(TOK_DELIMITER);
150150
break;
151151

152152
default:

lexer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ enum TokenType {
1010
TOK_COMMA,
1111
TOK_UNDERSCORE,
1212
TOK_OPEN_CURLY,
13-
TOKEN_CLOSE_CURLY,
14-
TOKEN_DELIMITER
13+
TOK_CLOSE_CURLY,
14+
TOK_DELIMITER
1515
};
1616

1717
struct Token {

parser.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static void parse_head(struct Lexer* const lexer, struct Head* head) {
172172

173173
next_token(lexer);
174174

175-
for (;lexer->curr_token.type != TOKEN_DELIMITER; next_token(lexer)) {
175+
for (;lexer->curr_token.type != TOK_DELIMITER; next_token(lexer)) {
176176
if (lexer->curr_token.type == TOK_EOF) {
177177
// TODO: Way better error
178178

@@ -316,7 +316,7 @@ void parse_state(struct Lexer* const lexer, struct IntermediateState* state, con
316316
exit(1);
317317
}
318318

319-
while (lexer->next_token.type != TOKEN_CLOSE_CURLY && lexer->next_token.type != TOK_EOF) {
319+
while (lexer->next_token.type != TOK_CLOSE_CURLY && lexer->next_token.type != TOK_EOF) {
320320
next_token(lexer);
321321
if(lexer->curr_token.type != TOK_NUMBER && lexer->curr_token.type != TOK_UNDERSCORE) {
322322
// TODO: Add to new error system
@@ -352,7 +352,7 @@ void parse_state(struct Lexer* const lexer, struct IntermediateState* state, con
352352
}
353353
next_token(lexer);
354354

355-
CHECK_TOKEN(TOKEN_CLOSE_CURLY, "State declaration has to end with a }, but found EOF.");
355+
CHECK_TOKEN(TOK_CLOSE_CURLY, "State declaration has to end with a }, but found EOF.");
356356
}
357357

358358
size_t parse_body(struct Lexer* const lexer, struct IntermediateState* states[], const struct Head* const head) {

0 commit comments

Comments
 (0)