summaryrefslogtreecommitdiff
path: root/src/reader.c
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-01-21 21:53:50 +0800
committerJSDurand <mmemmew@gmail.com>2022-01-21 21:53:50 +0800
commit53865aad225ffbe5cf3c42736e5a2095092f9fff (patch)
tree697ecbee7fa69ae8c58a0ec2f69cdf84d7cd313f /src/reader.c
parent5730d6c04258e192195bfbbbed76d68fd78ed458 (diff)
temporary save point
Just to save some work.
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/reader.c b/src/reader.c
index d715726..7676d2d 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -68,7 +68,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end,
free(string);
string = NULL;
- *(tnts+tnt_count++) = (TNT) { 1, { .nt = nt_index } };
+ *(tnts+tnt_count++) = (TNT) { NONTERMINAL,
+ { .nt = nt_index } };
readingp = 0;
}
@@ -112,7 +113,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end,
if (local_exit) return 1;
}
- *(tnts+tnt_count++) = (TNT) { 0, { .t = strinfo.value } };
+ *(tnts+tnt_count++) = (TNT) { TERMINAL,
+ { .t = strinfo.value } };
strindex += strinfo.step;
}
@@ -159,7 +161,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end,
free(string);
string = NULL;
- *(tnts+tnt_count++) = (TNT) { 1, { .nt = nt_index } };
+ *(tnts+tnt_count++) = (TNT) { NONTERMINAL,
+ { .nt = nt_index } };
}
break;
}
@@ -177,6 +180,9 @@ print_int(void *p)
printf("%d\n", *((int *)p));
}
+/* TODO: Rewrite the reader to include the comments and escaping
+ across multiple lines. Rewrite into a GLL parser by hand. */
+
/* Read a grammar from a string in the format of BNF notation. */
Grammar *
read_grammar_from_bnf(const str * const restrict s)