|
libsnobol4 1.0.2
High-performance SNOBOL4-style pattern matching library
|
#include <ast.h>

Public Attributes | |
| ast_type_t | type |
| uint32_t | depth |
| bool | arena_allocated |
| union { | |
| struct { | |
| char * text | |
| size_t len | |
| } literal | |
| struct { | |
| ast_node_t ** parts | |
| size_t count | |
| } concat | |
| struct { | |
| ast_node_t * left | |
| ast_node_t * right | |
| } alt | |
| struct { | |
| ast_node_t * sub | |
| int32_t min | |
| int32_t max | |
| } repetition | |
| struct { | |
| char * set | |
| size_t len | |
| } charclass | |
| struct { | |
| ast_node_t * sub | |
| } arbno | |
| struct { | |
| int reg | |
| ast_node_t * sub | |
| } cap | |
| struct { | |
| int var | |
| int reg | |
| } assign | |
| struct { | |
| int32_t n | |
| } len | |
| struct { | |
| int fn | |
| int reg | |
| } eval | |
| struct { | |
| ast_node_t * expr | |
| } dynamic_eval | |
| struct { | |
| anchor_type_t atype | |
| } anchor | |
| struct { | |
| char * text | |
| size_t len | |
| int reg | |
| } emit | |
| struct { | |
| char * name | |
| ast_node_t * target | |
| } label | |
| struct { | |
| char * label | |
| } goto_stmt | |
| struct { | |
| char * table | |
| ast_node_t * key | |
| } table_access | |
| struct { | |
| char * table | |
| ast_node_t * key | |
| ast_node_t * value | |
| uint8_t value_reg | |
| } table_update | |
| struct { | |
| char * set | |
| size_t len | |
| } breakx | |
| struct { | |
| uint32_t open_cp | |
| uint32_t close_cp | |
| } bal | |
| struct { | |
| int32_t n | |
| } rpos_rtab | |
| struct { | |
| int reg | |
| } reg_ref | |
| } | data |
AST node - tagged union representation
Memory layout:
| struct { ... } ast_node::alt |
| struct { ... } ast_node::anchor |
| struct { ... } ast_node::arbno |
| bool ast_node::arena_allocated |
True when this node's storage was bump-allocated from the thread-local AST arena (see snobol_ast_set_arena). Such nodes must not be passed to free(); the owning arena is reset by the caller instead. Sub-allocations owned by the node (strings, concat part arrays) are always heap-allocated and freed individually by snobol_ast_free().
| struct { ... } ast_node::assign |
| anchor_type_t ast_node::atype |
| struct { ... } ast_node::bal |
| struct { ... } ast_node::breakx |
| struct { ... } ast_node::cap |
| struct { ... } ast_node::charclass |
| struct { ... } ast_node::concat |
| union { ... } ast_node::data |
| uint32_t ast_node::depth |
Height of this node's subtree, in nodes (a leaf is 1). Maintained in O(1) by the snobol_ast_create_*() factories and snobol_ast_clone(); the parser uses it to reject patterns whose nesting would exhaust the recursive AST walkers (see SNOBOL_PARSER_MAX_DEPTH).
| struct { ... } ast_node::dynamic_eval |
| struct { ... } ast_node::emit |
| struct { ... } ast_node::eval |
| ast_node_t* ast_node::expr |
| struct { ... } ast_node::goto_stmt |
| ast_node_t* ast_node::key |
| struct { ... } ast_node::label |
| ast_node_t* ast_node::left |
| struct { ... } ast_node::len |
| struct { ... } ast_node::literal |
| ast_node_t** ast_node::parts |
| struct { ... } ast_node::reg_ref |
| struct { ... } ast_node::repetition |
| ast_node_t* ast_node::right |
| struct { ... } ast_node::rpos_rtab |
| ast_node_t* ast_node::sub |
| struct { ... } ast_node::table_access |
| struct { ... } ast_node::table_update |
| ast_node_t* ast_node::target |
| ast_type_t ast_node::type |
| ast_node_t* ast_node::value |