update: normed lots of stuff
This commit is contained in:
parent
978636b6ef
commit
50a2f3d4be
118 changed files with 1145 additions and 1330 deletions
|
|
@ -16,7 +16,7 @@
|
|||
#include "parser/language.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
t_const_str ts_language_field_name_for_id(const TSLanguage *self, TSFieldId id)
|
||||
t_const_str ts_language_field_name_for_id(const t_language *self, t_field_id id)
|
||||
{
|
||||
t_u32 count;
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ t_const_str ts_language_field_name_for_id(const TSLanguage *self, TSFieldId id)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
TSFieldId ts_language_field_id_for_name(const TSLanguage *self,
|
||||
t_field_id ts_language_field_id_for_name(const t_language *self,
|
||||
t_const_str name, t_u32 name_length)
|
||||
{
|
||||
t_u16 count;
|
||||
TSSymbol i;
|
||||
t_symbol i;
|
||||
|
||||
count = (t_u16)ts_language_field_count(self);
|
||||
i = 1;
|
||||
|
|
@ -45,7 +45,7 @@ TSFieldId ts_language_field_id_for_name(const TSLanguage *self,
|
|||
return (0);
|
||||
}
|
||||
|
||||
void ts_language_field_map(const TSLanguage *self, t_u32 production_id,
|
||||
void ts_language_field_map(const t_language *self, t_u32 production_id,
|
||||
const TSFieldMapEntry **start, const TSFieldMapEntry **end)
|
||||
{
|
||||
TSFieldMapSlice slice;
|
||||
|
|
|
|||
|
|
@ -13,22 +13,22 @@
|
|||
#include "me/types.h"
|
||||
#include "parser/language.h"
|
||||
|
||||
t_u32 ts_language_symbol_count(const TSLanguage *self)
|
||||
t_u32 ts_language_symbol_count(const t_language *self)
|
||||
{
|
||||
return (self->symbol_count + self->alias_count);
|
||||
}
|
||||
|
||||
t_u32 ts_language_state_count(const TSLanguage *self)
|
||||
t_u32 ts_language_state_count(const t_language *self)
|
||||
{
|
||||
return (self->state_count);
|
||||
}
|
||||
|
||||
t_u32 ts_language_version(const TSLanguage *self)
|
||||
t_u32 ts_language_version(const t_language *self)
|
||||
{
|
||||
return (self->version);
|
||||
}
|
||||
|
||||
t_u32 ts_language_field_count(const TSLanguage *self)
|
||||
t_u32 ts_language_field_count(const t_language *self)
|
||||
{
|
||||
return (self->field_count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@
|
|||
#include "parser/language.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
bool ts_language_has_actions(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol)
|
||||
bool ts_language_has_actions(const t_language *self, t_state_id state,
|
||||
t_symbol symbol)
|
||||
{
|
||||
return (ts_language_lookup(self, state, symbol) != 0);
|
||||
}
|
||||
|
||||
const bool *ts_language_enabled_external_tokens(const TSLanguage *self,
|
||||
const bool *ts_language_enabled_external_tokens(const t_language *self,
|
||||
t_u32 external_scanner_state)
|
||||
{
|
||||
if (external_scanner_state == 0)
|
||||
|
|
@ -31,7 +31,7 @@ const bool *ts_language_enabled_external_tokens(const TSLanguage *self,
|
|||
+ self->external_token_count * external_scanner_state);
|
||||
}
|
||||
|
||||
const TSSymbol *ts_language_alias_sequence(const TSLanguage *self,
|
||||
const t_symbol *ts_language_alias_sequence(const t_language *self,
|
||||
t_u32 production_id)
|
||||
{
|
||||
if (production_id)
|
||||
|
|
@ -41,7 +41,7 @@ const TSSymbol *ts_language_alias_sequence(const TSLanguage *self,
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
TSSymbol ts_language_alias_at(const TSLanguage *self, t_u32 production_id,
|
||||
t_symbol ts_language_alias_at(const t_language *self, t_u32 production_id,
|
||||
t_u32 child_index)
|
||||
{
|
||||
if (production_id)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
#include "parser/language.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
void ts_language_table_entry(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol, TableEntry *result)
|
||||
void ts_language_table_entry(const t_language *self, t_state_id state,
|
||||
t_symbol symbol, TableEntry *result)
|
||||
{
|
||||
t_u32 action_index;
|
||||
const TSParseActionEntry *entry;
|
||||
|
|
@ -37,8 +37,8 @@ void ts_language_table_entry(const TSLanguage *self, TSStateId state,
|
|||
}
|
||||
}
|
||||
|
||||
TSStateId ts_language_next_state(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol)
|
||||
t_state_id ts_language_next_state(const t_language *self, t_state_id state,
|
||||
t_symbol symbol)
|
||||
{
|
||||
t_u32 count;
|
||||
const TSParseAction *actions;
|
||||
|
|
@ -67,8 +67,8 @@ TSStateId ts_language_next_state(const TSLanguage *self, TSStateId state,
|
|||
return (ts_language_lookup(self, state, symbol));
|
||||
}
|
||||
|
||||
const TSParseAction *ts_language_actions(const TSLanguage *self,
|
||||
TSStateId state, TSSymbol symbol, t_u32 *count)
|
||||
const TSParseAction *ts_language_actions(const t_language *self,
|
||||
t_state_id state, t_symbol symbol, t_u32 *count)
|
||||
{
|
||||
TableEntry entry;
|
||||
|
||||
|
|
@ -77,8 +77,8 @@ const TSParseAction *ts_language_actions(const TSLanguage *self,
|
|||
return (entry.actions);
|
||||
}
|
||||
|
||||
bool ts_language_has_reduce_action(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol)
|
||||
bool ts_language_has_reduce_action(const t_language *self, t_state_id state,
|
||||
t_symbol symbol)
|
||||
{
|
||||
TableEntry entry;
|
||||
|
||||
|
|
@ -94,8 +94,8 @@ bool ts_language_has_reduce_action(const TSLanguage *self, TSStateId state,
|
|||
// For 'large' parse states, this is a direct lookup. For 'small' parse
|
||||
// states, this requires searching through the symbol groups to find
|
||||
// the given symbol.
|
||||
t_u16 ts_language_lookup(const TSLanguage *self, TSStateId state,
|
||||
TSSymbol symbol)
|
||||
t_u16 ts_language_lookup(const t_language *self, t_state_id state,
|
||||
t_symbol symbol)
|
||||
{
|
||||
if (state >= self->large_state_count)
|
||||
return (me_abort("we got a small parse table, which isn't supported"),
|
||||
|
|
|
|||
|
|
@ -16,25 +16,25 @@
|
|||
#include "parser/language.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
TSSymbolMetadata ts_language_symbol_metadata(const TSLanguage *self,
|
||||
TSSymbol symbol)
|
||||
t_symbol_metadata ts_language_symbol_metadata(const t_language *self,
|
||||
t_symbol symbol)
|
||||
{
|
||||
if (symbol == ts_builtin_sym_error)
|
||||
return ((TSSymbolMetadata){.visible = true, .named = true});
|
||||
return ((t_symbol_metadata){.visible = true, .named = true});
|
||||
else if (symbol == ts_builtin_sym_error_repeat)
|
||||
return ((TSSymbolMetadata){.visible = false, .named = false});
|
||||
return ((t_symbol_metadata){.visible = false, .named = false});
|
||||
else
|
||||
return (self->symbol_metadata[symbol]);
|
||||
}
|
||||
|
||||
TSSymbol ts_language_public_symbol(const TSLanguage *self, TSSymbol symbol)
|
||||
t_symbol ts_language_public_symbol(const t_language *self, t_symbol symbol)
|
||||
{
|
||||
if (symbol == ts_builtin_sym_error)
|
||||
return (symbol);
|
||||
return (self->public_symbol_map[symbol]);
|
||||
}
|
||||
|
||||
t_const_str ts_language_symbol_name(const TSLanguage *self, TSSymbol symbol)
|
||||
t_const_str ts_language_symbol_name(const t_language *self, t_symbol symbol)
|
||||
{
|
||||
if (symbol == ts_builtin_sym_error)
|
||||
return ("ERROR");
|
||||
|
|
@ -46,12 +46,12 @@ t_const_str ts_language_symbol_name(const TSLanguage *self, TSSymbol symbol)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
TSSymbol ts_language_symbol_for_name(const TSLanguage *self,
|
||||
t_symbol ts_language_symbol_for_name(const t_language *self,
|
||||
t_const_str string, t_u32 length, bool is_named)
|
||||
{
|
||||
TSSymbolMetadata metadata;
|
||||
t_symbol_metadata metadata;
|
||||
t_u16 count;
|
||||
TSSymbol i;
|
||||
t_symbol i;
|
||||
t_const_str symbol_name;
|
||||
|
||||
if (str_n_compare(string, "ERROR", length))
|
||||
|
|
@ -75,15 +75,15 @@ TSSymbol ts_language_symbol_for_name(const TSLanguage *self,
|
|||
return (0);
|
||||
}
|
||||
|
||||
TSSymbolType ts_language_symbol_type(const TSLanguage *self, TSSymbol symbol)
|
||||
t_symbol_type ts_language_symbol_type(const t_language *self, t_symbol symbol)
|
||||
{
|
||||
TSSymbolMetadata metadata;
|
||||
t_symbol_metadata metadata;
|
||||
|
||||
metadata = ts_language_symbol_metadata(self, symbol);
|
||||
if (metadata.named && metadata.visible)
|
||||
return (TSSymbolTypeRegular);
|
||||
return (t_symbol_typeRegular);
|
||||
else if (metadata.visible)
|
||||
return (TSSymbolTypeAnonymous);
|
||||
return (t_symbol_typeAnonymous);
|
||||
else
|
||||
return (TSSymbolTypeAuxiliary);
|
||||
return (t_symbol_typeAuxiliary);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@
|
|||
#include "parser/language.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
void ts_language_aliases_for_symbol(const TSLanguage *self,
|
||||
TSSymbol original_symbol, const TSSymbol **start, const TSSymbol **end)
|
||||
void ts_language_aliases_for_symbol(const t_language *self,
|
||||
t_symbol original_symbol, const t_symbol **start, const t_symbol **end)
|
||||
{
|
||||
t_u32 idx;
|
||||
TSSymbol symbol;
|
||||
t_symbol symbol;
|
||||
t_u16 count;
|
||||
|
||||
*start = &self->public_symbol_map[original_symbol];
|
||||
|
|
@ -41,7 +41,7 @@ void ts_language_aliases_for_symbol(const TSLanguage *self,
|
|||
}
|
||||
}
|
||||
|
||||
bool ts_language_is_symbol_external(const TSLanguage *self, TSSymbol symbol)
|
||||
bool ts_language_is_symbol_external(const t_language *self, t_symbol symbol)
|
||||
{
|
||||
return (0 < symbol && symbol < self->external_token_count + 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue