From dc9b7f961d1c5f39a07085c9dbad8d94bbacde70 Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 22 Aug 2026 17:25:54 +0000 Subject: Small set of changes to make the tests pass - meaning the scanner understands the code, not much else FossilOrigin-Name: d21c4a18581a61da466c0fbfdf73881bec55ea01091ef67abda1d10e17f8d358 --- src/lib/syntax.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lib/syntax.c') 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 -- cgit v1.2.3