summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/lexer.c7
-rw-r--r--core/parser.c1
-rw-r--r--include/cescal/token.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/core/lexer.c b/core/lexer.c
index 26ab451..bc40542 100644
--- a/core/lexer.c
+++ b/core/lexer.c
@@ -240,6 +240,13 @@ lexer_nom(struct cescal_state *state, struct token *res)
}
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) {
lexer_check_kw(state, res);
diff --git a/core/parser.c b/core/parser.c
index 3b3e91b..5d64bb7 100644
--- a/core/parser.c
+++ b/core/parser.c
@@ -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"),
diff --git a/include/cescal/token.h b/include/cescal/token.h
index eb9fc39..e215371 100644
--- a/include/cescal/token.h
+++ b/include/cescal/token.h
@@ -17,6 +17,7 @@ typedef enum {
TT_LPAREN, /* '(' */
TT_RPAREN, /* '( */
TT_COMMA, /* ',' */
+ TT_ARROW, /* '->' */
TT_RETURN, /* 'return' */
TT_PUB, /* 'pub' */
TT_PROC, /* 'proc' */