From 5f9be9d9b2f6b693c31efb7b8ac03479b1b257c0 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Mar 2016 10:24:12 -0800 Subject: [PATCH] Make Failure enumerators have the value zero --- src/runtime/parser.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index d5c0dc28..72cb000e 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -58,15 +58,15 @@ typedef struct { } ErrorRepair; typedef enum { + ParseActionFailed, ParseActionUpdated, ParseActionRemoved, - ParseActionFailed, } ParseActionResult; typedef enum { + ReduceFailed, ReduceSucceeded, ReduceMerged, - ReduceFailed, ReduceStoppedAtError, } ReduceResult; @@ -507,13 +507,11 @@ static ParseActionResult ts_parser__handle_error(TSParser *self, int head, lookahead->size = ts_length_add(lookahead->size, next_lookahead->padding); next_lookahead->padding = ts_length_zero(); - if (ts_parser__shift(self, head, ts_parse_state_error, lookahead) == - ParseActionFailed) + if (!ts_parser__shift(self, head, ts_parse_state_error, lookahead)) goto error; while (ts_language_symbol_metadata(self->language,next_lookahead->symbol).extra) { - if (ts_parser__shift_extra(self, head, ts_parse_state_error, - next_lookahead) == ParseActionFailed) + if (!ts_parser__shift_extra(self, head, ts_parse_state_error, next_lookahead)) goto error; ts_tree_release(next_lookahead); next_lookahead = self->language->lex_fn(&self->lexer, 0, true);