diff options
| author | Mistivia <i@mistivia.com> | 2025-03-25 12:05:20 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-03-25 12:05:20 +0800 |
| commit | dc87ff4b0c9f311be7fad652594e3766a4ddb0c6 (patch) | |
| tree | 8e7d1c9045b8abec12b4682a2bb4d8a5b217139e /src/as_tokenizer.c | |
| parent | 4188f791787be19f32226b8ac0f213f61cdd4666 (diff) | |
refactor name
Diffstat (limited to 'src/as_tokenizer.c')
| -rw-r--r-- | src/as_tokenizer.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/as_tokenizer.c b/src/as_tokenizer.c index 216ee8a..6c40b9f 100644 --- a/src/as_tokenizer.c +++ b/src/as_tokenizer.c @@ -6,7 +6,7 @@ #include "as_op.h" #include "utils.h" -int input_stream_next_char(input_stream_t s) { +int input_stream_next_char(struct input_stream * s) { if (s->cursor == -1) { return EOF; } @@ -30,7 +30,7 @@ int input_stream_next_char(input_stream_t s) { return c; } -int input_stream_peek_char(input_stream_t s) { +int input_stream_peek_char(struct input_stream * s) { if (s->cursor == -1) { return EOF; } @@ -71,8 +71,8 @@ int is_part_of_identifier(int c) { return 0; } -token_t next_token_impl(allocator_t alct, input_stream_t s) { - token_t t = allocate(alct, sizeof(struct token)); +struct token * next_token_impl(struct allocator * alct, struct input_stream * s) { + struct token * t = allocate(alct, sizeof(struct token)); int c; while (1) { c = input_stream_peek_char(s); @@ -138,17 +138,17 @@ token_t next_token_impl(allocator_t alct, input_stream_t s) { return t; } -token_t next_token(allocator_t alct, token_stream_t ts) { +struct token * next_token(struct allocator * alct, struct token_stream * ts) { if (ts->buf != NULL) { - token_t t = ts->buf; + struct token * t = ts->buf; ts->buf = NULL; return t; } - token_t t = next_token_impl(alct, ts->s); + struct token * t = next_token_impl(alct, ts->s); return t; } -token_t peek_token(allocator_t alct, token_stream_t ts) { +struct token * peek_token(struct allocator * alct, struct token_stream * ts) { if (ts->buf != NULL) { return ts->buf; } @@ -156,7 +156,7 @@ token_t peek_token(allocator_t alct, token_stream_t ts) { return ts->buf; } -void print_token(token_t t) { +void print_token(struct token * t) { switch (t->type) { case TK_OP: printf("OP: %s, line: %d, col: %d\n", t->sval, t->line, t->col); @@ -179,15 +179,15 @@ void print_token(token_t t) { } } -token_stream_t new_token_stream(allocator_t alct, FILE* fp) { - input_stream_t s = allocate(alct, sizeof(struct input_stream)); +struct token_stream * new_token_stream(struct allocator * alct, FILE* fp) { + struct input_stream * s = allocate(alct, sizeof(struct input_stream)); s->fp = fp; s->buf = allocate(alct, INPUT_STREAM_BUF_SIZE); s->buf_pos = 0; s->cursor = 0; s->line = 1; s->col = 1; - token_stream_t ts = allocate(alct, sizeof(struct token_stream)); + struct token_stream * ts = allocate(alct, sizeof(struct token_stream)); ts->s = s; ts->buf = NULL; return ts; |
