yumapro  24.10-1
YumaPro SDK
Loading...
Searching...
No Matches
Compiler Token Processing

Convert YANG files and other syntaxes into a queue of tokens. More...

Collaboration diagram for Compiler Token Processing:

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_ttk_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_ttk_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_ttk_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_ttk_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_ttk_first_origstr_rec (const tk_token_ptr_t *tkptr)
 Get the first tk_origstr_t struct (if any) More...
 
const tk_origstr_ttk_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_ttk_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...
 

Detailed Description

Convert YANG files and other syntaxes into a queue of tokens.

Processes YANG, XPath, JSON, and other languages used by the YANG compiler and the server in protocol messages.

Typedef Documentation

◆ tk_getline_fn_t

typedef status_t(* tk_getline_fn_t) (xmlChar *fillbuff, uint32 fillbuffsize, void *cookie)

callback function to read a line into a buffer

Parameters
[out]fillbuffbuffer to contain the next input line
  • fillbuff has line copied into it; zero-terminated
fillbuffsizenumber of bytes allowed in fillbuff
cookieuser cookie passed at init time
Returns
status

Enumeration Type Documentation

◆ tk_origstr_typ_t

preserve the original string type

Enumerator
TK_ORIGSTR_DQUOTE 

double quote

TK_ORIGSTR_DQUOTE_NL 

souble quote + newline

TK_ORIGSTR_SQUOTE 

single quote

TK_ORIGSTR_SQUOTE_NL 

single quote + newline

◆ tk_source_t

token source context

Enumerator
TK_SOURCE_CONF 

config file

TK_SOURCE_YANG 

YANG.

TK_SOURCE_XPATH 

XPath.

TK_SOURCE_REDO 

redo internal mode

TK_SOURCE_JSON 

JSON.

TK_SOURCE_FIELDS 

RESTCONF fields parameter.

TK_SOURCE_FEATURE 

YANG 1.1 feature expr.

◆ tk_type_t

enum tk_type_t

different types of tokens parsed during 1st pass

Enumerator
TK_TT_LBRACE 

left brace '{'

TK_TT_RBRACE 

right brace '}'

TK_TT_SEMICOL 

semi-colon ';'

TK_TT_LPAREN 

left paren '('

TK_TT_RPAREN 

right paren ')'

TK_TT_LBRACK 

left bracket '['

TK_TT_RBRACK 

right bracket ']'

TK_TT_COMMA 

comma ','

TK_TT_EQUAL 

equal sign '='

TK_TT_BAR 

bar '|'

TK_TT_STAR 

star '*'

TK_TT_ATSIGN 

at sign '@'

TK_TT_PLUS 

plus mark '+'

TK_TT_COLON 

colon char ':'

TK_TT_PERIOD 

period char '.

'

TK_TT_FSLASH 

forward slash char '/'

TK_TT_MINUS 

minus char '-'

TK_TT_LT 

less than char '<'

TK_TT_GT 

greater than char '>'

TK_TT_RANGESEP 

range sep, parent node '..'

TK_TT_DBLCOLON 

2 colon chars '::'

TK_TT_DBLFSLASH 

2 fwd slashes '//'

TK_TT_NOTEQUAL 

not equal '!='

TK_TT_LEQUAL 

less than or equal '<='

TK_TT_GEQUAL 

greater than or equal '>='

TK_TT_STRING 

unquoted string

TK_TT_LINE 

raw command line

TK_TT_SSTRING 

scoped token string

TK_TT_TSTRING 

token string

TK_TT_MSTRING 

module-qualified token string

TK_TT_MSSTRING 

module-qualified scoped string

TK_TT_QSTRING 

double quoted string

TK_TT_SQSTRING 

single quoted string

TK_TT_VARBIND 

XPath varbind '$NCName'.

TK_TT_QVARBIND 

XPath varbind '$prefix:NCName'.

TK_TT_NCNAME_STAR 

XPath NCName:* sequence.

TK_TT_DNUM 

decimal number

TK_TT_HNUM 

hex number

TK_TT_RNUM 

real number

TK_TT_NEWLINE 


is significant in conf files

Function Documentation

◆ tk_add_id_token()

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.

Parameters
tkctoken chain to use
valstrID name
Returns
status
Here is the call graph for this function:

◆ tk_add_lbrace_token()

status_t tk_add_lbrace_token ( tk_chain_t tkc)

Allocatate a new left brace token and add it to the parse chain.

Parameters
tkctoken chain to use
Returns
status
Here is the call graph for this function:

◆ tk_add_pid_token()

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.

Parameters
tkctoken chain to use
prefixID prefix
prefixlen'prefix' length in bytes
valstrID name
Returns
status
Here is the call graph for this function:

◆ tk_add_rbrace_token()

status_t tk_add_rbrace_token ( tk_chain_t tkc)

Allocatate a new right brace token and add it to the parse chain.

Parameters
tkctoken chain to use
Returns
status
Here is the call graph for this function:

◆ tk_add_semicol_token()

status_t tk_add_semicol_token ( tk_chain_t tkc)

Allocatate a new semi-colon token and add it to the parse chain.

Parameters
tkctoken chain to use
Returns
status
Here is the call graph for this function:

◆ tk_add_string_token()

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.

Parameters
tkctoken chain to use
valstrstring value to use
Returns
status
Here is the call graph for this function:

◆ tk_check_save_origstr()

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.

Parameters
tkctoken chain to use
tktoken to use (usually TK_CUR())
fieldaddress of string field to save as the key
Returns
status; ERR_INTERNAL_MEM if entry cannot be malloced
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_clone_chain()

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.

Parameters
oldtkctoken chain to clone
Returns
new cloned parse chain or NULL if memory error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_cur_is_first()

boolean tk_cur_is_first ( const tk_chain_t tkc)

Check if the current token is the first token.

Parameters
tkctoken chain to use
Returns
TRUE if current token is the first token; FALSE if not

◆ tk_dump_chain()

void tk_dump_chain ( const tk_chain_t tkc)

Debug printf the token chain !!! Very verbose !!!

Parameters
tkctoken chain
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_dump_token()

void tk_dump_token ( const tk_token_t tk)

Debug printf the specified token !!! Very verbose !!!

Parameters
tktoken to dump
Here is the call graph for this function:

◆ tk_find_tkptr()

const tk_token_ptr_t * tk_find_tkptr ( const tk_chain_t tkc,
const void *  field 
)

Find the specified token pointer record.

Parameters
tkctoken chain to use
fieldaddress of field to use as key to find
Returns
pointer to the token pointer record or NULL if not found

◆ tk_first_origstr_rec()

const tk_origstr_t * tk_first_origstr_rec ( const tk_token_ptr_t tkptr)

Get the first tk_origstr_t struct (if any)

Parameters
tkptrtoken pointer to use
Returns
pointer to the first original string record

◆ tk_free_chain()

void tk_free_chain ( tk_chain_t tkc)

Cleanup and deallocate a tk_chain_t.

Parameters
tkcTK chain to delete
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_get_btype_sym()

const char * tk_get_btype_sym ( ncx_btype_t  btyp)

Get the symbolic token symbol for one of the base types.

Parameters
btypbase type
Returns
const string to the symbol; will not be NULL
Here is the caller graph for this function:

◆ tk_get_first_origstr()

const xmlChar * tk_get_first_origstr ( const tk_token_ptr_t tkptr,
boolean *  dquote,
boolean *  morestr 
)

Get the first original string to use.

Parameters
tkptrtoken pointer to use
[out]dquoteaddress of return double quote flag
  • *dquote return double quote flag
                 TRUE == TK_TT_QSTRING
                FALSE == TK_TTSQSTRING
    
[out]morestraddress of return more string fragments flag
  • *morestr more string fragments flag
  • TRUE == more string fragments after first one
Returns
pointer to the first string fragment

◆ tk_get_origstr_parts()

const xmlChar * tk_get_origstr_parts ( const tk_origstr_t origstr,
boolean *  dquote,
boolean *  newline 
)

Get the fields from the original string record.

Parameters
origstroriginal string record pointer to use
[out]dquoteaddress of return double quote flag
  • *dquote return double quote flag
                 TRUE == TK_TT_QSTRING
                FALSE == TK_TTSQSTRING
    
[out]newlineaddress of return need newline flag
  • *newline return need newline flag
  • TRUE == need newline + indent before this string
Returns
pointer to the string fragment

◆ tk_get_token_name()

const char * tk_get_token_name ( tk_type_t  ttyp)

Get the symbolic token name.

Parameters
ttyptoken type
Returns
const string to the name; will not be NULL
Here is the caller graph for this function:

◆ tk_get_token_sym()

const char * tk_get_token_sym ( tk_type_t  ttyp)

Get the symbolic token symbol.

Parameters
ttyptoken type
Returns
const string to the symbol; will not be NULL

◆ tk_get_yang_btype_id()

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.

Parameters
bufftoken string to check – NOT ZERO-TERMINATED
lenlength of string to check
Returns
btype found or NCX_BT_NONE if no match
Here is the call graph for this function:

◆ tk_is_wsp_string()

boolean tk_is_wsp_string ( const tk_token_t tk)

Check if the current token is a string with whitespace in it.

Parameters
tktoken to check
Returns
TRUE if a string with whitespace in it
FALSE if not a string or no whitespace in the string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_new_chain()

tk_chain_t * tk_new_chain ( void  )

Allocatate a new token parse chain.

Returns
new parse chain or NULL if memory error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_next_is_null()

boolean tk_next_is_null ( tk_chain_t tkc)

Get the special sequence [null] is next.

Parameters
tkctoken chain
Returns
TRUE if [null] is next
Here is the call graph for this function:

◆ tk_next_origstr_rec()

const tk_origstr_t * tk_next_origstr_rec ( const tk_origstr_t origstr)

Get the next tk_origstr_t struct (if any)

Parameters
origstrorigisnal string record pointer to use
Returns
pointer to the next original string record

◆ tk_next_typ()

tk_type_t tk_next_typ ( tk_chain_t tkc)

Get the token type of the next token.

Parameters
tkctoken chain
Returns
token type
Here is the caller graph for this function:

◆ tk_next_typ2()

tk_type_t tk_next_typ2 ( tk_chain_t tkc)

Get the token type of the token after the next token.

Parameters
tkctoken chain
Returns
token type

◆ tk_next_val()

const xmlChar * tk_next_val ( tk_chain_t tkc)

Get the token type of the next token.

Parameters
tkctoken chain
Returns
token type
Here is the caller graph for this function:

◆ tk_reset_chain()

void tk_reset_chain ( tk_chain_t tkc)

Reset the token chain current pointer to the start.

Parameters
tkctoken chain to reset
Here is the caller graph for this function:

◆ tk_retokenize_cur_string()

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.

The current token may be replaced with one or more tokens

Parameters
tkctoken chain
modmodule in progress (NULL if not used)
Returns
status of the operation
Here is the call graph for this function:

◆ tk_setup_chain_cli()

void tk_setup_chain_cli ( tk_chain_t tkc,
xmlChar *  line 
)

Setup a previously allocated chain for a CLI command line.

Parameters
tkctoken chain to setup
lineCLI buffer to parse; this pointer is just borrowed it will not be freed when the token chain is freed

◆ tk_setup_chain_cli_line()

void tk_setup_chain_cli_line ( tk_chain_t tkc,
xmlChar *  str 
)

Setup a previously allocated chain for yangcli CLI line of input.

Parameters
tkctoken chain to setup
strCLI input to parse

◆ tk_setup_chain_conf()

void tk_setup_chain_conf ( tk_chain_t tkc,
FILE *  fp,
const xmlChar *  filename 
)

Setup a previously allocated chain for a text config file.

Parameters
tkctoken chain to setup
fpopen file to use for text source
filenamesource filespec
Here is the caller graph for this function:

◆ tk_setup_chain_docmode()

void tk_setup_chain_docmode ( tk_chain_t tkc)

Setup a previously allocated chain for a yangdump docmode output.

Parameters
tkctoken chain to setup
Here is the caller graph for this function:

◆ tk_setup_chain_feature()

void tk_setup_chain_feature ( tk_chain_t tkc,
xmlChar *  str 
)

Setup a previously allocated chain for 'if-feature' YANG 1.1.

Parameters
tkctoken chain to setup
strif-feature expression

◆ tk_setup_chain_fields()

void tk_setup_chain_fields ( tk_chain_t tkc,
xmlChar *  str 
)

Setup a previously allocated chain for 'fields' RESTCONF query parameter str value.

Parameters
tkctoken chain to setup
strfields RESTCONF query parameter value to parse; this pointer is just borrowed it will not be freed when the token chain is freed
Here is the caller graph for this function:

◆ tk_setup_chain_json_buffer()

void tk_setup_chain_json_buffer ( tk_chain_t tkc,
xmlChar *  buff 
)

Setup a previously allocated chain for a JSON buffer.

Parameters
tkctoken chain to setup
buffbuffer to use for text source
Here is the caller graph for this function:

◆ tk_setup_chain_json_buffs()

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.

Parameters
tkctoken chain to setup
getline_fnget next line function
cookiecookie pointer to pass to get_next_buff_fn callback

◆ tk_setup_chain_json_file()

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.

Parameters
tkctoken chain to setup
fpopen file to use for text source
filenamesource filespec

◆ tk_setup_chain_yang()

void tk_setup_chain_yang ( tk_chain_t tkc,
FILE *  fp,
const xmlChar *  filename 
)

Setup a previously allocated chain for a YANG file.

Parameters
tkctoken chain to setup
fpopen file to use for text source
filenamesource filespec

◆ tk_setup_chain_yin()

void tk_setup_chain_yin ( tk_chain_t tkc,
const xmlChar *  filename 
)

Setup a previously allocated chain for a YIN file.

Parameters
tkctoken chain to setup
filenamesource filespec
Here is the caller graph for this function:

◆ tk_tkptr_quotes()

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.

Parameters
tkptrtoken pointer to use
Returns
number of quotes used in first string

◆ tk_token_count()

uint32 tk_token_count ( const tk_chain_t tkc)

Get the number of tokens in the queue.

Parameters
tkctoken chain to check
Returns
number of tokens in the queue
Here is the call graph for this function:

◆ tk_tokenize_input()

status_t tk_tokenize_input ( tk_chain_t tkc,
ncx_module_t mod 
)

Parse the input (FILE or buffer) into tk_token_t structs.

The tkc param must be initialized to use the internal buffer to read from the specified filespec:

     tkc->filename
     tkc->flags
     tkc->fp
     tkc->source

  External buffer mode:

If no filename is provided, the the TK_FL_MALLOC flag will not be set, and the tkc->buff field must be initialized before this function is called. This function will not free the buffer, but just read from it until a '0' char is reached.

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkctoken chain
modmodule in progress (NULL if not used) !!! Just used for error messages !!!
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tk_tokenize_metadata_string()

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.

Parameters
modmodule in progress for error purposes (may be NULL)
strstring to tokenize
[out]resaddress of return status
  • *res error status, if return NULL or non-NULL
Returns
pointer to malloced and filled in token chain ready to be traversed; always check *res for valid syntax
Here is the call graph for this function:

◆ tk_tokenize_xpath_string()

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.

Parameters
modmodule in progress for error purposes (may be NULL)
strstring to tokenize
curlinenumcurrent line number
curlineposcurrent line position
[out]resaddress of return status
  • *res error status, if return NULL or non-NULL
Returns
pointer to malloced and filled in token chain ready to be traversed; always check *res for valid syntax
Here is the call graph for this function:
Here is the caller graph for this function: