Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
stack.c File Reference
#include "./alloc.h"
#include "./language.h"
#include "./subtree.h"
#include "./array.h"
#include "./stack.h"
#include "./length.h"
#include <assert.h>
#include <stdio.h>

Data Structures

struct  StackLink
 
struct  StackNode
 
struct  StackIterator
 
struct  StackIterateSession
 
struct  StackHead
 
struct  Stack
 
struct  SummarizeStackSession
 

Macros

#define MAX_LINK_COUNT   8
 
#define MAX_NODE_POOL_SIZE   50
 
#define MAX_ITERATOR_COUNT   64
 
#define inline   static inline __attribute__((always_inline))
 

Typedefs

typedef struct StackNode StackNode
 
typedef unsigned StackAction
 
typedef StackAction(* StackCallback) (void *, const StackIterator *)
 

Enumerations

enum  { StackActionNone, StackActionStop = 1, StackActionPop = 2 }
 

Functions

typedef Array (StackNode *)
 
StackSliceArray stack__iter (Stack *self, StackVersion version, StackCallback callback, void *payload, int goal_subtree_count)
 
Stackts_stack_new (SubtreePool *subtree_pool)
 
void ts_stack_delete (Stack *self)
 
uint32_t ts_stack_version_count (const Stack *self)
 
TSStateId ts_stack_state (const Stack *self, StackVersion version)
 
Length ts_stack_position (const Stack *self, StackVersion version)
 
Subtree ts_stack_last_external_token (const Stack *self, StackVersion version)
 
void ts_stack_set_last_external_token (Stack *self, StackVersion version, Subtree token)
 
unsigned ts_stack_error_cost (const Stack *self, StackVersion version)
 
unsigned ts_stack_node_count_since_error (const Stack *self, StackVersion version)
 
void ts_stack_push (Stack *self, StackVersion version, Subtree subtree, bool pending, TSStateId state)
 
StackAction iterate_callback (void *payload, const StackIterator *iterator)
 
void ts_stack_iterate (Stack *self, StackVersion version, StackIterateCallback callback, void *payload)
 
StackAction pop_count_callback (void *payload, const StackIterator *iterator)
 
StackSliceArray ts_stack_pop_count (Stack *self, StackVersion version, uint32_t count)
 
StackAction pop_pending_callback (void *payload, const StackIterator *iterator)
 
StackSliceArray ts_stack_pop_pending (Stack *self, StackVersion version)
 
StackAction pop_error_callback (void *payload, const StackIterator *iterator)
 
SubtreeArray ts_stack_pop_error (Stack *self, StackVersion version)
 
StackAction pop_all_callback (void *payload, const StackIterator *iterator)
 
StackSliceArray ts_stack_pop_all (Stack *self, StackVersion version)
 
StackAction summarize_stack_callback (void *payload, const StackIterator *iterator)
 
void ts_stack_record_summary (Stack *self, StackVersion version, unsigned max_depth)
 
StackSummary * ts_stack_get_summary (Stack *self, StackVersion version)
 
int ts_stack_dynamic_precedence (Stack *self, StackVersion version)
 
bool ts_stack_has_advanced_since_error (const Stack *self, StackVersion version)
 
void ts_stack_remove_version (Stack *self, StackVersion version)
 
void ts_stack_renumber_version (Stack *self, StackVersion v1, StackVersion v2)
 
void ts_stack_swap_versions (Stack *self, StackVersion v1, StackVersion v2)
 
StackVersion ts_stack_copy_version (Stack *self, StackVersion version)
 
bool ts_stack_merge (Stack *self, StackVersion version1, StackVersion version2)
 
bool ts_stack_can_merge (Stack *self, StackVersion version1, StackVersion version2)
 
void ts_stack_halt (Stack *self, StackVersion version)
 
void ts_stack_pause (Stack *self, StackVersion version, TSSymbol lookahead)
 
bool ts_stack_is_active (const Stack *self, StackVersion version)
 
bool ts_stack_is_halted (const Stack *self, StackVersion version)
 
bool ts_stack_is_paused (const Stack *self, StackVersion version)
 
TSSymbol ts_stack_resume (Stack *self, StackVersion version)
 
void ts_stack_clear (Stack *self)
 
bool ts_stack_print_dot_graph (Stack *self, const TSLanguage *language, FILE *f)
 

Variables

 StackStatus
 

Macro Definition Documentation

#define inline   static inline __attribute__((always_inline))
#define MAX_ITERATOR_COUNT   64
#define MAX_LINK_COUNT   8
#define MAX_NODE_POOL_SIZE   50

Typedef Documentation

typedef unsigned StackAction
typedef StackAction(* StackCallback) (void *, const StackIterator *)
typedef struct StackNode StackNode

Enumeration Type Documentation

anonymous enum
Enumerator
StackActionNone 
StackActionStop 
StackActionPop 

Function Documentation

typedef Array ( StackNode )
StackAction iterate_callback ( void payload,
const StackIterator iterator 
)
inline
StackAction pop_all_callback ( void payload,
const StackIterator iterator 
)
inline
StackAction pop_count_callback ( void payload,
const StackIterator iterator 
)
inline
StackAction pop_error_callback ( void payload,
const StackIterator iterator 
)
inline
StackAction pop_pending_callback ( void payload,
const StackIterator iterator 
)
inline
StackSliceArray stack__iter ( Stack self,
StackVersion  version,
StackCallback  callback,
void payload,
int  goal_subtree_count 
)
inline
StackAction summarize_stack_callback ( void payload,
const StackIterator iterator 
)
inline
bool ts_stack_can_merge ( Stack self,
StackVersion  version1,
StackVersion  version2 
)
void ts_stack_clear ( Stack self)
StackVersion ts_stack_copy_version ( Stack self,
StackVersion  version 
)
void ts_stack_delete ( Stack self)
int ts_stack_dynamic_precedence ( Stack self,
StackVersion  version 
)
unsigned ts_stack_error_cost ( const Stack self,
StackVersion  version 
)
StackSummary* ts_stack_get_summary ( Stack self,
StackVersion  version 
)
void ts_stack_halt ( Stack self,
StackVersion  version 
)
bool ts_stack_has_advanced_since_error ( const Stack self,
StackVersion  version 
)
bool ts_stack_is_active ( const Stack self,
StackVersion  version 
)
bool ts_stack_is_halted ( const Stack self,
StackVersion  version 
)
bool ts_stack_is_paused ( const Stack self,
StackVersion  version 
)
void ts_stack_iterate ( Stack self,
StackVersion  version,
StackIterateCallback  callback,
void payload 
)
Subtree ts_stack_last_external_token ( const Stack self,
StackVersion  version 
)
bool ts_stack_merge ( Stack self,
StackVersion  version1,
StackVersion  version2 
)
Stack* ts_stack_new ( SubtreePool subtree_pool)
unsigned ts_stack_node_count_since_error ( const Stack self,
StackVersion  version 
)
void ts_stack_pause ( Stack self,
StackVersion  version,
TSSymbol  lookahead 
)
StackSliceArray ts_stack_pop_all ( Stack self,
StackVersion  version 
)
StackSliceArray ts_stack_pop_count ( Stack self,
StackVersion  version,
uint32_t  count 
)
SubtreeArray ts_stack_pop_error ( Stack self,
StackVersion  version 
)
StackSliceArray ts_stack_pop_pending ( Stack self,
StackVersion  version 
)
Length ts_stack_position ( const Stack self,
StackVersion  version 
)
bool ts_stack_print_dot_graph ( Stack self,
const TSLanguage language,
FILE *  f 
)
void ts_stack_push ( Stack self,
StackVersion  version,
Subtree  subtree,
bool  pending,
TSStateId  state 
)
void ts_stack_record_summary ( Stack self,
StackVersion  version,
unsigned  max_depth 
)
void ts_stack_remove_version ( Stack self,
StackVersion  version 
)
void ts_stack_renumber_version ( Stack self,
StackVersion  v1,
StackVersion  v2 
)
TSSymbol ts_stack_resume ( Stack self,
StackVersion  version 
)
void ts_stack_set_last_external_token ( Stack self,
StackVersion  version,
Subtree  token 
)
TSStateId ts_stack_state ( const Stack self,
StackVersion  version 
)
void ts_stack_swap_versions ( Stack self,
StackVersion  v1,
StackVersion  v2 
)
uint32_t ts_stack_version_count ( const Stack self)

Variable Documentation

StackStatus