diff options
Diffstat (limited to 'src/lib/syntax.c')
| -rw-r--r-- | src/lib/syntax.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/syntax.c b/src/lib/syntax.c index 6b1d0cd..c3452f2 100644 --- a/src/lib/syntax.c +++ b/src/lib/syntax.c @@ -53,6 +53,20 @@ skip_space(struct scan_state *state) advance(state); } +static int +single_sym(struct scan_state *state, struct token *token) +{ + switch(peek(state)){ + case 0x2190: token->tag = TOKEN_TAG_LEFT_ARROW; break; + case 0x22C4: token->tag = TOKEN_TAG_DIAMOND; break; + default: + return 0; + } + + advance(state); + return 1; +} + static int identifier(struct scan_state *state, struct token *token) { @@ -127,6 +141,7 @@ next_token(struct scan_state *state, struct token *token) { size_t i; int (*scans[])(struct scan_state *, struct token *token) = { + single_sym, identifier, number, newline |