stage1 人工重构ast.c

This commit is contained in:
zzy
2026-08-12 10:29:38 +08:00
parent 314100afbc
commit b0e6b406ac
22 changed files with 1619 additions and 2895 deletions

View File

@@ -1,4 +1,4 @@
/* spl_lexer.c SPL lexical analyzer */
/* spl_lexer.c - SPL lexical analyzer */
#include "spl_lexer.h"
#include "spl_tok.h"
@@ -21,7 +21,7 @@ static spl_tok_type_t keyword_type(const char *ident, usize len) {
return TOK_IDENT;
}
/* Escape sequence decoder returns the decoded character,
/* Escape sequence decoder - returns the decoded character,
* advances *s past the escape sequence, returns 0 on success,
* non-zero on error. */
int spl_decode_escape(const char **s, char *out) {
@@ -85,7 +85,7 @@ spl_tok_vec_t spl_lex(const char *source, const char *fname) {
const char *start = source + offset;
char c = *start;
/* Skip whitespace (but not newlines emit TOK_ENDLINE) */
/* Skip whitespace (but not newlines - emit TOK_ENDLINE) */
if (c == ' ' || c == '\t' || c == '\r') {
offset++;
col++;