empty unquoted string; unknown in anydata/xml

This commit is contained in:
Olof hagsand 2019-05-29 19:36:23 +02:00
parent 2ae9529a3e
commit 0ef704563b
3 changed files with 17 additions and 3 deletions

View file

@ -79,7 +79,6 @@
* \i letters + underscore and colon * \i letters + underscore and colon
* \c XML Namechar, see: https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar * \c XML Namechar, see: https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar
* *
* Not implemented:
* \p{X} category escape. the ones identified in openconfig and yang-models are: * \p{X} category escape. the ones identified in openconfig and yang-models are:
* \p{L} Letters [ultmo]? * \p{L} Letters [ultmo]?
* \p{M} Marks [nce]? * \p{M} Marks [nce]?

View file

@ -33,7 +33,8 @@
* Yang parser. Hopefully useful but not complete * Yang parser. Hopefully useful but not complete
* @see https://tools.ietf.org/html/rfc6020 YANG 1.0 * @see https://tools.ietf.org/html/rfc6020 YANG 1.0
* @see https://tools.ietf.org/html/rfc7950 YANG 1.1 * @see https://tools.ietf.org/html/rfc7950 YANG 1.1
* * @note differences in double quoted strings: 1.1 does not allow \x, but 1.0
* does (where x is not n|t|"|\). See mode DQESC
*/ */
%{ %{
@ -247,6 +248,18 @@ identifier [A-Za-z_][A-Za-z0-9_\-\.]*
<DQESC>[nt"\\] { BEGIN(_YY->yy_lex_state); <DQESC>[nt"\\] { BEGIN(_YY->yy_lex_state);
clixon_yang_parselval.string = strdup(yytext); clixon_yang_parselval.string = strdup(yytext);
return CHARS; } return CHARS; }
<DQESC>[nt"\\] { BEGIN(_YY->yy_lex_state);
clixon_yang_parselval.string = strdup(yytext);
return CHARS; }
<DQESC>[^nt"\\] { char *str = malloc(3);
/* This is for Yang 1.0 double-quoted strings */
BEGIN(_YY->yy_lex_state);
str[0] = '\\';
str[1] = yytext[0];
str[2] = '\0';
clixon_yang_parselval.string = str;
return CHARS; }
<COMMENT1>[^*\n]* /* eat anything that's not a '*' */ <COMMENT1>[^*\n]* /* eat anything that's not a '*' */
<COMMENT1>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ <COMMENT1>"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */
<COMMENT1>"*"+"/" BEGIN(_YY->yy_lex_state); <COMMENT1>"*"+"/" BEGIN(_YY->yy_lex_state);

View file

@ -1288,6 +1288,7 @@ anyxml_substmt : when_stmt { clicon_debug(2,"anyxml-substmt -> when-st
| description_stmt { clicon_debug(2,"anyxml-substmt -> description-stmt"); } | description_stmt { clicon_debug(2,"anyxml-substmt -> description-stmt"); }
| reference_stmt { clicon_debug(2,"anyxml-substmt -> reference-stmt"); } | reference_stmt { clicon_debug(2,"anyxml-substmt -> reference-stmt"); }
| ustring ':' ustring ';' { free($1); free($3); clicon_debug(2,"anyxml-substmt -> anyxml extension"); } | ustring ':' ustring ';' { free($1); free($3); clicon_debug(2,"anyxml-substmt -> anyxml extension"); }
| unknown_stmt { clicon_debug(2,"anyxml-substmt -> unknown-stmt");}
; ;
/* uses-stmt = uses-keyword identifier-ref-arg-str */ /* uses-stmt = uses-keyword identifier-ref-arg-str */
@ -1728,7 +1729,8 @@ qstrings : qstrings '+' qstring
qstring : '"' ustring '"' { $$=$2; clicon_debug(2,"string-> \" ustring \"");} qstring : '"' ustring '"' { $$=$2; clicon_debug(2,"string-> \" ustring \"");}
| '"' '"' { $$=strdup(""); clicon_debug(2,"string-> \" \"");} | '"' '"' { $$=strdup(""); clicon_debug(2,"string-> \" \"");}
| SQ ustring SQ { $$=$2; clicon_debug(2,"string-> ' ustring '"); } | SQ ustring SQ { $$=$2; clicon_debug(2,"string-> ' ustring '"); }
; | SQ SQ { $$=strdup(""); clicon_debug(2,"string-> ' '");}
;
/* unquoted string */ /* unquoted string */
ustring : ustring CHARS ustring : ustring CHARS