Add padding and size points to ts_tree_make_leaf in ts_lexer__accept
This commit is contained in:
parent
ad58b752e6
commit
4663b9ce89
2 changed files with 10 additions and 8 deletions
|
|
@ -92,17 +92,19 @@ static TSTree *ts_lexer__accept(TSLexer *self, TSSymbol symbol,
|
|||
ts_length_sub(self->token_start_position, self->token_end_position);
|
||||
self->token_end_position = self->current_position;
|
||||
|
||||
TSPoint size_point = ts_point_sub(self->current_point, self ->token_start_point);
|
||||
TSPoint padding_point = ts_point_sub(self->token_start_point, self ->token_end_point);
|
||||
self->token_end_point = self->current_point;
|
||||
|
||||
if (symbol == ts_builtin_sym_error) {
|
||||
DEBUG("error_char");
|
||||
return ts_tree_make_error(size, padding, self->token_start_point,
|
||||
self->token_end_point, self->lookahead);
|
||||
return ts_tree_make_error(size, padding, size_point,
|
||||
padding_point, self->lookahead);
|
||||
} else {
|
||||
DEBUG("accept_token sym:%s", symbol_name);
|
||||
return ts_tree_make_leaf(symbol, padding, size,
|
||||
self->token_start_point,
|
||||
self->token_end_point, node_type);
|
||||
padding_point,
|
||||
size_point, node_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ TSTree *ts_tree_make_leaf(TSSymbol sym, TSLength padding, TSLength size,
|
|||
}
|
||||
|
||||
TSTree *ts_tree_make_error(TSLength size, TSLength padding,
|
||||
TSPoint start_point,
|
||||
TSPoint end_point,
|
||||
TSPoint size_point,
|
||||
TSPoint padding_point,
|
||||
char lookahead_char) {
|
||||
TSTree *result =
|
||||
ts_tree_make_leaf(ts_builtin_sym_error, padding, size, start_point,
|
||||
end_point, TSNodeTypeNamed);
|
||||
ts_tree_make_leaf(ts_builtin_sym_error, padding, size, padding_point,
|
||||
size_point, TSNodeTypeNamed);
|
||||
result->lookahead_char = lookahead_char;
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue