style(lib): add parameter names in declarations that are missing them

This commit is contained in:
Amaan Qureshi 2024-09-27 13:22:00 -04:00
parent 28972f916a
commit 50eaf0b6cd
7 changed files with 72 additions and 77 deletions

View file

@ -7,7 +7,6 @@ extern "C" {
#include "./array.h"
#include "./subtree.h"
#include "./error_costs.h"
#include <stdio.h>
typedef struct Stack Stack;
@ -29,23 +28,23 @@ typedef struct {
typedef Array(StackSummaryEntry) StackSummary;
// Create a stack.
Stack *ts_stack_new(SubtreePool *);
Stack *ts_stack_new(SubtreePool *subtree_pool);
// Release the memory reserved for a given stack.
void ts_stack_delete(Stack *);
void ts_stack_delete(Stack *self);
// Get the stack's current number of versions.
uint32_t ts_stack_version_count(const Stack *);
uint32_t ts_stack_version_count(const Stack *self);
// Get the state at the top of the given version of the stack. If the stack is
// empty, this returns the initial state, 0.
TSStateId ts_stack_state(const Stack *, StackVersion);
TSStateId ts_stack_state(const Stack *self, StackVersion version);
// Get the last external token associated with a given version of the stack.
Subtree ts_stack_last_external_token(const Stack *, StackVersion);
Subtree ts_stack_last_external_token(const Stack *self, StackVersion version);
// Set the last external token associated with a given version of the stack.
void ts_stack_set_last_external_token(Stack *, StackVersion, Subtree );
void ts_stack_set_last_external_token(Stack *self, StackVersion version, Subtree token);
// Get the position of the given version of the stack within the document.
Length ts_stack_position(const Stack *, StackVersion);
@ -55,76 +54,74 @@ Length ts_stack_position(const Stack *, StackVersion);
// This transfers ownership of the tree to the Stack. Callers that
// need to retain ownership of the tree for their own purposes should
// first retain the tree.
void ts_stack_push(Stack *, StackVersion, Subtree , bool, TSStateId);
void ts_stack_push(Stack *self, StackVersion version, Subtree subtree, bool pending, TSStateId state);
// Pop the given number of entries from the given version of the stack. This
// operation can increase the number of stack versions by revealing multiple
// versions which had previously been merged. It returns an array that
// specifies the index of each revealed version and the trees that were
// removed from that version.
StackSliceArray ts_stack_pop_count(Stack *, StackVersion, uint32_t count);
StackSliceArray ts_stack_pop_count(Stack *self, StackVersion version, uint32_t count);
// Remove an error at the top of the given version of the stack.
SubtreeArray ts_stack_pop_error(Stack *, StackVersion);
SubtreeArray ts_stack_pop_error(Stack *self, StackVersion version);
// Remove any pending trees from the top of the given version of the stack.
StackSliceArray ts_stack_pop_pending(Stack *, StackVersion);
StackSliceArray ts_stack_pop_pending(Stack *self, StackVersion version);
// Remove any all trees from the given version of the stack.
StackSliceArray ts_stack_pop_all(Stack *, StackVersion);
// Remove all trees from the given version of the stack.
StackSliceArray ts_stack_pop_all(Stack *self, StackVersion version);
// Get the maximum number of tree nodes reachable from this version of the stack
// since the last error was detected.
unsigned ts_stack_node_count_since_error(const Stack *, StackVersion);
unsigned ts_stack_node_count_since_error(const Stack *self, StackVersion version);
int ts_stack_dynamic_precedence(Stack *, StackVersion);
int ts_stack_dynamic_precedence(Stack *self, StackVersion version);
bool ts_stack_has_advanced_since_error(const Stack *, StackVersion);
bool ts_stack_has_advanced_since_error(const Stack *self, StackVersion version);
// Compute a summary of all the parse states near the top of the given
// version of the stack and store the summary for later retrieval.
void ts_stack_record_summary(Stack *, StackVersion, unsigned max_depth);
void ts_stack_record_summary(Stack *self, StackVersion version, unsigned max_depth);
// Retrieve a summary of all the parse states near the top of the
// given version of the stack.
StackSummary *ts_stack_get_summary(Stack *, StackVersion);
StackSummary *ts_stack_get_summary(Stack *self, StackVersion version);
// Get the total cost of all errors on the given version of the stack.
unsigned ts_stack_error_cost(const Stack *, StackVersion version);
unsigned ts_stack_error_cost(const Stack *self, StackVersion version);
// Merge the given two stack versions if possible, returning true
// if they were successfully merged and false otherwise.
bool ts_stack_merge(Stack *, StackVersion, StackVersion);
bool ts_stack_merge(Stack *self, StackVersion version1, StackVersion version2);
// Determine whether the given two stack versions can be merged.
bool ts_stack_can_merge(Stack *, StackVersion, StackVersion);
bool ts_stack_can_merge(Stack *self, StackVersion version1, StackVersion version2);
Subtree ts_stack_resume(Stack *, StackVersion);
Subtree ts_stack_resume(Stack *self, StackVersion version);
void ts_stack_pause(Stack *, StackVersion, Subtree);
void ts_stack_pause(Stack *self, StackVersion version, Subtree lookahead);
void ts_stack_halt(Stack *, StackVersion);
void ts_stack_halt(Stack *self, StackVersion version);
bool ts_stack_is_active(const Stack *, StackVersion);
bool ts_stack_is_active(const Stack *self, StackVersion version);
bool ts_stack_is_paused(const Stack *, StackVersion);
bool ts_stack_is_paused(const Stack *self, StackVersion version);
bool ts_stack_is_halted(const Stack *, StackVersion);
bool ts_stack_is_halted(const Stack *self, StackVersion version);
void ts_stack_renumber_version(Stack *, StackVersion, StackVersion);
void ts_stack_renumber_version(Stack *self, StackVersion v1, StackVersion v2);
void ts_stack_swap_versions(Stack *, StackVersion, StackVersion);
void ts_stack_swap_versions(Stack *, StackVersion v1, StackVersion v2);
StackVersion ts_stack_copy_version(Stack *, StackVersion);
StackVersion ts_stack_copy_version(Stack *self, StackVersion version);
// Remove the given version from the stack.
void ts_stack_remove_version(Stack *, StackVersion);
void ts_stack_remove_version(Stack *self, StackVersion version);
void ts_stack_clear(Stack *);
void ts_stack_clear(Stack *self);
bool ts_stack_print_dot_graph(Stack *, const TSLanguage *, FILE *);
typedef void (*StackIterateCallback)(void *, TSStateId, uint32_t);
bool ts_stack_print_dot_graph(Stack *self, const TSLanguage *language, FILE *f);
#ifdef __cplusplus
}