core: lexer: Add arrow token
Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
@@ -239,6 +239,13 @@ lexer_nom(struct cescal_state *state, struct token *res)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
case '-':
|
||||
res->c = c;
|
||||
if (lexer_consume_single(state, true) == '>') {
|
||||
res->type = TT_ARROW;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
default:
|
||||
if (lexer_scan_ident(state, c, res) == 0) {
|
||||
|
||||
@@ -37,6 +37,7 @@ static const char *toktab[] = {
|
||||
[TT_LPAREN] = qtok("("),
|
||||
[TT_RPAREN] = qtok(")"),
|
||||
[TT_COMMA] = qtok(","),
|
||||
[TT_ARROW] = qtok("->"),
|
||||
[TT_RETURN] = qtok("return"),
|
||||
[TT_PUB] = qtok("pub"),
|
||||
[TT_PROC] = qtok("proc"),
|
||||
|
||||
@@ -17,6 +17,7 @@ typedef enum {
|
||||
TT_LPAREN, /* '(' */
|
||||
TT_RPAREN, /* '( */
|
||||
TT_COMMA, /* ',' */
|
||||
TT_ARROW, /* '->' */
|
||||
TT_RETURN, /* 'return' */
|
||||
TT_PUB, /* 'pub' */
|
||||
TT_PROC, /* 'proc' */
|
||||
|
||||
Reference in New Issue
Block a user