diff options
author | JSDurand <mmemmew@gmail.com> | 2022-02-08 00:29:10 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-02-08 12:33:05 +0800 |
commit | 5426d9e2a6b820e34809d639838b26643df9ab17 (patch) | |
tree | 111f2b478b671092e3f2e64a6171970b8a5cdf99 /src/dfa.c | |
parent | aaa12504c6095b2cdfa213a3d4b269bbd5e7038a (diff) |
There are multiple subtle errors in the previous version, both in the
codes and in the description of the BNF format. This version should
fix some problems now.
This version can successfully parse the grammar of its own grammar
format, which is quite nice. See test/check_reader.c for parsing this
format.
Diffstat (limited to 'src/dfa.c')
-rw-r--r-- | src/dfa.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -717,8 +717,8 @@ run_dfa(const dfa * const restrict table, const NUM code) if (code >= (table->data.sp.ranges+i)->beg && code <= (table->data.sp.ranges+i)->end) { #ifdef DEBUG - fleprintf("code = %ld, beg = %ld, end = %ld\n", - code, + fleprintf("i = %d, code = %ld, beg = %ld, end = %ld\n", + i, code, (table->data.sp.ranges+i)->beg, (table->data.sp.ranges+i)->end); #endif @@ -727,17 +727,18 @@ run_dfa(const dfa * const restrict table, const NUM code) return 0; break; case DFA_TYPE_SPECIAL_NEG: - for (int i = 0; i < table->data.sp.len; i++) + for (int i = 0; i < table->data.sp.len; i++) { if (code >= (table->data.sp.ranges+i)->beg && code <= (table->data.sp.ranges+i)->end) { #ifdef DEBUG - fleprintf("code = %ld, beg = %ld, end = %ld\n", - code, + fleprintf("code = %ld, i = %d, beg = %ld, end = %ld\n", + code, i, (table->data.sp.ranges+i)->beg, (table->data.sp.ranges+i)->end); #endif return 0; } + } return 1; break; case DFA_TYPE_SPECIAL_BOTH: |