dbStatic: Better error reports for bad JSON string chars

This commit is contained in:
Andrew Johnson
2021-09-03 14:16:37 -05:00
parent 33ffabaa93
commit 8e2f78caf5
2 changed files with 15 additions and 5 deletions

View File

@@ -101,10 +101,6 @@ static int yyreset(void)
")" return(yytext[0]);
"," return(yytext[0]);
{doublequote}({stringchar}|{escape})*{newline} { /* bad string */
yyerrorAbort("Newline in string, closing quote missing");
}
<JSON>"null" return jsonNULL;
<JSON>"true" return jsonTRUE;
<JSON>"false" return jsonFALSE;
@@ -130,6 +126,20 @@ static int yyreset(void)
<INITIAL,JSON>{whitespace} ;
/* Error patterns */
{doublequote}({stringchar}|{escape})*{newline} {
yyerrorAbort("Newline in string, closing quote missing");
}
<JSON>{doublequote}({stringchar}|{escape})*{doublequote} {
yyerrorAbort("Bad character in JSON string");
}
<JSON>{singlequote}({stringchar}|{escape})*{singlequote} {
yyerrorAbort("Bad character in JSON string");
}
<INITIAL,JSON>. {
char message[40];
YY_BUFFER_STATE *dummy=0;

View File

@@ -374,7 +374,7 @@ static int yyerror(char *str)
else
epicsPrintf("Error");
if (!yyFailed) { /* Only print this stuff once */
epicsPrintf(" at or before \"%s\"", yytext);
epicsPrintf(" at or before '%s'", yytext);
dbIncludePrint();
yyFailed = TRUE;
}