yumapro
24.10-3
YumaPro SDK
|
NCX Syntax Token Handler. More...
Go to the source code of this file.
Data Structures | |
struct | tk_origstr_t |
each entry in the origstrQ is the 2nd through Nth string to be concated. More... | |
struct | tk_token_t |
single YANG language token type More... | |
struct | tk_token_ptr_t |
token backptr to get at original token chain for strings used only by yangdump –format=yang|html More... | |
struct | tk_chain_t |
token parsing chain (main parser control block) More... | |
Macros | |
#define | TK_BUFF_SIZE 0xffff |
maximum line size allowed in an YANG module | |
#define | TK_NEXT(T) ((tk_token_t *)dlq_nextEntry(T)) |
move through token chain without advancing the cur pointer | |
#define | TK_TYP(T) ((T)->typ) |
return the token type | |
#define | TK_ID(T) ((T)->typ==TK_TT_TSTRING || (T)->typ==TK_TT_MSTRING) |
return TRUE if the token type is an identifier | |
#define | TK_VAL(T) (T)->val |
return the token value | |
#define | TK_NSID(T) (T)->nsid |
return the token namespace ID value | |
#define | TK_MOD(T) (T)->mod |
return the token prefix pointer if any | |
#define | TK_ADV(T) |
advance the current token pointer | |
#define | TK_BKUP(T) |
back-up the current token pointer | |
#define | TK_CUR(T) ((T)->cur) |
return the current token | |
#define | TK_CUR_TYP(T) ((T)->cur->typ) |
return the current token type | |
#define | TK_CUR_VAL(T) ((T)->cur->val) |
return the current token value | |
#define | TK_CUR_LEN(T) ((T)->cur->len) |
return the current token value length | |
#define | TK_CUR_MOD(T) (T)->cur->mod |
return the current token module qualifier value | |
#define | TK_CUR_MODLEN(T) ((T)->cur->modlen) |
return the current token module qualifier value length | |
#define | TK_CUR_STR(T) |
return TRUE if the current token type is a string | |
#define | TK_TYP_STR(T) ((T) >= TK_TT_STRING && (T) <= TK_TT_SQSTRING) |
return TRUE if the specified token type is a string | |
#define | TK_CUR_NOWSTR(T) |
return TRUE if the cur tk type allows a non-whitespace string | |
#define | TK_CUR_NUM(T) |
return TRUE if the current token type is a number | |
#define | TK_TYP_NUM(T) (((T) >= TK_TT_DNUM) && ((T) <= TK_TT_RNUM)) |
return TRUE if the specified token type is a number | |
#define | TK_CUR_INUM(T) |
return TRUE if the current token type is an integral number | |
#define | TK_CUR_IQUAL(T) |
return TRUE if the current token type is an instance qualifier | |
#define | TK_CUR_ID(T) |
return TRUE if the current token type is an identifier | |
#define | TK_CUR_SID(T) |
return TRUE if the current token type is a scoped identifier | |
#define | TK_CUR_LNUM(T) ((T)->cur->linenum) |
return the current line number | |
#define | TK_CUR_LPOS(T) ((T)->cur->linepos) |
return the current line position | |
#define | TK_CUR_TEXT(T) |
return TRUE if the token is a text or number type, as opposed to a 1 or 2 char non-text token type YPW-1763: the plain string type should also be accepted | |
#define | TK_CUR_NSID(T) (T)->cur->nsid |
return the namespace ID field in the token | |
#define | TK_DOCMODE(TKC) ((TKC)->flags & TK_FL_DOCMODE) |
return non-zero if token preservation docmode | |
#define | TK_HAS_ORIGTK(TK) |
token has an origval saved | |
#define | TK_SET_ESCERR(TK) (TK)->flags |= TK_FL_ESCSTR_ERR |
SET access the escaped string error fields. | |
#define | TK_GET_ESCERR(TK) ((TK)->flags & TK_FL_ESCSTR_ERR) |
GET access the escaped string error fields. | |
#define | TK_FL_REDO bit0 |
start bits for tk_chain_t flags field == 1: the current parse call is to redo a previously parsed token == 0: normal parse mode | |
#define | TK_FL_MALLOC bit1 |
== 1: the tkc->buff field is malloced by this module and will be freed in tk_free_chain == 0: the tkc->buff memory was provided externally and will not be freed in tk_free_chain | |
#define | TK_FL_DOCMODE bit2 |
== 1: DOC mode: the tk->origtkQ field will be used to preserve pre-string concat and processing == 0: normal mode: the tkc->origtkQ will not be used and only the result token will be saved | |
#define | TK_FL_BINARYMODE bit3 |
== 1: BINARY mode: the tkc->buff buffer is allowed to contain binary characters == 0: TEXT mode: the tkc->buff is not allowed to contain binary characters | |
#define | TK_FL_ESCSTR_ERR bit4 |
== 1: escerr fields are set for YANG 1.1 illegal escaped char 1 or more double-quoted strings have been converted == 0: no escerr was detected in the parsed tokens | |
#define | TK_FL_VAL_MALLOC bit0 |
start flags for the tk->flags field == 1: VAL malloc: the tk->val field is malloced == 0: VAL buffer: tk->val points to tk->valbuff | |
#define | TK_FL_ORIGVAL_MALLOC bit1 |
== 1: ORIGVAL malloc: the tk->origval field is malloced == 0: ORIGVAL buffer: tk->origval points to tk->valbuff | |
Typedefs | |
typedef status_t(* | tk_getline_fn_t) (xmlChar *fillbuff, uint32 fillbuffsize, void *cookie) |
callback function to read a line into a buffer More... | |
Enumerations | |
enum | tk_type_t { } |
different types of tokens parsed during 1st pass More... | |
enum | tk_source_t { TK_SOURCE_CONF , TK_SOURCE_YANG , TK_SOURCE_XPATH , TK_SOURCE_REDO , TK_SOURCE_JSON , TK_SOURCE_FIELDS , TK_SOURCE_FEATURE , TK_SOURCE_CLI } |
token source context More... | |
enum | tk_origstr_typ_t { } |
preserve the original string type More... | |
Functions | |
tk_chain_t * | tk_new_chain (void) |
Allocatate a new token parse chain. More... | |
void | tk_setup_chain_conf (tk_chain_t *tkc, FILE *fp, const xmlChar *filename) |
Setup a previously allocated chain for a text config file. More... | |
void | tk_setup_chain_cli (tk_chain_t *tkc, xmlChar *line) |
Setup a previously allocated chain for a CLI command line. More... | |
void | tk_setup_chain_fields (tk_chain_t *tkc, xmlChar *str) |
Setup a previously allocated chain for 'fields' RESTCONF query parameter str value. More... | |
void | tk_setup_chain_feature (tk_chain_t *tkc, xmlChar *str) |
Setup a previously allocated chain for 'if-feature' YANG 1.1. More... | |
void | tk_setup_chain_yang (tk_chain_t *tkc, FILE *fp, const xmlChar *filename) |
Setup a previously allocated chain for a YANG file. More... | |
void | tk_setup_chain_yin (tk_chain_t *tkc, const xmlChar *filename) |
Setup a previously allocated chain for a YIN file. More... | |
void | tk_setup_chain_json_file (tk_chain_t *tkc, FILE *fp, const xmlChar *filename) |
Setup a previously allocated chain for a JSON input stream. More... | |
void | tk_setup_chain_json_buffer (tk_chain_t *tkc, xmlChar *buff) |
Setup a previously allocated chain for a JSON buffer. More... | |
void | tk_setup_chain_json_buffs (tk_chain_t *tkc, tk_getline_fn_t getline_fn, void *cookie) |
Setup a previously allocated chain for a JSON buffer chain. More... | |
void | tk_setup_chain_docmode (tk_chain_t *tkc) |
Setup a previously allocated chain for a yangdump docmode output. More... | |
void | tk_setup_chain_cli_line (tk_chain_t *tkc, xmlChar *str) |
Setup a previously allocated chain for yangcli CLI line of input. More... | |
void | tk_free_chain (tk_chain_t *tkc) |
Cleanup and deallocate a tk_chain_t. More... | |
ncx_btype_t | tk_get_yang_btype_id (const xmlChar *buff, uint32 len) |
Check if the specified string is a YANG builtin type name checks for valid YANG data type name. More... | |
const char * | tk_get_token_name (tk_type_t ttyp) |
Get the symbolic token name. More... | |
const char * | tk_get_token_sym (tk_type_t ttyp) |
Get the symbolic token symbol. More... | |
const char * | tk_get_btype_sym (ncx_btype_t btyp) |
Get the symbolic token symbol for one of the base types. More... | |
tk_type_t | tk_next_typ (tk_chain_t *tkc) |
Get the token type of the next token. More... | |
tk_type_t | tk_next_typ2 (tk_chain_t *tkc) |
Get the token type of the token after the next token. More... | |
boolean | tk_next_is_null (tk_chain_t *tkc) |
Get the special sequence [null] is next. More... | |
const xmlChar * | tk_next_val (tk_chain_t *tkc) |
Get the token type of the next token. More... | |
void | tk_dump_token (const tk_token_t *tk) |
Debug printf the specified token !!! Very verbose !!! More... | |
void | tk_dump_chain (const tk_chain_t *tkc) |
Debug printf the token chain !!! Very verbose !!! More... | |
boolean | tk_is_wsp_string (const tk_token_t *tk) |
Check if the current token is a string with whitespace in it. More... | |
status_t | tk_tokenize_input (tk_chain_t *tkc, ncx_module_t *mod) |
Parse the input (FILE or buffer) into tk_token_t structs. More... | |
status_t | tk_retokenize_cur_string (tk_chain_t *tkc, ncx_module_t *mod) |
The current token is some sort of a string Reparse it according to the full YANG token list, as needed. More... | |
tk_chain_t * | tk_tokenize_metadata_string (ncx_module_t *mod, xmlChar *str, status_t *res) |
The specified ncx:metadata string is parsed into tokens convert the ncx:metadata content to 1 or 2 tokens. More... | |
tk_chain_t * | tk_tokenize_xpath_string (ncx_module_t *mod, xmlChar *str, uint32 curlinenum, uint32 curlinepos, status_t *res) |
The specified XPath string is parsed into tokens. More... | |
uint32 | tk_token_count (const tk_chain_t *tkc) |
Get the number of tokens in the queue. More... | |
void | tk_reset_chain (tk_chain_t *tkc) |
Reset the token chain current pointer to the start. More... | |
tk_chain_t * | tk_clone_chain (tk_chain_t *oldtkc) |
Allocatate and a new token parse chain and fill it with the specified token chain contents. More... | |
status_t | tk_add_id_token (tk_chain_t *tkc, const xmlChar *valstr) |
Allocatate a new ID token and add it to the parse chain. More... | |
status_t | tk_add_pid_token (tk_chain_t *tkc, const xmlChar *prefix, uint32 prefixlen, const xmlChar *valstr) |
Allocatate a new prefixed ID token and add it to the parse chain. More... | |
status_t | tk_add_string_token (tk_chain_t *tkc, const xmlChar *valstr) |
Allocatate a new string token and add it to the parse chain. More... | |
status_t | tk_add_lbrace_token (tk_chain_t *tkc) |
Allocatate a new left brace token and add it to the parse chain. More... | |
status_t | tk_add_rbrace_token (tk_chain_t *tkc) |
Allocatate a new right brace token and add it to the parse chain. More... | |
status_t | tk_add_semicol_token (tk_chain_t *tkc) |
Allocatate a new semi-colon token and add it to the parse chain. More... | |
status_t | tk_check_save_origstr (tk_chain_t *tkc, tk_token_t *tk, const void *field) |
Check the docmode and the specified token; Save a tk_origptr_t if needed with the field address. More... | |
const xmlChar * | tk_get_first_origstr (const tk_token_ptr_t *tkptr, boolean *dquote, boolean *morestr) |
Get the first original string to use. More... | |
const tk_origstr_t * | tk_first_origstr_rec (const tk_token_ptr_t *tkptr) |
Get the first tk_origstr_t struct (if any) More... | |
const tk_origstr_t * | tk_next_origstr_rec (const tk_origstr_t *origstr) |
Get the next tk_origstr_t struct (if any) More... | |
const xmlChar * | tk_get_origstr_parts (const tk_origstr_t *origstr, boolean *dquote, boolean *newline) |
Get the fields from the original string record. More... | |
const tk_token_ptr_t * | tk_find_tkptr (const tk_chain_t *tkc, const void *field) |
Find the specified token pointer record. More... | |
uint32 | tk_tkptr_quotes (const tk_token_ptr_t *tkptr) |
Get the specified token pointer record token ID type Use the first string or only string. More... | |
boolean | tk_cur_is_first (const tk_chain_t *tkc) |
Check if the current token is the first token. More... | |
NCX Syntax Token Handler.