#include "bootstrap.h"
Go to the source code of this file.
Namespaces | |
namespace | TinyaP |
Data Structures | |
class | TinyaP::AstNode |
class | TinyaP::Parser |
Defines | |
#define | TINYAP_VERSION PACKAGE_VERSION |
arbitrary and totally meaningless version string | |
#define | wi_new tinyap_wi_new |
#define | wi_reset tinyap_wi_reset |
#define | wi_delete tinyap_wi_delete |
#define | wi_node tinyap_wi_node |
#define | wi_up tinyap_wi_up |
#define | wi_down tinyap_wi_down |
#define | wi_next tinyap_wi_next |
#define | wi_backup tinyap_wi_backup |
#define | wi_restore tinyap_wi_restore |
#define | wi_validate tinyap_wi_validate |
#define | wi_root tinyap_wi_root |
#define | wi_root tinyap_wi_root |
#define | wi_dup tinyap_wi_dup |
#define | wi_on_root tinyap_wi_on_root |
#define | wi_on_leaf tinyap_wi_on_leaf |
#define | wi_has_next tinyap_wi_has_next |
Typedefs | |
typedef struct _tinyap_t * | tinyap_t |
typedef struct _walkable_ast_t * | wast_t |
typedef struct _wast_iter_t * | wast_iterator_t |
Functions | |
void | tinyap_init () |
initialize the tinyap environment. | |
tinyap_t | tinyap_new () |
create a new parser with default context. create a parser with "explicit" metagrammar dialect, " \r\t\n" whitespaces, and input from stdin. | |
const char * | tinyap_get_whitespace (tinyap_t) |
access to whitespace characters list | |
void | tinyap_set_whitespace (tinyap_t, const char *) |
modification of whitespace characters list | |
void | tinyap_set_whitespace_regexp (tinyap_t, const char *) |
modification of whitespace recognition regexp | |
const char * | tinyap_get_grammar (tinyap_t) |
access to grammar source | |
void | tinyap_set_grammar (tinyap_t, const char *) |
modification of grammar source (any filename, or "explicit" or "CamelCasing") | |
ast_node_t | tinyap_get_grammar_ast (tinyap_t) |
access to grammar ast | |
void | tinyap_set_grammar_ast (tinyap_t, ast_node_t) |
modification of grammar ast | |
const char * | tinyap_get_source_file (tinyap_t) |
access to filename of text input source (may be NULL) | |
const char * | tinyap_get_source_buffer (tinyap_t) |
access to buffer of text input source (i.e. contents of file or configured memory buffer) | |
unsigned int | tinyap_get_source_buffer_length (tinyap_t) |
access to length of text input source | |
void | tinyap_set_source_file (tinyap_t, const char *) |
set named file as text input CAUTION : if source filename is "-" or "stdin", standard input will be read until closed, and the function will block meanwhile. | |
void | tinyap_set_source_buffer (tinyap_t, const char *, const unsigned int) |
set buffer as text input source | |
int | tinyap_parse (tinyap_t) |
perform parsing of configured source with configured grammar | |
int | tinyap_parse_as_grammar (tinyap_t) |
perform parsing of configured source with configured grammar and uses the output as the new grammar | |
int | tinyap_parsed_ok (const tinyap_t) |
predicate "the last parsing was successful" | |
ast_node_t | tinyap_get_output (const tinyap_t) |
access to last parsing output | |
int | tinyap_get_error_col (const tinyap_t) |
get the column where the parsing error occured in source text (offsets start at 1) | |
int | tinyap_get_error_row (const tinyap_t) |
get the line where the parsing error occured in source text (offsets start at 1) | |
const char * | tinyap_get_error (const tinyap_t) |
get the source text around the parsing error, and a cursor indicating the column where the error occured | |
void | tinyap_delete (tinyap_t) |
delete an instance of a parser | |
void | tinyap_plug (tinyap_t parser, const char *plugin, const char *plug) |
plug (NT plugin) at head of (Alt) element of rule (* plug (Alt)). Plugs must have this form. | |
void | tinyap_plug_node (tinyap_t parser, ast_node_t pin, const char *plugin, const char *plug) |
plug pin at head of (Alt) element of rule (* plug (Alt)). Plugs must have this form. | |
void | tinyap_append_grammar (tinyap_t parser, ast_node_t supp) |
append this grammar to the existing grammar. | |
int | tinyap_node_is_nil (const ast_node_t) |
predicate "this node is nil" | |
int | tinyap_node_is_list (const ast_node_t) |
predicate "this node is a list" | |
unsigned int | tinyap_list_get_size (const ast_node_t) |
get the length of the list | |
ast_node_t | tinyap_list_get_element (const ast_node_t, int) |
access to the n-th element of this list | |
int | tinyap_node_is_string (const ast_node_t) |
predicate "this node is a string" | |
const char * | tinyap_node_get_string (const ast_node_t) |
access to the string value of this atom | |
ast_node_t | tinyap_node_get_operand (const ast_node_t, int) |
access to the n-th operand of this node ( (n+1)-th element of list) | |
int | tinyap_node_get_operand_count (const ast_node_t) |
get the number of operands in this node (count(list)-1) | |
const char * | tinyap_node_get_operator (const ast_node_t) |
get the operator label of this node | |
int | tinyap_node_get_row (const ast_node_t) |
get the row corresponding to this node in source text | |
int | tinyap_node_get_col (const ast_node_t) |
get the col corresponding to this node in source text | |
void | tinyap_serialize_to_file (const ast_node_t, const char *) |
serialize this node to the named file | |
const char * | tinyap_serialize_to_string (const ast_node_t) |
serialize this node into a new C string (must be freed by the user) | |
wast_t | tinyap_make_wast (const ast_node_t) |
make this AST walkable. | |
ast_node_t | tinyap_make_ast (const wast_t) |
make this walkable AST a serializable AST. | |
void | tinyap_free_wast (const wast_t) |
free this walkable AST. | |
wast_iterator_t | tinyap_wi_new (const wast_t) |
create an iterator on this AST. | |
wast_iterator_t | tinyap_wi_reset (wast_iterator_t) |
reset an iterator to its initial state (on root, backup cleared). | |
void | tinyap_wi_delete (wast_iterator_t) |
destroy an iterator on an AST. | |
wast_t | tinyap_wi_node (wast_iterator_t) |
get node under iterator | |
wast_iterator_t | tinyap_wi_up (wast_iterator_t) |
iterator jumps to parent | |
wast_iterator_t | tinyap_wi_down (wast_iterator_t) |
iterator jumps to first child | |
wast_iterator_t | tinyap_wi_next (wast_iterator_t) |
iterator jumps to next sibling | |
wast_iterator_t | tinyap_wi_backup (wast_iterator_t) |
backup iterator state | |
wast_iterator_t | tinyap_wi_restore (wast_iterator_t) |
restore iterator state | |
wast_iterator_t | tinyap_wi_validate (wast_iterator_t) |
forget previous backup | |
wast_t | tinyap_wi_root (wast_iterator_t) |
get iterator's root. | |
wast_t | tinyap_wi_parent (wast_iterator_t) |
get iterator's current parent. | |
wast_iterator_t | tinyap_wi_dup (const wast_iterator_t) |
predicate "iterator is on root", i.e. "NOT (node has a parent)" | |
int | tinyap_wi_on_root (wast_iterator_t) |
predicate "iterator is on root", i.e. "NOT (node has a parent)" | |
int | tinyap_wi_on_leaf (wast_iterator_t) |
predicate "iterator is on a leaf", i.e. "NOT (node has children)" | |
int | tinyap_wi_has_next (wast_iterator_t) |
predicate "iterator has a next sibling", i.e. "NOT (node is last child)" | |
const char * | tinyap_unparse (wast_t grammar, wast_t ast) |
Render the text buffer that generated the AST ast when parsed using grammar . | |
void * | tinyap_walk_output (const char *pilot_name, void *pilot_init_data) |
walk the current output using this named pilot with this init data. | |
void * | tinyap_walk (const wast_t subtree, const char *pilot_name, void *pilot_init_data) |
walk this subtree using this named pilot with this init data. |
#define TINYAP_VERSION PACKAGE_VERSION |
typedef struct _wast_iter_t* wast_iterator_t |