app_update, print events

This commit is contained in:
krzosa
2024-12-29 10:26:42 +01:00
parent a30a897272
commit 6939170478
11 changed files with 68 additions and 68 deletions

View File

@@ -2,7 +2,7 @@ typedef enum lex_kind_t lex_kind_t;
enum lex_kind_t {
#define LEX_KIND_XLIST\
X(eof, "end of file", "---")\
X(int, "integer", "---")\
X(integer, "integer", "---")\
X(real, "real", "---")\
X(ident, "identifier", "---")\
X(string, "string", "---")\
@@ -84,8 +84,8 @@ struct lex_t {
s8_t s8;
};
int line;
int column;
i32 line;
i32 column;
char *file_name;
union {
@@ -99,14 +99,14 @@ typedef struct lexer_t lexer_t;
struct lexer_t {
char *at;
char *file_name;
int line;
int column;
i32 line;
i32 column;
};
typedef struct lex_array_t lex_array_t;
struct lex_array_t {
lex_t *data;
int len;
i32 len;
};
void lex_panicf(lex_t *token, const char *str, ...) {
@@ -184,7 +184,7 @@ u64 lex_deserial_u64(char *string, i64 len, u64 base) {
}
void lex_eat_number(lexer_t *lex, lex_t *token) {
token->kind = lex_kind_int;
token->kind = lex_kind_integer;
for (;;) {
if (char_is_digit(lex->at[0])) {
lex_advance(lex);
@@ -208,16 +208,16 @@ void lex_eat_number(lexer_t *lex, lex_t *token) {
} else if (lex_match(lex, 'd')) {
token->kind = lex_kind_real;
token->suffix = lex_suffix_d;
} else if (token->kind == lex_kind_int && ((lex->at[0] == 'u' && lex->at[1] == 'l' && lex->at[2] == 'l') || (lex->at[0] == 'U' && lex->at[1] == 'L' && lex->at[2] == 'L'))) {
} else if (token->kind == lex_kind_integer && ((lex->at[0] == 'u' && lex->at[1] == 'l' && lex->at[2] == 'l') || (lex->at[0] == 'U' && lex->at[1] == 'L' && lex->at[2] == 'L'))) {
token->suffix = lex_suffix_ull;
lex_advance(lex); lex_advance(lex); lex_advance(lex);
} else if (token->kind == lex_kind_int && ((lex->at[0] == 'u' && lex->at[1] == 'l') || (lex->at[0] == 'U' && lex->at[1] == 'L'))) {
} else if (token->kind == lex_kind_integer && ((lex->at[0] == 'u' && lex->at[1] == 'l') || (lex->at[0] == 'U' && lex->at[1] == 'L'))) {
token->suffix = lex_suffix_ul;
lex_advance(lex); lex_advance(lex);
} else if (token->kind == lex_kind_int && (lex->at[0] == 'l' || lex->at[0] == 'L')) {
} else if (token->kind == lex_kind_integer && (lex->at[0] == 'l' || lex->at[0] == 'L')) {
token->suffix = lex_suffix_l;
lex_advance(lex);
} else if (token->kind == lex_kind_int && ((lex->at[0] == 'l' && lex->at[1] == 'l') || (lex->at[0] == 'L' && lex->at[1] == 'L'))) {
} else if (token->kind == lex_kind_integer && ((lex->at[0] == 'l' && lex->at[1] == 'l') || (lex->at[0] == 'L' && lex->at[1] == 'L'))) {
token->suffix = lex_suffix_ll;
lex_advance(lex); lex_advance(lex);
}
@@ -366,9 +366,9 @@ void lex_token_ex(lexer_t *lex, lex_t *token) {
}
}
token->len = (int)(lex->at - token->str);
token->len = (i32)(lex->at - token->str);
if (token->kind == lex_kind_int) {
if (token->kind == lex_kind_integer) {
token->integer = lex_deserial_u64(token->str, token->len, 10);
} else if (token->kind == lex_kind_real) {
token->real = s8_deserial_f64(token->s8);