From 8af7b7fc0a8dbe3502a7cd43c6a10fdcc6013677 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 21 Aug 2026 10:55:30 +0000 Subject: Start working on the scanner. For now, all that is implemented is some functionality which imports UTF-8 into the memory managed by aplwc, after checking that the data is in fact valid UTF-8. FossilOrigin-Name: c861e88777d8180cb7b37c11fc7016a900f9d5821a7e3c8e8aab54118d2fca94 --- src/lib/aplwc_internal.h | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/lib/aplwc_internal.h') diff --git a/src/lib/aplwc_internal.h b/src/lib/aplwc_internal.h index 52ecd2e..155508d 100644 --- a/src/lib/aplwc_internal.h +++ b/src/lib/aplwc_internal.h @@ -21,16 +21,41 @@ struct memory { struct aplwc { enum aplwc_rc last_error; - char last_error_msg[64]; struct memory memory; }; -/* errors.c */ -const char *rc_to_string(enum aplwc_rc); +struct aplwc_line { + struct aplwc *aplwc; + struct string *text; + struct token_list *tokens; +}; + +struct string { + size_t bytes; + size_t chars; + uint8_t *utf8; +}; + +struct token_list { + size_t length; +}; + +/* eval.c */ +void eval_line(struct aplwc_line *); /* memory.c */ struct memory memory_init(uint8_t *, size_t); struct aplwc *memory_alloc_aplwc(struct memory *); +struct aplwc_line *memory_alloc_aplwc_line(struct memory *); +struct string *memory_alloc_string(struct memory *, size_t); void memory_free_aplwc(struct memory *, struct aplwc *); +void memory_free_aplwc_line(struct memory *, struct aplwc_line *); +void memory_free_string(struct memory *, struct string *); + +/* string.c */ +struct string *chars_to_string(struct aplwc *, const char *); + +/* syntax.c */ +struct token_list *scan_line(struct aplwc *, struct string *); #endif /* APLWC_INTERNAL_H */ -- cgit v1.2.3