* Fixed extension/unknown problem shown in latest openconfig where other than a single space was used between the unknown identifier and string
* Removed skiplist of openconfig/yangmodels tests to inside the test
This commit is contained in:
parent
187da4dc47
commit
ab18946880
13 changed files with 62 additions and 41 deletions
|
|
@ -2077,11 +2077,11 @@ ys_populate_unknown(clicon_handle h,
|
|||
if (nodeid_split(yang_argument_get(ys), &prefix, &id) < 0)
|
||||
goto done;
|
||||
if ((ymod = yang_find_module_by_prefix(ys, prefix)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "Extension %s:%s, module not found", prefix, id);
|
||||
clicon_err(OE_YANG, ENOENT, "Extension \"%s:%s\", module not found", prefix, id);
|
||||
goto done;
|
||||
}
|
||||
if ((yext = yang_find(ymod, Y_EXTENSION, id)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "Extension %s:%s not found", prefix, id);
|
||||
clicon_err(OE_YANG, ENOENT, "Extension \"%s:%s\" not found", prefix, id);
|
||||
goto done;
|
||||
}
|
||||
/* Optional argument (only if "argument") - save it in ys_cv */
|
||||
|
|
|
|||
|
|
@ -102,15 +102,16 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
|
|||
%s COMMENT1
|
||||
%s COMMENT2
|
||||
%s UNKNOWN
|
||||
%s UNKNOWN2
|
||||
|
||||
%%
|
||||
/* Common tokens */
|
||||
<KEYWORD,BOOLEAN,INTEGER,STRARG,STRING>[ \t]
|
||||
<KEYWORD,STRING,UNKNOWN,COMMENT2><<EOF>> { return MY_EOF; }
|
||||
<KEYWORD,BOOLEAN,INTEGER,STRARG,STRING,COMMENT1,UNKNOWN>\n { _YY->yy_linenum++; }
|
||||
<KEYWORD,BOOLEAN,INTEGER,STRARG,STRING,COMMENT1,UNKNOWN>\r
|
||||
<KEYWORD,STRING>"/*" { _YY->yy_lex_state = YYSTATE; BEGIN(COMMENT1); }
|
||||
<KEYWORD,STRING>"//" { _YY->yy_lex_state = YYSTATE; BEGIN(COMMENT2); }
|
||||
<KEYWORD,STRING,UNKNOWN,UNKNOWN2,COMMENT2><<EOF>> { return MY_EOF; }
|
||||
<KEYWORD,BOOLEAN,INTEGER,STRARG,STRING,COMMENT1,UNKNOWN,UNKNOWN2>\n { _YY->yy_linenum++; }
|
||||
<KEYWORD,BOOLEAN,INTEGER,STRARG,STRING,COMMENT1,UNKNOWN,UNKNOWN2>\r
|
||||
<KEYWORD,STRING,UNKNOWN,UNKNOWN2>"/*" { _YY->yy_lex_state = YYSTATE; BEGIN(COMMENT1); }
|
||||
<KEYWORD,STRING,UNKNOWN,UNKNOWN2>"//" { _YY->yy_lex_state = YYSTATE; BEGIN(COMMENT2); }
|
||||
|
||||
|
||||
<KEYWORD>input { return K_INPUT; } /* No argument */
|
||||
|
|
@ -194,16 +195,22 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
|
|||
<KEYWORD>\} { return *yytext; }
|
||||
<KEYWORD>; { return *yytext; }
|
||||
<KEYWORD>. { clixon_yang_parselval.string = strdup(yytext);
|
||||
BEGIN(UNKNOWN); return CHARS; }
|
||||
BEGIN(UNKNOWN); return CHARS; }
|
||||
|
||||
<UNKNOWN>: { return *yytext; }
|
||||
<UNKNOWN>; { BEGIN(KEYWORD); return *yytext; }
|
||||
<UNKNOWN>\" { _YY->yy_lex_string_state =UNKNOWN; BEGIN(STRINGDQ); return *yytext; }
|
||||
<UNKNOWN>\{ { BEGIN(KEYWORD); return *yytext; }
|
||||
<UNKNOWN>[ \t]+ { return SEP; }
|
||||
<UNKNOWN>[^{";: \t]+ { clixon_yang_parselval.string = strdup(yytext);
|
||||
<UNKNOWN>[ \t\n]+ { BEGIN(UNKNOWN2);return SEP; }
|
||||
<UNKNOWN>[^{"';: \t\n]+ { clixon_yang_parselval.string = strdup(yytext);
|
||||
return CHARS; }
|
||||
|
||||
<UNKNOWN2>; { BEGIN(KEYWORD); return *yytext; }
|
||||
<UNKNOWN2>\" { _YY->yy_lex_string_state =STRING; BEGIN(STRINGDQ); return *yytext; }
|
||||
<UNKNOWN2>\' { _YY->yy_lex_string_state =STRING; BEGIN(STRINGSQ); return SQ; }
|
||||
<UNKNOWN2>\{ { BEGIN(KEYWORD); return *yytext; }
|
||||
<UNKNOWN2>[^{"'; \t\n]+ { clixon_yang_parselval.string = strdup(yytext);
|
||||
return CHARS; }
|
||||
|
||||
<BOOLEAN>true { clixon_yang_parselval.string = strdup(yytext);
|
||||
return BOOL; }
|
||||
<BOOLEAN>false { clixon_yang_parselval.string = strdup(yytext);
|
||||
|
|
@ -229,7 +236,7 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
|
|||
<STRING>\" { _YY->yy_lex_string_state =STRING; BEGIN(STRINGDQ); return *yytext; }
|
||||
<STRING>\' { _YY->yy_lex_string_state =STRING; BEGIN(STRINGSQ); return SQ; }
|
||||
<STRING>\+ { return *yytext; }
|
||||
<STRING>. { clixon_yang_parselval.string = strdup(yytext);
|
||||
<STRING>[^\"\'\+\{\;\n \t]+ { clixon_yang_parselval.string = strdup(yytext); /* XXX [.]+ */
|
||||
return CHARS;}
|
||||
|
||||
<STRINGDQ>\\ { _YY->yy_lex_state = STRINGDQ; BEGIN(DQESC); }
|
||||
|
|
|
|||
|
|
@ -193,11 +193,16 @@
|
|||
#include "clixon_yang_parse_lib.h"
|
||||
#include "clixon_yang_parse.h"
|
||||
|
||||
/* Enable for debugging, steals some cycles otherwise */
|
||||
/* Best debugging is to enable PARSE_DEBUG below and add -d to the LEX compile statement in the Makefile
|
||||
* And then run the testcase with -D 1
|
||||
* Disable it to stop any calls to clicon_debug. Having it on by default would mean very large debug outputs.
|
||||
*/
|
||||
#if 0
|
||||
#define _PARSE_DEBUG(s) clicon_debug(1,(s))
|
||||
#define _PARSE_DEBUG1(s, s1) clicon_debug(1,(s), (s1))
|
||||
#else
|
||||
#define _PARSE_DEBUG(s)
|
||||
#define _PARSE_DEBUG1(s, s1)
|
||||
#endif
|
||||
|
||||
extern int clixon_yang_parseget_lineno (void);
|
||||
|
|
@ -219,7 +224,7 @@ clixon_yang_parseerror(void *_yy,
|
|||
}
|
||||
|
||||
int
|
||||
yang_parse_init(clixon_yang_yacc *yy)
|
||||
yang_parse_init(clixon_yang_yacc *yy)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1567,12 +1572,12 @@ deviate_substmt : type_stmt { _PARSE_DEBUG("deviate-substmt -> type-stmt
|
|||
unknown_stmt : ustring ':' ustring optsep ';'
|
||||
{ char *id; if ((id=string_del_join($1, ":", $3)) == NULL) _YYERROR("unknown_stmt");
|
||||
if (ysp_add(_yy, Y_UNKNOWN, id, NULL) == NULL) _YYERROR("unknown_stmt");
|
||||
_PARSE_DEBUG("unknown-stmt -> ustring : ustring");
|
||||
_PARSE_DEBUG("unknown-stmt -> ustring : ustring ;");
|
||||
}
|
||||
| ustring ':' ustring SEP string optsep ';'
|
||||
{ char *id; if ((id=string_del_join($1, ":", $3)) == NULL) _YYERROR("unknown_stmt");
|
||||
if (ysp_add(_yy, Y_UNKNOWN, id, $5) == NULL){ _YYERROR("unknwon_stmt"); }
|
||||
_PARSE_DEBUG("unknown-stmt -> ustring : ustring string");
|
||||
if (ysp_add(_yy, Y_UNKNOWN, id, $5) == NULL){ _YYERROR("unknown_stmt"); }
|
||||
_PARSE_DEBUG("unknown-stmt -> ustring : ustring SEP string ;");
|
||||
}
|
||||
| ustring ':' ustring optsep
|
||||
{ char *id; if ((id=string_del_join($1, ":", $3)) == NULL) _YYERROR("unknown_stmt");
|
||||
|
|
@ -1744,7 +1749,7 @@ qstrings : qstrings '+' qstring
|
|||
$$ = realloc($1, len + strlen($3) + 1);
|
||||
sprintf($$+len, "%s", $3);
|
||||
free($3);
|
||||
_PARSE_DEBUG("qstrings-> qstrings + qstring");
|
||||
_PARSE_DEBUG("qstrings-> qstrings '+' qstring");
|
||||
}
|
||||
| qstring
|
||||
{ $$=$1;
|
||||
|
|
@ -1752,13 +1757,13 @@ qstrings : qstrings '+' qstring
|
|||
;
|
||||
|
||||
qstring : '"' ustring '"' { $$=$2;
|
||||
_PARSE_DEBUG("string-> \" ustring \"");}
|
||||
_PARSE_DEBUG("qstring-> \" ustring \"");}
|
||||
| '"' '"' { $$=strdup("");
|
||||
_PARSE_DEBUG("string-> \" \"");}
|
||||
_PARSE_DEBUG("qstring-> \" \"");}
|
||||
| SQ ustring SQ { $$=$2;
|
||||
_PARSE_DEBUG("string-> ' ustring '"); }
|
||||
_PARSE_DEBUG("qstring-> ' ustring '"); }
|
||||
| SQ SQ { $$=strdup("");
|
||||
_PARSE_DEBUG("string-> ' '");}
|
||||
_PARSE_DEBUG("qstring-> ' '");}
|
||||
;
|
||||
|
||||
/* unquoted string */
|
||||
|
|
@ -1767,11 +1772,11 @@ ustring : ustring CHARS
|
|||
int len = strlen($1);
|
||||
$$ = realloc($1, len+strlen($2) + 1);
|
||||
sprintf($$+len, "%s", $2);
|
||||
_PARSE_DEBUG1("ustring-> string + CHARS(%s)", $2);
|
||||
free($2);
|
||||
_PARSE_DEBUG("ustring-> string + CHARS");
|
||||
}
|
||||
| CHARS
|
||||
{$$=$1; }
|
||||
{ _PARSE_DEBUG1("ustring-> CHARS(%s)", $1); $$=$1; }
|
||||
;
|
||||
|
||||
abs_schema_nodeid : abs_schema_nodeid '/' node_identifier
|
||||
|
|
@ -1861,4 +1866,3 @@ stmtend : ';'
|
|||
;
|
||||
|
||||
%%
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue