Rename type ts_symbol -> TSSymbol
This commit is contained in:
parent
7e0d46002c
commit
d7449bf5ea
8 changed files with 22 additions and 22 deletions
|
|
@ -16,7 +16,7 @@ void shift(ts_lr_parser *parser, TSStateId parse_state, int is_extra) {
|
|||
parser->next_lookahead = NULL;
|
||||
}
|
||||
|
||||
void reduce(ts_lr_parser *parser, ts_symbol symbol, size_t child_count) {
|
||||
void reduce(ts_lr_parser *parser, TSSymbol symbol, size_t child_count) {
|
||||
parser->next_lookahead = parser->lookahead;
|
||||
parser->lookahead = ts_stack_reduce(&parser->stack,
|
||||
symbol,
|
||||
|
|
@ -58,7 +58,7 @@ static size_t breakdown_stack(ts_lr_parser *parser, ts_input_edit *edit) {
|
|||
return position;
|
||||
}
|
||||
|
||||
ts_symbol * expected_symbols(ts_lr_parser *parser, size_t *count) {
|
||||
TSSymbol * expected_symbols(ts_lr_parser *parser, size_t *count) {
|
||||
*count = 0;
|
||||
const ts_parse_action *actions = actions_for_state(parser, ts_stack_top_state(&parser->stack));
|
||||
for (size_t i = 0; i < parser->config.symbol_count; i++)
|
||||
|
|
@ -66,8 +66,8 @@ ts_symbol * expected_symbols(ts_lr_parser *parser, size_t *count) {
|
|||
++(*count);
|
||||
|
||||
size_t n = 0;
|
||||
ts_symbol *result = malloc(*count * sizeof(*result));
|
||||
for (ts_symbol i = 0; i < parser->config.symbol_count; i++)
|
||||
TSSymbol *result = malloc(*count * sizeof(*result));
|
||||
for (TSSymbol i = 0; i < parser->config.symbol_count; i++)
|
||||
if (actions[i].type != ts_parse_action_type_error)
|
||||
result[n++] = i;
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ ts_symbol * expected_symbols(ts_lr_parser *parser, size_t *count) {
|
|||
|
||||
int handle_error(ts_lr_parser *parser) {
|
||||
size_t count = 0;
|
||||
const ts_symbol *inputs = expected_symbols(parser, &count);
|
||||
const TSSymbol *inputs = expected_symbols(parser, &count);
|
||||
TSTree *error = ts_tree_make_error(ts_lexer_lookahead_char(&parser->lexer),
|
||||
count,
|
||||
inputs,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ size_t ts_stack_right_position(const ts_stack *stack) {
|
|||
}
|
||||
|
||||
TSTree * ts_stack_reduce(ts_stack *stack,
|
||||
ts_symbol symbol,
|
||||
TSSymbol symbol,
|
||||
size_t immediate_child_count,
|
||||
const int *hidden_symbol_flags,
|
||||
int gather_extra) {
|
||||
|
|
@ -69,7 +69,7 @@ TSTree * ts_stack_reduce(ts_stack *stack,
|
|||
TSTree *child = stack->entries[stack_index].node;
|
||||
size_t grandchild_count;
|
||||
TSTree **grandchildren = ts_tree_children(child, &grandchild_count);
|
||||
ts_symbol child_symbol = ts_tree_symbol(child);
|
||||
TSSymbol child_symbol = ts_tree_symbol(child);
|
||||
|
||||
collapse_flags[i] = (
|
||||
hidden_symbol_flags[child_symbol] ||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include "runtime/tree.h"
|
||||
|
||||
static TSTree * ts_tree_make(ts_symbol symbol, size_t size, size_t offset) {
|
||||
static TSTree * ts_tree_make(TSSymbol symbol, size_t size, size_t offset) {
|
||||
TSTree *result = malloc(sizeof(TSTree));
|
||||
*result = (TSTree) {
|
||||
.ref_count = 1,
|
||||
|
|
@ -14,7 +14,7 @@ static TSTree * ts_tree_make(ts_symbol symbol, size_t size, size_t offset) {
|
|||
return result;
|
||||
}
|
||||
|
||||
TSTree * ts_tree_make_leaf(ts_symbol symbol, size_t size, size_t offset) {
|
||||
TSTree * ts_tree_make_leaf(TSSymbol symbol, size_t size, size_t offset) {
|
||||
TSTree *result = ts_tree_make(symbol, size, offset);
|
||||
result->data.children.count = 0;
|
||||
result->data.children.immediate_count = 0;
|
||||
|
|
@ -22,7 +22,7 @@ TSTree * ts_tree_make_leaf(ts_symbol symbol, size_t size, size_t offset) {
|
|||
return result;
|
||||
}
|
||||
|
||||
TSTree * ts_tree_make_node(ts_symbol symbol, size_t child_count, size_t immediate_child_count, TSTree **children) {
|
||||
TSTree * ts_tree_make_node(TSSymbol symbol, size_t child_count, size_t immediate_child_count, TSTree **children) {
|
||||
TSTree **immediate_children = children + child_count;
|
||||
size_t size = 0, offset = 0;
|
||||
for (size_t i = 0; i < immediate_child_count; i++) {
|
||||
|
|
@ -42,7 +42,7 @@ TSTree * ts_tree_make_node(ts_symbol symbol, size_t child_count, size_t immediat
|
|||
return result;
|
||||
}
|
||||
|
||||
TSTree * ts_tree_make_error(char lookahead_char, size_t expected_input_count, const ts_symbol *expected_inputs, size_t size, size_t offset) {
|
||||
TSTree * ts_tree_make_error(char lookahead_char, size_t expected_input_count, const TSSymbol *expected_inputs, size_t size, size_t offset) {
|
||||
TSTree *result = ts_tree_make(ts_builtin_sym_error, size, offset);
|
||||
result->data.error.lookahead_char = lookahead_char;
|
||||
result->data.error.expected_input_count = expected_input_count;
|
||||
|
|
@ -50,7 +50,7 @@ TSTree * ts_tree_make_error(char lookahead_char, size_t expected_input_count, co
|
|||
return result;
|
||||
}
|
||||
|
||||
ts_symbol ts_tree_symbol(const TSTree *tree) {
|
||||
TSSymbol ts_tree_symbol(const TSTree *tree) {
|
||||
return tree->symbol;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "tree_sitter/runtime.h"
|
||||
|
||||
struct TSTree {
|
||||
ts_symbol symbol;
|
||||
TSSymbol symbol;
|
||||
size_t ref_count;
|
||||
size_t offset;
|
||||
size_t size;
|
||||
|
|
@ -18,7 +18,7 @@ struct TSTree {
|
|||
struct {
|
||||
char lookahead_char;
|
||||
size_t expected_input_count;
|
||||
const ts_symbol *expected_inputs;
|
||||
const TSSymbol *expected_inputs;
|
||||
} error;
|
||||
} data;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue