summaryrefslogtreecommitdiff
path: root/src/lib/syntax.c
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-22 17:25:54 +0000
committerpeter <peter@pmikkelsen.com>2026-08-22 17:25:54 +0000
commitdc9b7f961d1c5f39a07085c9dbad8d94bbacde70 (patch)
tree5f22d024bfc2d8813947c1f1700114df9e01a287 /src/lib/syntax.c
parentefe230205f254fc5369b53d3de2841723beb6ff8 (diff)
Small set of changes to make the tests pass - meaning the scanner understands the code, not much else
FossilOrigin-Name: d21c4a18581a61da466c0fbfdf73881bec55ea01091ef67abda1d10e17f8d358
Diffstat (limited to 'src/lib/syntax.c')
-rw-r--r--src/lib/syntax.c15
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