From 2c5efa29b3db7598a551487d727c35d2e2529342 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 2 Sep 2026 20:15:39 +0000 Subject: Support comments FossilOrigin-Name: 6d017126fbc93e45a53af2857cce78133b4714cd1a41d7bc0114c1bbaae2ec07 --- src/lib/syntax.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/lib/syntax.c') diff --git a/src/lib/syntax.c b/src/lib/syntax.c index d20c058..6e08d1b 100644 --- a/src/lib/syntax.c +++ b/src/lib/syntax.c @@ -190,6 +190,23 @@ text(struct scan_state *state, struct token *token) return 1; } +static int +comment(struct scan_state *state, struct token *token) +{ + uint32_t c; + + c = peek(state); + if(c != 0x235D) + return 0; + + do + c = advance(state); + while(c != '\n'); + + token->tag = TOKEN_TAG_COMMENT; + return 1; +} + static enum aplwc_rc next_token(struct scan_state *state, struct token *token) { @@ -199,6 +216,7 @@ next_token(struct scan_state *state, struct token *token) keyword, number, text, + comment, single_sym /* Must be last */ }; -- cgit v1.2.3