From e710a14244a18535ed332f5854f1329e937541aa Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 26 Feb 2021 14:52:41 -0800 Subject: [PATCH] Simplify ts_language_has_actions so it allows non-terminals Fixes #933 --- lib/src/language.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/src/language.h b/lib/src/language.h index 47f63672..472eaea1 100644 --- a/lib/src/language.h +++ b/lib/src/language.h @@ -54,16 +54,6 @@ static inline const TSParseAction *ts_language_actions( return entry.actions; } -static inline bool ts_language_has_actions( - const TSLanguage *self, - TSStateId state, - TSSymbol symbol -) { - TableEntry entry; - ts_language_table_entry(self, state, symbol, &entry); - return entry.action_count > 0; -} - static inline bool ts_language_has_reduce_action( const TSLanguage *self, TSStateId state, @@ -103,6 +93,14 @@ static inline uint16_t ts_language_lookup( } } +static inline bool ts_language_has_actions( + const TSLanguage *self, + TSStateId state, + TSSymbol symbol +) { + return ts_language_lookup(self, state, symbol) != 0; +} + // Iterate over all of the symbols that are valid in the given state. // // For 'large' parse states, this just requires iterating through