lexer: Add tokens for LBRACE and RBRACE
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -325,6 +325,14 @@ lexer_scan(struct rifle_state *state, struct token *res)
|
||||
res->type = TT_RPAREN;
|
||||
res->c = c;
|
||||
return 0;
|
||||
case '{':
|
||||
res->type = TT_LBRACE;
|
||||
res->c = c;
|
||||
return 0;
|
||||
case '}':
|
||||
res->type = TT_RBRACE;
|
||||
res->c = c;
|
||||
return 0;
|
||||
case '#':
|
||||
if ((c = lexer_nom(state, false)) == '\0') {
|
||||
trace_error(state, "unexpected end of file\n");
|
||||
|
||||
@@ -53,6 +53,8 @@ static const char *toktab[] = {
|
||||
[TT_COLON] = qtok(":"),
|
||||
[TT_LPAREN] = qtok("("),
|
||||
[TT_RPAREN] = qtok(")"),
|
||||
[TT_LBRACE] = qtok("{"),
|
||||
[TT_RBRACE] = qtok("}"),
|
||||
[TT_F] = qtok(".f"),
|
||||
[TT_EXTERN] = qtok(".extern"),
|
||||
[TT_DEFINE] = qtok("#define"),
|
||||
|
||||
@@ -14,6 +14,8 @@ typedef enum {
|
||||
TT_COLON, /* ':' */
|
||||
TT_LPAREN, /* '(' */
|
||||
TT_RPAREN, /* ')' */
|
||||
TT_LBRACE, /* '{' */
|
||||
TT_RBRACE, /* '}' */
|
||||
TT_F, /* '.f' */
|
||||
TT_EXTERN, /* '.extern' */
|
||||
TT_DEFINE, /* '#define' */
|
||||
|
||||
Reference in New Issue
Block a user