diff options
| author | peter <peter@pmikkelsen.com> | 2026-09-02 20:15:39 +0000 |
|---|---|---|
| committer | peter <peter@pmikkelsen.com> | 2026-09-02 20:15:39 +0000 |
| commit | 2c5efa29b3db7598a551487d727c35d2e2529342 (patch) | |
| tree | e53cbe407c22b4b8ee8dd95a30b9ff480d360db3 /src/lib/syntax.c | |
| parent | fa85b6ad25cbf4d98d80082e44921fc351533204 (diff) | |
Support comments
FossilOrigin-Name: 6d017126fbc93e45a53af2857cce78133b4714cd1a41d7bc0114c1bbaae2ec07
Diffstat (limited to 'src/lib/syntax.c')
| -rw-r--r-- | src/lib/syntax.c | 18 |
1 files changed, 18 insertions, 0 deletions
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 */ }; |