summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-25 21:07:11 +0000
committerpeter <peter@pmikkelsen.com>2026-08-25 21:07:11 +0000
commit3787b5c0b7870eec43ce384beaa16288073e89cf (patch)
tree5bab512957d84a40ac31fe9725adf8ddedda392d
parent86a65e695b9dc1fb7a20094204339f5bf168fb92 (diff)
Add a reference to the original string, in a token_list. Otherwise the offsets make no sense.
FossilOrigin-Name: 22c37facb5cb33fac6f473425f5552491da19ae280edcfd8e93f157870f9746e
-rw-r--r--src/lib/aplwc_internal.h1
-rw-r--r--src/lib/syntax.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/aplwc_internal.h b/src/lib/aplwc_internal.h
index b027073..888d35c 100644
--- a/src/lib/aplwc_internal.h
+++ b/src/lib/aplwc_internal.h
@@ -52,6 +52,7 @@ struct token {
};
struct token_list {
+ struct string *text;
size_t length;
struct token tokens[1];
};
diff --git a/src/lib/syntax.c b/src/lib/syntax.c
index f930973..89f8be4 100644
--- a/src/lib/syntax.c
+++ b/src/lib/syntax.c
@@ -247,6 +247,7 @@ scan_string(struct aplwc *aplwc, struct string *text, int oneline)
aplwc->last_error = APLWC_OUT_OF_MEMORY;
return NULL;
}
+ tokens->text = text;
tokens->length = n;
scan(text, tokens);