core: lexer: Add unsigned type tokens
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -186,6 +186,30 @@ lexer_check_kw(struct cescal_state *state, struct token *res)
|
||||
res->type = TT_RETURN;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp(res->s, "u8") == 0) {
|
||||
res->type = TT_U8;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(res->s, "u16") == 0) {
|
||||
res->type = TT_U16;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(res->s, "u32") == 0) {
|
||||
res->type = TT_U32;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(res->s, "u64") == 0) {
|
||||
res->type = TT_U64;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -45,7 +45,11 @@ static const char *toktab[] = {
|
||||
[TT_PUB] = qtok("pub"),
|
||||
[TT_PROC] = qtok("proc"),
|
||||
[TT_BEGIN] = qtok("begin"),
|
||||
[TT_END] = qtok("end")
|
||||
[TT_END] = qtok("end"),
|
||||
[TT_U8] = qtok("u8"),
|
||||
[TT_U16] = qtok("u16"),
|
||||
[TT_U32] = qtok("u32"),
|
||||
[TT_U64] = qtok("u64")
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
@@ -26,6 +26,10 @@ typedef enum {
|
||||
TT_PROC, /* 'proc' */
|
||||
TT_BEGIN, /* 'begin' */
|
||||
TT_END, /* 'end' */
|
||||
TT_U8, /* 'u8' */
|
||||
TT_U16, /* 'u16' */
|
||||
TT_U32, /* 'u32' */
|
||||
TT_U64, /* 'u64' */
|
||||
} tt_t;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user