aboutsummaryrefslogtreecommitdiff
path: root/src/tree_sitter/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree_sitter/parser.c')
-rw-r--r--src/tree_sitter/parser.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/tree_sitter/parser.c b/src/tree_sitter/parser.c
index d4b227308b..19add152f1 100644
--- a/src/tree_sitter/parser.c
+++ b/src/tree_sitter/parser.c
@@ -951,15 +951,15 @@ static bool ts_parser__do_all_potential_reductions(
switch (action.type) {
case TSParseActionTypeShift:
case TSParseActionTypeRecover:
- if (!action.params.extra && !action.params.repetition) has_shift_action = true;
+ if (!action.params.shift.extra && !action.params.shift.repetition) has_shift_action = true;
break;
case TSParseActionTypeReduce:
- if (action.params.child_count > 0)
+ if (action.params.reduce.child_count > 0)
ts_reduce_action_set_add(&self->reduce_actions, (ReduceAction){
- .symbol = action.params.symbol,
- .count = action.params.child_count,
- .dynamic_precedence = action.params.dynamic_precedence,
- .production_id = action.params.production_id,
+ .symbol = action.params.reduce.symbol,
+ .count = action.params.reduce.child_count,
+ .dynamic_precedence = action.params.reduce.dynamic_precedence,
+ .production_id = action.params.reduce.production_id,
});
default:
break;
@@ -1250,7 +1250,7 @@ static void ts_parser__recover(
// be counted in error cost calculations.
unsigned n;
const TSParseAction *actions = ts_language_actions(self->language, 1, ts_subtree_symbol(lookahead), &n);
- if (n > 0 && actions[n - 1].type == TSParseActionTypeShift && actions[n - 1].params.extra) {
+ if (n > 0 && actions[n - 1].type == TSParseActionTypeShift && actions[n - 1].params.shift.extra) {
MutableSubtree mutable_lookahead = ts_subtree_make_mut(&self->tree_pool, lookahead);
ts_subtree_set_extra(&mutable_lookahead);
lookahead = ts_subtree_from_mut(mutable_lookahead);
@@ -1379,9 +1379,9 @@ static bool ts_parser__advance(
switch (action.type) {
case TSParseActionTypeShift: {
- if (action.params.repetition) break;
+ if (action.params.shift.repetition) break;
TSStateId next_state;
- if (action.params.extra) {
+ if (action.params.shift.extra) {
// TODO: remove when TREE_SITTER_LANGUAGE_VERSION 9 is out.
if (state == ERROR_STATE) continue;
@@ -1389,7 +1389,7 @@ static bool ts_parser__advance(
next_state = state;
LOG("shift_extra");
} else {
- next_state = action.params.state;
+ next_state = action.params.shift.state;
LOG("shift state:%u", next_state);
}
@@ -1398,7 +1398,7 @@ static bool ts_parser__advance(
next_state = ts_language_next_state(self->language, state, ts_subtree_symbol(lookahead));
}
- ts_parser__shift(self, version, next_state, lookahead, action.params.extra);
+ ts_parser__shift(self, version, next_state, lookahead, action.params.shift.extra);
if (did_reuse) reusable_node_advance(&self->reusable_node);
return true;
}
@@ -1406,10 +1406,10 @@ static bool ts_parser__advance(
case TSParseActionTypeReduce: {
bool is_fragile = table_entry.action_count > 1;
bool is_extra = lookahead.ptr == NULL;
- LOG("reduce sym:%s, child_count:%u", SYM_NAME(action.params.symbol), action.params.child_count);
+ LOG("reduce sym:%s, child_count:%u", SYM_NAME(action.params.reduce.symbol), action.params.reduce.child_count);
StackVersion reduction_version = ts_parser__reduce(
- self, version, action.params.symbol, action.params.child_count,
- action.params.dynamic_precedence, action.params.production_id,
+ self, version, action.params.reduce.symbol, action.params.reduce.child_count,
+ action.params.reduce.dynamic_precedence, action.params.reduce.production_id,
is_fragile, is_extra
);
if (reduction_version != STACK_VERSION_NONE) {