summaryrefslogtreecommitdiff
path: root/src/reader.c
diff options
context:
space:
mode:
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)