Debug messages
* Added cli command debug printf on debug level 1 * Moved all parse debug printfs to level 3
This commit is contained in:
parent
5b5dce7e39
commit
8f8b49331f
10 changed files with 682 additions and 677 deletions
|
|
@ -52,6 +52,9 @@ Developers may need to change their code
|
||||||
|
|
||||||
### Minor changes
|
### Minor changes
|
||||||
|
|
||||||
|
* Debug messages
|
||||||
|
* Added cli command debug printf on debug level 1
|
||||||
|
* Moved all parse debug printfs to level 3
|
||||||
* Added `-r` command-line option to restconf daemon to NOT lower privileges to wwwuser if started from root.
|
* Added `-r` command-line option to restconf daemon to NOT lower privileges to wwwuser if started from root.
|
||||||
* Changed CLI help strings behaviour on query (?) for long and multi-line help strings.
|
* Changed CLI help strings behaviour on query (?) for long and multi-line help strings.
|
||||||
* If multiple strings (eg "\n" in text), indent before each new line
|
* If multiple strings (eg "\n" in text), indent before each new line
|
||||||
|
|
|
||||||
|
|
@ -584,6 +584,8 @@ clicon_parse(clicon_handle h,
|
||||||
}
|
}
|
||||||
if (cliread_parse(cli_cligen(h), cmd, pt, &match_obj, cvv, result, &reason) < 0)
|
if (cliread_parse(cli_cligen(h), cmd, pt, &match_obj, cvv, result, &reason) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
/* Debug command and result code */
|
||||||
|
clicon_debug(1, "%s result:%d command: \"%s\"", __FUNCTION__, *result, cmd);
|
||||||
if (*result != CG_MATCH)
|
if (*result != CG_MATCH)
|
||||||
pt_expand_cleanup(pt); /* XXX change to pt_expand_treeref_cleanup */
|
pt_expand_cleanup(pt); /* XXX change to pt_expand_treeref_cleanup */
|
||||||
if (modename0){
|
if (modename0){
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ static clixon_path *
|
||||||
path_append(clixon_path *list,
|
path_append(clixon_path *list,
|
||||||
clixon_path *new)
|
clixon_path *new)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(3, "%s()", __FUNCTION__);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
ADDQ(new, list);
|
ADDQ(new, list);
|
||||||
|
|
@ -161,7 +161,7 @@ static clixon_path *
|
||||||
path_add_keyvalue(clixon_path *cp,
|
path_add_keyvalue(clixon_path *cp,
|
||||||
cvec *cvk)
|
cvec *cvk)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(3, "%s()", __FUNCTION__);
|
||||||
if (cp)
|
if (cp)
|
||||||
cp->cp_cvk = cvk;
|
cp->cp_cvk = cvk;
|
||||||
return cp;
|
return cp;
|
||||||
|
|
@ -173,7 +173,7 @@ path_new(char *module_name,
|
||||||
{
|
{
|
||||||
clixon_path *cp = NULL;
|
clixon_path *cp = NULL;
|
||||||
|
|
||||||
clicon_debug(1, "%s(%s,%s)", __FUNCTION__, module_name, id);
|
clicon_debug(3, "%s(%s,%s)", __FUNCTION__, module_name, id);
|
||||||
if ((cp = malloc(sizeof(*cp))) == NULL){
|
if ((cp = malloc(sizeof(*cp))) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc");
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -203,7 +203,7 @@ static cvec *
|
||||||
keyval_add(cvec *cvv,
|
keyval_add(cvec *cvv,
|
||||||
cg_var *cv)
|
cg_var *cv)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(3, "%s()", __FUNCTION__);
|
||||||
if (cv == NULL)
|
if (cv == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (cvv == NULL &&
|
if (cvv == NULL &&
|
||||||
|
|
@ -229,7 +229,7 @@ keyval_set(char *name,
|
||||||
{
|
{
|
||||||
cg_var *cv = NULL;
|
cg_var *cv = NULL;
|
||||||
|
|
||||||
clicon_debug(1, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val);
|
clicon_debug(3, "%s(%s=%s)", __FUNCTION__, name?name:"NULL", val);
|
||||||
if ((cv = cv_new(CGV_STRING)) == NULL){
|
if ((cv = cv_new(CGV_STRING)) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "cv_new");
|
clicon_err(OE_UNIX, errno, "cv_new");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ static clixon_path *
|
||||||
path_append(clixon_path *list,
|
path_append(clixon_path *list,
|
||||||
clixon_path *new)
|
clixon_path *new)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(2, "%s()", __FUNCTION__);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
ADDQ(new, list);
|
ADDQ(new, list);
|
||||||
|
|
@ -175,7 +175,7 @@ static clixon_path *
|
||||||
path_add_keyvalue(clixon_path *cp,
|
path_add_keyvalue(clixon_path *cp,
|
||||||
cvec *cvk)
|
cvec *cvk)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(2, "%s()", __FUNCTION__);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
cp->cp_cvk = cvk;
|
cp->cp_cvk = cvk;
|
||||||
|
|
@ -189,7 +189,7 @@ path_new(char *prefix,
|
||||||
{
|
{
|
||||||
clixon_path *cp = NULL;
|
clixon_path *cp = NULL;
|
||||||
|
|
||||||
clicon_debug(1, "%s(%s,%s)", __FUNCTION__, prefix, id);
|
clicon_debug(2, "%s(%s,%s)", __FUNCTION__, prefix, id);
|
||||||
if ((cp = malloc(sizeof(*cp))) == NULL){
|
if ((cp = malloc(sizeof(*cp))) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "malloc");
|
clicon_err(OE_UNIX, errno, "malloc");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -219,7 +219,7 @@ keyval_pos(char *uint)
|
||||||
char *reason=NULL;
|
char *reason=NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
clicon_debug(1, "%s(%s)", __FUNCTION__, uint);
|
clicon_debug(2, "%s(%s)", __FUNCTION__, uint);
|
||||||
if ((cvv = cvec_new(1)) == NULL) {
|
if ((cvv = cvec_new(1)) == NULL) {
|
||||||
clicon_err(OE_UNIX, errno, "cvec_new");
|
clicon_err(OE_UNIX, errno, "cvec_new");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -252,7 +252,7 @@ static cvec *
|
||||||
keyval_add(cvec *cvv,
|
keyval_add(cvec *cvv,
|
||||||
cg_var *cv)
|
cg_var *cv)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s()", __FUNCTION__);
|
clicon_debug(2, "%s()", __FUNCTION__);
|
||||||
if (cv == NULL)
|
if (cv == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (cvv == NULL &&
|
if (cvv == NULL &&
|
||||||
|
|
@ -278,7 +278,7 @@ keyval_set(char *name,
|
||||||
{
|
{
|
||||||
cg_var *cv = NULL;
|
cg_var *cv = NULL;
|
||||||
|
|
||||||
clicon_debug(1, "%s(%s=%s)", __FUNCTION__, name, val);
|
clicon_debug(2, "%s(%s=%s)", __FUNCTION__, name, val);
|
||||||
if ((cv = cv_new(CGV_STRING)) == NULL){
|
if ((cv = cv_new(CGV_STRING)) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "cv_new");
|
clicon_err(OE_UNIX, errno, "cv_new");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -307,74 +307,74 @@ keyval_set(char *name,
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
start : list X_EOF { clicon_debug(2,"top"); _IY->iy_top=$1; YYACCEPT; }
|
start : list X_EOF { clicon_debug(3,"top"); _IY->iy_top=$1; YYACCEPT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
list : list SLASH element { if (($$ = path_append($1, $3)) == NULL) YYABORT;
|
list : list SLASH element { if (($$ = path_append($1, $3)) == NULL) YYABORT;
|
||||||
clicon_debug(2,"list = list / element");}
|
clicon_debug(3,"list = list / element");}
|
||||||
| SLASH element { if (($$ = path_append(NULL, $2)) == NULL) YYABORT;
|
| SLASH element { if (($$ = path_append(NULL, $2)) == NULL) YYABORT;
|
||||||
clicon_debug(2,"list = / element");}
|
clicon_debug(3,"list = / element");}
|
||||||
;
|
;
|
||||||
|
|
||||||
element : node_id element2 { $$ = path_add_keyvalue($1, $2);
|
element : node_id element2 { $$ = path_add_keyvalue($1, $2);
|
||||||
clicon_debug(2,"element = node_id element2");}
|
clicon_debug(3,"element = node_id element2");}
|
||||||
;
|
;
|
||||||
|
|
||||||
node_id : IDENTIFIER { $$ = path_new(NULL, $1); free($1);
|
node_id : IDENTIFIER { $$ = path_new(NULL, $1); free($1);
|
||||||
clicon_debug(2,"node_id = IDENTIFIER");}
|
clicon_debug(3,"node_id = IDENTIFIER");}
|
||||||
| prefix COLON IDENTIFIER { $$ = path_new($1, $3); free($1); free($3);
|
| prefix COLON IDENTIFIER { $$ = path_new($1, $3); free($1); free($3);
|
||||||
clicon_debug(2,"node_id = prefix : IDENTIFIER");}
|
clicon_debug(3,"node_id = prefix : IDENTIFIER");}
|
||||||
;
|
;
|
||||||
|
|
||||||
prefix : IDENTIFIER { $$=$1; clicon_debug(2,"prefix = IDENTIFIER");}
|
prefix : IDENTIFIER { $$=$1; clicon_debug(3,"prefix = IDENTIFIER");}
|
||||||
|
|
||||||
element2 : key_preds { $$=$1; clicon_debug(2,"element2 = key_preds"); }
|
element2 : key_preds { $$=$1; clicon_debug(3,"element2 = key_preds"); }
|
||||||
| leaf_list_pred { $$=$1; clicon_debug(2,"element2 = leaf_list_pred"); }
|
| leaf_list_pred { $$=$1; clicon_debug(3,"element2 = leaf_list_pred"); }
|
||||||
| pos { $$=$1; clicon_debug(2,"element2 = key_preds"); }
|
| pos { $$=$1; clicon_debug(3,"element2 = key_preds"); }
|
||||||
| { $$=NULL; clicon_debug(2,"element2 = "); }
|
| { $$=NULL; clicon_debug(3,"element2 = "); }
|
||||||
;
|
;
|
||||||
|
|
||||||
leaf_list_pred : LSQBR leaf_list_pred_expr RSQBR
|
leaf_list_pred : LSQBR leaf_list_pred_expr RSQBR
|
||||||
{ if (($$ = keyval_add(NULL, $2)) == NULL) YYABORT;
|
{ if (($$ = keyval_add(NULL, $2)) == NULL) YYABORT;
|
||||||
clicon_debug(2,"leaf_list_pred = [ leaf_list_pred_expr ]"); }
|
clicon_debug(3,"leaf_list_pred = [ leaf_list_pred_expr ]"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
leaf_list_pred_expr : DOT EQUAL qstring { $$ = keyval_set(".", $3); free($3);
|
leaf_list_pred_expr : DOT EQUAL qstring { $$ = keyval_set(".", $3); free($3);
|
||||||
clicon_debug(2,"leaf_list_pred_expr = '.=' qstring"); }
|
clicon_debug(3,"leaf_list_pred_expr = '.=' qstring"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
pos : LSQBR UINT RSQBR { $$ = keyval_pos($2); free($2);
|
pos : LSQBR UINT RSQBR { $$ = keyval_pos($2); free($2);
|
||||||
clicon_debug(2,"pos = [ UINT ]"); }
|
clicon_debug(3,"pos = [ UINT ]"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
key_preds : key_preds key_pred { if (($$ = keyval_add($1, $2)) == NULL) YYABORT;
|
key_preds : key_preds key_pred { if (($$ = keyval_add($1, $2)) == NULL) YYABORT;
|
||||||
clicon_debug(2,"key_preds = key_pred key_preds"); }
|
clicon_debug(3,"key_preds = key_pred key_preds"); }
|
||||||
| key_pred { if (($$ = keyval_add(NULL, $1)) == NULL) YYABORT;
|
| key_pred { if (($$ = keyval_add(NULL, $1)) == NULL) YYABORT;
|
||||||
clicon_debug(2,"key_preds = key_pred");}
|
clicon_debug(3,"key_preds = key_pred");}
|
||||||
;
|
;
|
||||||
|
|
||||||
key_pred : LSQBR key_pred_expr RSQBR { $$ = $2;
|
key_pred : LSQBR key_pred_expr RSQBR { $$ = $2;
|
||||||
clicon_debug(2,"key_pred = [ key_pred_expr ]"); }
|
clicon_debug(3,"key_pred = [ key_pred_expr ]"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
key_pred_expr : node_id_k EQUAL qstring { $$ = keyval_set($1, $3); free($1); free($3);
|
key_pred_expr : node_id_k EQUAL qstring { $$ = keyval_set($1, $3); free($1); free($3);
|
||||||
clicon_debug(2,"key_pred_expr = node_id_k = qstring"); }
|
clicon_debug(3,"key_pred_expr = node_id_k = qstring"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
node_id_k : IDENTIFIER { $$ = $1;
|
node_id_k : IDENTIFIER { $$ = $1;
|
||||||
clicon_debug(2,"node_id_k = IDENTIFIER %s", $1); }
|
clicon_debug(3,"node_id_k = IDENTIFIER %s", $1); }
|
||||||
| prefix COLON IDENTIFIER { $$ = $3; /* ignore prefix in key? */
|
| prefix COLON IDENTIFIER { $$ = $3; /* ignore prefix in key? */
|
||||||
clicon_debug(2,"node_id_k = prefix %s : IDENTIFIER %s", $1, $3); free($1);}
|
clicon_debug(3,"node_id_k = prefix %s : IDENTIFIER %s", $1, $3); free($1);}
|
||||||
;
|
;
|
||||||
|
|
||||||
qstring : DQUOTE STRING DQUOTE { $$=$2;
|
qstring : DQUOTE STRING DQUOTE { $$=$2;
|
||||||
clicon_debug(2,"qstring = \" string \""); }
|
clicon_debug(3,"qstring = \" string \""); }
|
||||||
| DQUOTE DQUOTE { $$=strdup("");
|
| DQUOTE DQUOTE { $$=strdup("");
|
||||||
clicon_debug(2,"qstring = \" \""); }
|
clicon_debug(3,"qstring = \" \""); }
|
||||||
| SQUOTE STRING SQUOTE { $$=$2;
|
| SQUOTE STRING SQUOTE { $$=$2;
|
||||||
clicon_debug(2,"qstring = ' string '"); }
|
clicon_debug(3,"qstring = ' string '"); }
|
||||||
| SQUOTE SQUOTE { $$=strdup("");
|
| SQUOTE SQUOTE { $$=strdup("");
|
||||||
clicon_debug(2,"qstring = ''"); }
|
clicon_debug(3,"qstring = ''"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ json_current_body(clixon_json_yacc *jy,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* top: json -> value is also possible */
|
/* top: json -> value is also possible */
|
||||||
json : value J_EOF { clicon_debug(2,"json->object"); YYACCEPT; }
|
json : value J_EOF { clicon_debug(3,"json->object"); YYACCEPT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
value : J_TRUE { json_current_body(_JY, "true");}
|
value : J_TRUE { json_current_body(_JY, "true");}
|
||||||
|
|
@ -263,16 +263,16 @@ value : J_TRUE { json_current_body(_JY, "true");}
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
object : '{' '}' { clicon_debug(2,"object->{}");}
|
object : '{' '}' { clicon_debug(3,"object->{}");}
|
||||||
| '{' objlist '}' { clicon_debug(2,"object->{ objlist }");}
|
| '{' objlist '}' { clicon_debug(3,"object->{ objlist }");}
|
||||||
;
|
;
|
||||||
|
|
||||||
objlist : pair { clicon_debug(2,"objlist->pair");}
|
objlist : pair { clicon_debug(3,"objlist->pair");}
|
||||||
| objlist ',' pair { clicon_debug(2,"objlist->objlist , pair");}
|
| objlist ',' pair { clicon_debug(3,"objlist->objlist , pair");}
|
||||||
;
|
;
|
||||||
|
|
||||||
pair : string { json_current_new(_JY, $1);free($1);} ':'
|
pair : string { json_current_new(_JY, $1);free($1);} ':'
|
||||||
value { json_current_pop(_JY);}{ clicon_debug(2,"pair->string : value");}
|
value { json_current_pop(_JY);}{ clicon_debug(3,"pair->string : value");}
|
||||||
;
|
;
|
||||||
|
|
||||||
array : '[' ']'
|
array : '[' ']'
|
||||||
|
|
@ -284,8 +284,8 @@ valuelist : value
|
||||||
;
|
;
|
||||||
|
|
||||||
/* quoted string */
|
/* quoted string */
|
||||||
string : J_DQ ustring J_DQ { clicon_debug(2,"string->\" ustring \"");$$=$2; }
|
string : J_DQ ustring J_DQ { clicon_debug(3,"string->\" ustring \"");$$=$2; }
|
||||||
| J_DQ J_DQ { clicon_debug(2,"string->\" ustring \"");$$=strdup(""); }
|
| J_DQ J_DQ { clicon_debug(3,"string->\" ustring \"");$$=strdup(""); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* unquoted string */
|
/* unquoted string */
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ _xml_parse(const char *str,
|
||||||
int failed = 0; /* yang assignment */
|
int failed = 0; /* yang assignment */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(2, "%s", __FUNCTION__);
|
||||||
if (strlen(str) == 0)
|
if (strlen(str) == 0)
|
||||||
return 0; /* OK */
|
return 0; /* OK */
|
||||||
if (xt == NULL){
|
if (xt == NULL){
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
|
|
||||||
/* Enable for debugging, steals some cycles otherwise */
|
/* Enable for debugging, steals some cycles otherwise */
|
||||||
#if 0
|
#if 0
|
||||||
#define _PARSE_DEBUG(s) clicon_debug(2,(s))
|
#define _PARSE_DEBUG(s) clicon_debug(3,(s))
|
||||||
#else
|
#else
|
||||||
#define _PARSE_DEBUG(s)
|
#define _PARSE_DEBUG(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ xml_cmp(cxobj *x1,
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
done:
|
done:
|
||||||
clicon_debug(2, "%s %s %s eq:%d nr: %d %d yi: %d %d", __FUNCTION__, xml_name(x1), xml_name(x2), equal, nr1, nr2, yi1, yi2);
|
clicon_debug(3, "%s %s %s eq:%d nr: %d %d yi: %d %d", __FUNCTION__, xml_name(x1), xml_name(x2), equal, nr1, nr2, yi1, yi2);
|
||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ clixon_xpath_parseerror(void *_xpy,
|
||||||
int
|
int
|
||||||
xpath_parse_init(clixon_xpath_yacc *xpy)
|
xpath_parse_init(clixon_xpath_yacc *xpy)
|
||||||
{
|
{
|
||||||
// clicon_debug_init(2, NULL);
|
// clicon_debug_init(3, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,87 +198,87 @@ xp_new(enum xp_type type,
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
start : expr X_EOF { _XPY->xpy_top=$1;clicon_debug(2,"start->expr"); YYACCEPT; }
|
start : expr X_EOF { _XPY->xpy_top=$1;clicon_debug(3,"start->expr"); YYACCEPT; }
|
||||||
| locationpath X_EOF { _XPY->xpy_top=$1;clicon_debug(2,"start->locationpath"); YYACCEPT; }
|
| locationpath X_EOF { _XPY->xpy_top=$1;clicon_debug(3,"start->locationpath"); YYACCEPT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
expr : expr LOGOP andexpr { $$=xp_new(XP_EXP,$2,NULL,NULL,NULL,$1, $3);clicon_debug(2,"expr->expr or andexpr"); }
|
expr : expr LOGOP andexpr { $$=xp_new(XP_EXP,$2,NULL,NULL,NULL,$1, $3);clicon_debug(3,"expr->expr or andexpr"); }
|
||||||
| andexpr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"expr-> andexpr"); }
|
| andexpr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"expr-> andexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
andexpr : andexpr LOGOP relexpr { $$=xp_new(XP_AND,$2,NULL,NULL,NULL,$1, $3);clicon_debug(2,"andexpr-> andexpr and relexpr"); }
|
andexpr : andexpr LOGOP relexpr { $$=xp_new(XP_AND,$2,NULL,NULL,NULL,$1, $3);clicon_debug(3,"andexpr-> andexpr and relexpr"); }
|
||||||
| relexpr { $$=xp_new(XP_AND,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"andexpr-> relexpr"); }
|
| relexpr { $$=xp_new(XP_AND,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"andexpr-> relexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
relexpr : relexpr RELOP addexpr { $$=xp_new(XP_RELEX,$2,NULL,NULL,NULL,$1, $3);clicon_debug(2,"relexpr-> relexpr relop addexpr"); }
|
relexpr : relexpr RELOP addexpr { $$=xp_new(XP_RELEX,$2,NULL,NULL,NULL,$1, $3);clicon_debug(3,"relexpr-> relexpr relop addexpr"); }
|
||||||
| addexpr { $$=xp_new(XP_RELEX,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"relexpr-> addexpr"); }
|
| addexpr { $$=xp_new(XP_RELEX,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"relexpr-> addexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
addexpr : addexpr ADDOP unionexpr { $$=xp_new(XP_ADD,$2,NULL,NULL,NULL,$1, $3);clicon_debug(2,"addexpr-> addexpr ADDOP unionexpr"); }
|
addexpr : addexpr ADDOP unionexpr { $$=xp_new(XP_ADD,$2,NULL,NULL,NULL,$1, $3);clicon_debug(3,"addexpr-> addexpr ADDOP unionexpr"); }
|
||||||
| unionexpr { $$=xp_new(XP_ADD,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"addexpr-> unionexpr"); }
|
| unionexpr { $$=xp_new(XP_ADD,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"addexpr-> unionexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* node-set */
|
/* node-set */
|
||||||
unionexpr : unionexpr '|' pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, $3);clicon_debug(2,"unionexpr-> unionexpr | pathexpr"); }
|
unionexpr : unionexpr '|' pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, $3);clicon_debug(3,"unionexpr-> unionexpr | pathexpr"); }
|
||||||
| pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"unionexpr-> pathexpr"); }
|
| pathexpr { $$=xp_new(XP_UNION,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"unionexpr-> pathexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
pathexpr : locationpath { $$=xp_new(XP_PATHEXPR,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"pathexpr-> locationpath"); }
|
pathexpr : locationpath { $$=xp_new(XP_PATHEXPR,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"pathexpr-> locationpath"); }
|
||||||
| primaryexpr { $$=xp_new(XP_PATHEXPR,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(2,"pathexpr-> primaryexpr"); }
|
| primaryexpr { $$=xp_new(XP_PATHEXPR,A_NAN,NULL,NULL,NULL,$1, NULL);clicon_debug(3,"pathexpr-> primaryexpr"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* location path returns a node-set */
|
/* location path returns a node-set */
|
||||||
locationpath : rellocpath { $$=xp_new(XP_LOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(2,"locationpath-> rellocpath"); }
|
locationpath : rellocpath { $$=xp_new(XP_LOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(3,"locationpath-> rellocpath"); }
|
||||||
| abslocpath { $$=xp_new(XP_LOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(2,"locationpath-> abslocpath"); }
|
| abslocpath { $$=xp_new(XP_LOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(3,"locationpath-> abslocpath"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
abslocpath : '/' { $$=xp_new(XP_ABSPATH,A_ROOT,NULL,NULL,NULL,NULL, NULL);clicon_debug(2,"abslocpath-> /"); }
|
abslocpath : '/' { $$=xp_new(XP_ABSPATH,A_ROOT,NULL,NULL,NULL,NULL, NULL);clicon_debug(3,"abslocpath-> /"); }
|
||||||
| '/' rellocpath { $$=xp_new(XP_ABSPATH,A_ROOT,NULL,NULL,NULL,$2, NULL);clicon_debug(2,"abslocpath->/ rellocpath");}
|
| '/' rellocpath { $$=xp_new(XP_ABSPATH,A_ROOT,NULL,NULL,NULL,$2, NULL);clicon_debug(3,"abslocpath->/ rellocpath");}
|
||||||
/* // is short for /descendant-or-self::node()/ */
|
/* // is short for /descendant-or-self::node()/ */
|
||||||
| DOUBLESLASH rellocpath {$$=xp_new(XP_ABSPATH,A_DESCENDANT_OR_SELF,NULL,NULL,NULL,$2, NULL); clicon_debug(2,"abslocpath-> // rellocpath"); }
|
| DOUBLESLASH rellocpath {$$=xp_new(XP_ABSPATH,A_DESCENDANT_OR_SELF,NULL,NULL,NULL,$2, NULL); clicon_debug(3,"abslocpath-> // rellocpath"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
rellocpath : step { $$=xp_new(XP_RELLOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(2,"rellocpath-> step"); }
|
rellocpath : step { $$=xp_new(XP_RELLOCPATH,A_NAN,NULL,NULL,NULL,$1, NULL); clicon_debug(3,"rellocpath-> step"); }
|
||||||
| rellocpath '/' step { $$=xp_new(XP_RELLOCPATH,A_NAN,NULL,NULL,NULL,$1, $3);clicon_debug(2,"rellocpath-> rellocpath / step"); }
|
| rellocpath '/' step { $$=xp_new(XP_RELLOCPATH,A_NAN,NULL,NULL,NULL,$1, $3);clicon_debug(3,"rellocpath-> rellocpath / step"); }
|
||||||
| rellocpath DOUBLESLASH step { $$=xp_new(XP_RELLOCPATH,A_DESCENDANT_OR_SELF,NULL,NULL,NULL,$1, $3); clicon_debug(2,"rellocpath-> rellocpath // step"); }
|
| rellocpath DOUBLESLASH step { $$=xp_new(XP_RELLOCPATH,A_DESCENDANT_OR_SELF,NULL,NULL,NULL,$1, $3); clicon_debug(3,"rellocpath-> rellocpath // step"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
step : axisspec nodetest predicates {$$=xp_new(XP_STEP,$1,NULL, NULL, NULL, $2, $3);clicon_debug(2,"step->axisspec(%d) nodetest", $1); }
|
step : axisspec nodetest predicates {$$=xp_new(XP_STEP,$1,NULL, NULL, NULL, $2, $3);clicon_debug(3,"step->axisspec(%d) nodetest", $1); }
|
||||||
| '.' predicates { $$=xp_new(XP_STEP,A_SELF, NULL,NULL, NULL, NULL, $2); clicon_debug(2,"step-> ."); }
|
| '.' predicates { $$=xp_new(XP_STEP,A_SELF, NULL,NULL, NULL, NULL, $2); clicon_debug(3,"step-> ."); }
|
||||||
| DOUBLEDOT predicates { $$=xp_new(XP_STEP, A_PARENT, NULL,NULL, NULL, NULL, $2); clicon_debug(2,"step-> .."); }
|
| DOUBLEDOT predicates { $$=xp_new(XP_STEP, A_PARENT, NULL,NULL, NULL, NULL, $2); clicon_debug(3,"step-> .."); }
|
||||||
;
|
;
|
||||||
|
|
||||||
axisspec : AXISNAME { clicon_debug(2,"axisspec-> AXISNAME(%d) ::", $1); $$=$1;}
|
axisspec : AXISNAME { clicon_debug(3,"axisspec-> AXISNAME(%d) ::", $1); $$=$1;}
|
||||||
| '@' { $$=A_ATTRIBUTE; clicon_debug(2,"axisspec-> @"); }
|
| '@' { $$=A_ATTRIBUTE; clicon_debug(3,"axisspec-> @"); }
|
||||||
| { clicon_debug(2,"axisspec-> "); $$=A_CHILD;}
|
| { clicon_debug(3,"axisspec-> "); $$=A_CHILD;}
|
||||||
;
|
;
|
||||||
|
|
||||||
nodetest : '*' { $$=xp_new(XP_NODE,A_NAN,NULL, NULL, NULL, NULL, NULL); clicon_debug(2,"nodetest-> *"); }
|
nodetest : '*' { $$=xp_new(XP_NODE,A_NAN,NULL, NULL, NULL, NULL, NULL); clicon_debug(3,"nodetest-> *"); }
|
||||||
| NAME { $$=xp_new(XP_NODE,A_NAN,NULL, NULL, $1, NULL, NULL); clicon_debug(2,"nodetest-> name(%s)",$1); }
|
| NAME { $$=xp_new(XP_NODE,A_NAN,NULL, NULL, $1, NULL, NULL); clicon_debug(3,"nodetest-> name(%s)",$1); }
|
||||||
| NAME ':' NAME { $$=xp_new(XP_NODE,A_NAN,NULL, $1, $3, NULL, NULL);clicon_debug(2,"nodetest-> name(%s) : name(%s)", $1, $3); }
|
| NAME ':' NAME { $$=xp_new(XP_NODE,A_NAN,NULL, $1, $3, NULL, NULL);clicon_debug(3,"nodetest-> name(%s) : name(%s)", $1, $3); }
|
||||||
| NAME ':' '*' { $$=xp_new(XP_NODE,A_NAN,NULL, $1, NULL, NULL, NULL);clicon_debug(2,"nodetest-> name(%s) : *", $1); }
|
| NAME ':' '*' { $$=xp_new(XP_NODE,A_NAN,NULL, $1, NULL, NULL, NULL);clicon_debug(3,"nodetest-> name(%s) : *", $1); }
|
||||||
| NODETYPE '(' ')' { $$=xp_new(XP_NODE_FN,A_NAN,NULL, $1, NULL, NULL, NULL); clicon_debug(1,"nodetest-> nodetype():%s", $1); }
|
| NODETYPE '(' ')' { $$=xp_new(XP_NODE_FN,A_NAN,NULL, $1, NULL, NULL, NULL); clicon_debug(3,"nodetest-> nodetype():%s", $1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* evaluates to boolean */
|
/* evaluates to boolean */
|
||||||
predicates : predicates '[' expr ']' { $$=xp_new(XP_PRED,A_NAN,NULL, NULL, NULL, $1, $3); clicon_debug(2,"predicates-> [ expr ]"); }
|
predicates : predicates '[' expr ']' { $$=xp_new(XP_PRED,A_NAN,NULL, NULL, NULL, $1, $3); clicon_debug(3,"predicates-> [ expr ]"); }
|
||||||
| { $$=xp_new(XP_PRED,A_NAN,NULL, NULL, NULL, NULL, NULL); clicon_debug(2,"predicates->"); }
|
| { $$=xp_new(XP_PRED,A_NAN,NULL, NULL, NULL, NULL, NULL); clicon_debug(3,"predicates->"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
primaryexpr : '(' expr ')' { $$=xp_new(XP_PRI0,A_NAN,NULL, NULL, NULL, $2, NULL); clicon_debug(2,"primaryexpr-> ( expr )"); }
|
primaryexpr : '(' expr ')' { $$=xp_new(XP_PRI0,A_NAN,NULL, NULL, NULL, $2, NULL); clicon_debug(3,"primaryexpr-> ( expr )"); }
|
||||||
| NUMBER { $$=xp_new(XP_PRIME_NR,A_NAN, $1, NULL, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> NUMBER(%s)", $1); /*XXX*/}
|
| NUMBER { $$=xp_new(XP_PRIME_NR,A_NAN, $1, NULL, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> NUMBER(%s)", $1); /*XXX*/}
|
||||||
| QUOTE string QUOTE { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, $2, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> \" string \""); }
|
| QUOTE string QUOTE { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, $2, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> \" string \""); }
|
||||||
| QUOTE QUOTE { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, NULL, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> \" \""); }
|
| QUOTE QUOTE { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, NULL, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> \" \""); }
|
||||||
| APOST string APOST { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, $2, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> ' string '"); }
|
| APOST string APOST { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, $2, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> ' string '"); }
|
||||||
| APOST APOST { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, NULL, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> ' '"); }
|
| APOST APOST { $$=xp_new(XP_PRIME_STR,A_NAN,NULL, NULL, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> ' '"); }
|
||||||
| FUNCTIONNAME '(' ')' { $$=xp_new(XP_PRIME_FN,A_NAN,NULL, $1, NULL, NULL, NULL);clicon_debug(2,"primaryexpr-> functionname ( arguments )"); }
|
| FUNCTIONNAME '(' ')' { $$=xp_new(XP_PRIME_FN,A_NAN,NULL, $1, NULL, NULL, NULL);clicon_debug(3,"primaryexpr-> functionname ( arguments )"); }
|
||||||
| FUNCTIONNAME '(' args ')' { $$=xp_new(XP_PRIME_FN,A_NAN,NULL, $1, NULL, $3, NULL);clicon_debug(2,"primaryexpr-> functionname ( arguments )"); }
|
| FUNCTIONNAME '(' args ')' { $$=xp_new(XP_PRIME_FN,A_NAN,NULL, $1, NULL, $3, NULL);clicon_debug(3,"primaryexpr-> functionname ( arguments )"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
args : args ',' expr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, $3);
|
args : args ',' expr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, $3);
|
||||||
clicon_debug(2,"args -> args expr");}
|
clicon_debug(3,"args -> args expr");}
|
||||||
| expr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, NULL);
|
| expr { $$=xp_new(XP_EXP,A_NAN,NULL,NULL,NULL,$1, NULL);
|
||||||
clicon_debug(2,"args -> expr "); }
|
clicon_debug(3,"args -> expr "); }
|
||||||
;
|
;
|
||||||
|
|
||||||
string : string CHARS {
|
string : string CHARS {
|
||||||
|
|
@ -286,9 +286,9 @@ string : string CHARS {
|
||||||
$$ = realloc($1, len+strlen($2) + 1);
|
$$ = realloc($1, len+strlen($2) + 1);
|
||||||
sprintf($$+len, "%s", $2);
|
sprintf($$+len, "%s", $2);
|
||||||
free($2);
|
free($2);
|
||||||
clicon_debug(2,"string-> string CHAR");
|
clicon_debug(3,"string-> string CHAR");
|
||||||
}
|
}
|
||||||
| CHARS { clicon_debug(2,"string-> "); }
|
| CHARS { clicon_debug(3,"string-> "); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue