* Partly Fixed: [String concatenation in YANG model leads to syntax error](https://github.com/clicon/clixon/issues/265)

* In this case, eg "uses", single quotes can now be used, but not `qstring + qstring` in this case
This commit is contained in:
Olof hagsand 2021-09-20 22:54:14 +02:00
parent 392e6679c5
commit 6b357dc038
5 changed files with 28 additions and 15 deletions

View file

@ -79,6 +79,8 @@ Users may have to change how they access the system
### Corrected Bugs
* Partly Fixed: [String concatenation in YANG model leads to syntax error](https://github.com/clicon/clixon/issues/265)
* In this case, eg "uses", single quotes can now be used, but not `qstring + qstring` in this case
* Fixed: [Performance issue when parsing large JSON param](https://github.com/clicon/clixon/issues/266)
* Fixed: [Duplicate lines emitted by cli_show_config (cli output style) when yang list element has composite key](https://github.com/clicon/clixon/issues/258)
* Fixed: [JSON leaf-list output single element leaf-list does not use array](https://github.com/clicon/clixon/issues/261)

View file

@ -220,7 +220,7 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
<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>\' { _YY->yy_lex_string_state =STRING; BEGIN(STRINGSQ); return *yytext; }
<UNKNOWN2>\{ { BEGIN(KEYWORD); return *yytext; }
<UNKNOWN2>[ \t\n]+ { return WS; }
<UNKNOWN2>[^{"'; \t\n]+ { clixon_yang_parselval.string = strdup(yytext);
@ -244,12 +244,13 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
<STRARG>; { BEGIN(KEYWORD); return *yytext; }
<STRARG>{identifier} { clixon_yang_parselval.string = strdup(yytext);
return IDENTIFIER;}
<STRARG>. { return *yytext; }
<STRING>\{ { BEGIN(KEYWORD); return *yytext; }
<STRING>; { BEGIN(KEYWORD); return *yytext; }
<STRING>\" { _YY->yy_lex_string_state =STRING; BEGIN(STRINGDQ); return *yytext; }
<STRING>\' { _YY->yy_lex_string_state =STRING; BEGIN(STRINGSQ); return SQ; }
<STRING>\' { _YY->yy_lex_string_state =STRING; BEGIN(STRINGSQ); return *yytext; }
<STRING>\+ { return *yytext; }
<STRING>[^\"\'\+\{\;\n \t]+ { clixon_yang_parselval.string = strdup(yytext); /* XXX [.]+ */
return CHARS;}
@ -262,11 +263,11 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
<STRINGDQ>[^\\"\n]+ { clixon_yang_parselval.string = strdup(yytext);
return CHARS;}
<STRINGSQ>\' { BEGIN(_YY->yy_lex_string_state); return SQ; }
<STRINGSQ>\' { BEGIN(_YY->yy_lex_string_state); return *yytext; }
<STRINGSQ>\n { _YY->yy_linenum++;
clixon_yang_parselval.string = strdup(yytext);
return CHARS;}
<STRINGSQ>[^'\n]+ { clixon_yang_parselval.string = strdup(yytext);
<STRINGSQ>[^'\n]+ { clixon_yang_parselval.string = strdup(yytext);
return CHARS;}
<DQESC>[nt"\\] { BEGIN(_YY->yy_lex_state);

View file

@ -56,7 +56,6 @@
}
%token MY_EOF
%token SQ /* Single quote: ' */
%token WS /* white space (at least one) */
%token <string> CHARS
%token <string> ERRCHARS /* Error chars */
@ -1532,7 +1531,7 @@ deviation_substmt : description_stmt { _PARSE_DEBUG("deviation-substmt -> descr
not_supported_keyword_str : D_NOT_SUPPORTED
| '"' D_NOT_SUPPORTED '"'
| SQ D_NOT_SUPPORTED SQ
| '\'' D_NOT_SUPPORTED '\''
;
deviate_not_supported_stmt
@ -1543,7 +1542,7 @@ deviate_not_supported_stmt
add_keyword_str : D_ADD
| '"' D_ADD '"'
| SQ D_ADD SQ
| '\'' D_ADD '\''
;
deviate_add_stmt : K_DEVIATE add_keyword_str ';'
@ -1575,7 +1574,7 @@ deviate_add_substmt : units_stmt { _PARSE_DEBUG("deviate-add-substmt -> units
delete_keyword_str : D_DELETE
| '"' D_DELETE '"'
| SQ D_DELETE SQ
| '\'' D_DELETE '\''
;
deviate_delete_stmt : K_DEVIATE delete_keyword_str ';'
@ -1602,7 +1601,7 @@ deviate_delete_substmt : units_stmt { _PARSE_DEBUG("deviate-delete-substmt -> un
replace_keyword_str : D_REPLACE
| '"' D_REPLACE '"'
| SQ D_REPLACE SQ
| '\'' D_REPLACE '\''
;
deviate_replace_stmt : K_DEVIATE replace_keyword_str ';'
@ -1827,9 +1826,9 @@ qstring : '"' ustring '"' { $$=$2;
_PARSE_DEBUG("qstring-> \" ustring \"");}
| '"' '"' { $$=strdup("");
_PARSE_DEBUG("qstring-> \" \"");}
| SQ ustring SQ { $$=$2;
| '\'' ustring '\'' { $$=$2;
_PARSE_DEBUG("qstring-> ' ustring '"); }
| SQ SQ { $$=strdup("");
| '\'' '\'' { $$=strdup("");
_PARSE_DEBUG("qstring-> ' '");}
;
@ -1874,8 +1873,12 @@ desc_schema_nodeid_str : desc_schema_nodeid
_PARSE_DEBUG("descendant-schema-nodeid-str -> descendant-schema-nodeid"); }
| '"' desc_schema_nodeid '"'
{ $$=$2;
_PARSE_DEBUG("descendant-schema-nodeid-str -> descendant-schema-nodeid"); }
;
_PARSE_DEBUG("descendant-schema-nodeid-str -> \" descendant-schema-nodeid \" "); }
| '\'' desc_schema_nodeid '\''
{ $$=$2;
_PARSE_DEBUG("descendant-schema-nodeid-str -> ' descendant-schema-nodeid '"); }
;
/* descendant-schema-nodeid */
desc_schema_nodeid : node_identifier
@ -1888,22 +1891,29 @@ desc_schema_nodeid : node_identifier
identifier_str : '"' IDENTIFIER '"' { $$ = $2;
_PARSE_DEBUG("identifier_str -> \" IDENTIFIER \" ");}
| '\'' IDENTIFIER '\'' { $$ = $2;
_PARSE_DEBUG("identifier_str -> ' IDENTIFIER ' ");}
| IDENTIFIER { $$ = $1;
_PARSE_DEBUG("identifier_str -> IDENTIFIER ");}
;
identifier_ref_str : '"' identifier_ref '"' { $$ = $2;
_PARSE_DEBUG("identifier_ref_str -> \" identifier_ref \" ");}
| '\'' identifier_ref '\'' { $$ = $2;
_PARSE_DEBUG("identifier_ref_str -> ' identifier_ref ' ");}
| identifier_ref { $$ = $1;
_PARSE_DEBUG("identifier_ref_str -> identifier_ref ");}
;
integer_value_str : '"' INT '"' { $$=$2; }
| '\'' INT '\'' { $$=$2; }
| INT { $$=$1; }
;
bool_str : '"' BOOL '"' { $$ = $2;
_PARSE_DEBUG("bool_str -> \" BOOL \" ");}
| '\'' BOOL '\'' { $$ = $2;
_PARSE_DEBUG("bool_str -> ' BOOL ' ");}
| BOOL { $$ = $1;
_PARSE_DEBUG("bool_str -> BOOL ");}
;

View file

@ -8,7 +8,7 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
: ${clixon_util_json:="clixon_util_json"}
# Number of list/leaf-list entries in file
: ${perfnr:=20000}
: ${perfnr:=100000}
fjson=$dir/long.json

View file

@ -174,7 +174,7 @@ module example{
}
container c{
description "transitive type- exists in ex3";
uses ex2:gr2;
uses 'ex2:gr2';
}
leaf digit4{
type string {