diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-19 11:29:50 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-19 11:29:50 +0200 |
commit | 16b3146a1ed4497205a378472b35c40eb34c0d40 (patch) | |
tree | 1607ca63497008ce51f4333dcea9b729483f23f8 /libparser.c | |
parent | Compile with -O2 and -s (diff) | |
download | libparser-16b3146a1ed4497205a378472b35c40eb34c0d40.tar.gz libparser-16b3146a1ed4497205a378472b35c40eb34c0d40.tar.bz2 libparser-16b3146a1ed4497205a378472b35c40eb34c0d40.tar.xz |
Add rejection + fix documentation of comment syntax (can contain string)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libparser.c')
-rw-r--r-- | libparser.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libparser.c b/libparser.c index 36b662d..cb5981b 100644 --- a/libparser.c +++ b/libparser.c @@ -112,6 +112,18 @@ try_match(const char *rule, const union libparser_sentence *sentence, struct con } break; + case LIBPARSER_SENTENCE_TYPE_REJECTION: + unit->in = try_match(NULL, sentence->unary.sentence, ctx); + if (unit->in) { + free_unit(unit->in, ctx); + if (!ctx->exception) + goto mismatch; + ctx->exception = 0; + } + ctx->position = unit->start; + unit->rule = NULL; + break; + case LIBPARSER_SENTENCE_TYPE_OPTIONAL: unit->in = try_match(NULL, sentence->unary.sentence, ctx); goto prone; |