aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/parsespec.c
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2026-01-12 22:34:47 +0100
committerSamuel Lidén Borell <samuel@kodafritt.se>2026-01-12 22:34:47 +0100
commitf947af6259901d107197a890fafce9d24e8cbdac (patch)
treecaa8a073730b97ca756f62ecd26f685a6fe1c87f /bootstrap/parsespec.c
parent2d42d29d2b36b2bd80debfaaa51553b56629b659 (diff)
downloadslul-try2-main.tar.gz
slul-try2-main.zip
bootstrap: Parsing of `versions` sectionsHEADmain
Diffstat (limited to 'bootstrap/parsespec.c')
-rw-r--r--bootstrap/parsespec.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/bootstrap/parsespec.c b/bootstrap/parsespec.c
index 7f0ce55..dfd3fe5 100644
--- a/bootstrap/parsespec.c
+++ b/bootstrap/parsespec.c
@@ -98,3 +98,38 @@ void parse_giveme_section(void)
}
}
}
+
+static void add_version(const char *s, size_t len)
+{
+ /* TODO */
+ (void)s;
+ (void)len;
+ fprintf(stderr, "add version >%.*s<\n", (int)len, s);
+}
+
+void parse_versions_section(void)
+{
+ assert(!tokenize_numbers_as_versions);
+ tokenize_numbers_as_versions = true;
+ for (;;) {
+ struct LexemeInfo li;
+ enum Token t = tokenize(&li);
+ if (t == T_EOL) {
+ if (!tokenizer_next_line()) {
+ break; /* EOF */
+ }
+ continue; /* Blank line */
+ } else if (t != T_Version) {
+ if (tokenizer_line_is_indented()) {
+ error("Unexpected token in `versions` section "
+ "(or unexpected identation before symbol)");
+ }
+ unread_line(); /* End of version section */
+ break;
+ }
+
+ add_version(li.string, li.len);
+ expect_next_line_or_eof();
+ }
+ tokenize_numbers_as_versions = false;
+}