Data Structures |
| struct | map_byte |
| struct | regbyte_ctx |
| struct | emit |
| struct | error |
| struct | cond_oper |
| struct | cond |
| struct | spec |
| struct | rule |
| struct | dict |
| struct | barray |
| struct | bytepool |
| struct | map_str |
| struct | map_rule |
| struct | grammar_load_state |
Defines |
| #define | GRAMMAR_IMPLEMENT_LIST_APPEND(_Ty) |
Enumerations |
| enum | emit_type { et_byte,
et_stream,
et_position
} |
| enum | emit_dest { ed_output,
ed_regbyte
} |
| enum | cond_oper_type { cot_byte,
cot_regbyte
} |
| enum | cond_type { ct_equal,
ct_not_equal
} |
| enum | spec_type {
st_false,
st_true,
st_byte,
st_byte_range,
st_string,
st_identifier,
st_identifier_loop,
st_debug
} |
| enum | oper { op_none,
op_and,
op_or
} |
| enum | match_result {
mr_not_matched,
mr_matched,
mr_error_raised,
mr_dont_emit,
mr_internal_error
} |
Functions |
| static void | mem_free (void **) |
| static void | clear_last_error (void) |
| static void | set_last_error (const byte *msg, byte *param, int pos) |
| static void * | mem_alloc (size_t size) |
| static void * | mem_copy (void *dst, const void *src, size_t size) |
| static void * | mem_realloc (void *ptr, size_t old_size, size_t new_size) |
| static byte * | str_copy_n (byte *dst, const byte *src, size_t max_len) |
| static byte * | str_duplicate (const byte *str) |
| static int | str_equal (const byte *str1, const byte *str2) |
| static int | str_equal_n (const byte *str1, const byte *str2, unsigned int n) |
| static int | str_length (const byte *str) |
| static void | map_byte_create (map_byte **ma) |
| static void | map_byte_destroy (map_byte **ma) |
| static map_byte * | map_byte_locate (map_byte **ma, const byte *key) |
| static int | map_byte_find (map_byte **ma, const byte *key, byte *data) |
| static void | regbyte_ctx_create (regbyte_ctx **re) |
| static void | regbyte_ctx_destroy (regbyte_ctx **re) |
| static byte | regbyte_ctx_extract (regbyte_ctx **re, map_byte *reg) |
| static void | emit_create (emit **em) |
| static void | emit_destroy (emit **em) |
| static unsigned int | emit_size (emit *_E) |
| static int | emit_push (emit *_E, byte *_P, byte c, unsigned int _Pos, regbyte_ctx **_Ctx) |
| static void | error_create (error **er) |
| static void | error_destroy (error **er) |
| static byte * | error_get_token (error *, struct dict_ *, const byte *, int) |
| static void | cond_create (cond **co) |
| static void | cond_destroy (cond **co) |
| static void | spec_create (spec **sp) |
| static void | spec_destroy (spec **sp) |
| static void | rule_create (rule **ru) |
| static void | rule_destroy (rule **ru) |
| static grammar | next_valid_grammar_id (void) |
| static void | dict_create (dict **di) |
| static void | dict_destroy (dict **di) |
| static void | dict_find (dict **di, grammar key, dict **data) |
| static void | barray_create (barray **ba) |
| static void | barray_destroy (barray **ba) |
| static int | barray_resize (barray **ba, unsigned int nlen) |
| static int | barray_append (barray **ba, barray **nb) |
| static int | barray_push (barray **ba, emit *em, byte c, unsigned int pos, regbyte_ctx **rbc) |
| static void | bytepool_destroy (bytepool **by) |
| static void | bytepool_create (bytepool **by, int len) |
| static int | bytepool_reserve (bytepool *by, unsigned int n) |
| static void | map_str_create (map_str **ma) |
| static void | map_str_destroy (map_str **ma) |
| static int | map_str_find (map_str **ma, const byte *key, byte **data) |
| static void | map_rule_create (map_rule **ma) |
| static void | map_rule_destroy (map_rule **ma) |
| static int | map_rule_find (map_rule **ma, const byte *key, rule **data) |
| static int | is_space (byte c) |
| static int | eat_space (const byte **text) |
| static int | is_comment_start (const byte *text) |
| static int | eat_comment (const byte **text) |
| static void | eat_spaces (const byte **text) |
| static int | string_grow (byte **ptr, unsigned int *len, byte c) |
| static int | is_identifier (byte c) |
| static int | get_identifier (const byte **text, byte **id) |
| static unsigned int | dec_convert (const byte **text) |
| static int | is_hex (byte c) |
| static unsigned int | hex2dec (byte c) |
| static unsigned int | hex_convert (const byte **text) |
| static int | is_oct (byte c) |
| static int | oct2dec (byte c) |
| static byte | get_escape_sequence (const byte **text) |
| static int | get_string (const byte **text, byte **str) |
| static int | get_emtcode (const byte **text, map_byte **ma) |
| static int | get_regbyte (const byte **text, map_byte **ma) |
| static int | get_errtext (const byte **text, map_str **ma) |
| static int | get_error (const byte **text, error **er, map_str *maps) |
| static int | get_emits (const byte **text, emit **em, map_byte *mapb) |
| static int | get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb) |
| static int | get_rule (const byte **text, rule **ru, map_str *maps, map_byte *mapb) |
| static int | update_dependency (map_rule *mapr, byte *symbol, rule **ru) |
| static int | update_dependencies (dict *di, map_rule *mapr, byte **syntax_symbol, byte **string_symbol, map_byte *regbytes) |
| static int | satisfies_condition (cond *co, regbyte_ctx *ctx) |
| static void | free_regbyte_ctx_stack (regbyte_ctx *top, regbyte_ctx *limit) |
| static match_result | match (dict *di, const byte *text, int *index, rule *ru, barray **ba, int filtering_string, regbyte_ctx **rbc) |
| static match_result | fast_match (dict *di, const byte *text, int *index, rule *ru, int *_PP, bytepool *_BP, int filtering_string, regbyte_ctx **rbc) |
| static byte * | error_get_token (error *er, dict *di, const byte *text, int ind) |
| static void | grammar_load_state_create (grammar_load_state **gr) |
| static void | grammar_load_state_destroy (grammar_load_state **gr) |
| static void | error_msg (int line, const char *msg) |
| grammar | grammar_load_from_text (const byte *text) |
| int | grammar_set_reg8 (grammar id, const byte *name, byte value) |
| static int | _grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size, unsigned int estimate_prod_size, int use_fast_path) |
| int | grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size) |
| int | grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, unsigned int estimate_prod_size) |
| int | grammar_destroy (grammar id) |
| static void | append_character (const char x, byte *text, int *dots_made, int *len, int size) |
| void | grammar_get_last_error (byte *text, unsigned int size, int *pos) |
Variables |
| static const byte * | OUT_OF_MEMORY = "internal error 1001: out of physical memory" |
| static const byte * | UNRESOLVED_REFERENCE = "internal error 1002: unresolved reference '$'" |
| static const byte * | INVALID_GRAMMAR_ID = "internal error 1003: invalid grammar object" |
| static const byte * | INVALID_REGISTER_NAME = "internal error 1004: invalid register name: '$'" |
| static const byte * | UNREFERENCED_IDENTIFIER = "internal error 1006: unreferenced identifier '$'" |
| static const byte * | error_message = NULL |
| static byte * | error_param = NULL |
| static int | error_position = -1 |
| static byte * | unknown = "???" |
| static dict * | g_dicts = NULL |
syntax parsing engine
- Author:
- Michal Krol
Definition in file grammar.c.