summaryrefslogtreecommitdiff
path: root/src/lib/aplwc_internal.h
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-21 10:55:30 +0000
committerpeter <peter@pmikkelsen.com>2026-08-21 10:55:30 +0000
commit8af7b7fc0a8dbe3502a7cd43c6a10fdcc6013677 (patch)
tree68f2456a9f31044ca088a26a2c3306c98e6cce2b /src/lib/aplwc_internal.h
parent86feda786f115cb4468957f00b8968b986ed7c54 (diff)
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
Diffstat (limited to 'src/lib/aplwc_internal.h')
-rw-r--r--src/lib/aplwc_internal.h31
1 files changed, 28 insertions, 3 deletions
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 */