Add support for hex escapes to the dbStatic lexer
Only translate escaped chars that are inside a jsonSTRING value.
This commit is contained in:
@@ -20,10 +20,11 @@ bareword [a-zA-Z0-9_\-+:.\[\]<>;]
|
||||
punctuation [:,\[\]{}]
|
||||
normalchar [^"\\\0-\x1f]
|
||||
barechar [a-zA-Z0-9_\-+.]
|
||||
escapedchar ({backslash}["\\/bfnrt])
|
||||
escapedchar ({backslash}[^ux1-9])
|
||||
hexdigit [0-9a-fA-F]
|
||||
latinchar ({backslash}"x"{hexdigit}{2})
|
||||
unicodechar ({backslash}"u"{hexdigit}{4})
|
||||
jsonchar ({normalchar}|{escapedchar}|{unicodechar})
|
||||
jsonchar ({normalchar}|{escapedchar}|{latinchar}|{unicodechar})
|
||||
jsondqstr ({doublequote}{jsonchar}*{doublequote})
|
||||
|
||||
sign ([+-]?)
|
||||
|
||||
@@ -1172,12 +1172,14 @@ static void dbRecordField(char *name,char *value)
|
||||
yyerror(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*value == '"') {
|
||||
/* jsonSTRING values still have their quotes */
|
||||
value++;
|
||||
value[strlen(value) - 1] = 0;
|
||||
dbTranslateEscape(value, value); /* in-place; safe & legal */
|
||||
}
|
||||
dbTranslateEscape(value, value); /* in-place; safe & legal */
|
||||
|
||||
status = dbPutString(pdbentry,value);
|
||||
if (status) {
|
||||
char msg[128];
|
||||
@@ -1203,12 +1205,14 @@ static void dbRecordInfo(char *name, char *value)
|
||||
if (duplicate) return;
|
||||
ptempListNode = (tempListNode *)ellFirst(&tempList);
|
||||
pdbentry = ptempListNode->item;
|
||||
|
||||
if (*value == '"') {
|
||||
/* jsonSTRING values still have their quotes */
|
||||
value++;
|
||||
value[strlen(value) - 1] = 0;
|
||||
dbTranslateEscape(value, value); /* in-place; safe & legal */
|
||||
}
|
||||
dbTranslateEscape(value, value); /* yuck: in-place, but safe */
|
||||
|
||||
status = dbPutInfo(pdbentry,name,value);
|
||||
if (status) {
|
||||
epicsPrintf("Can't set \"%s\" info \"%s\" to \"%s\"\n",
|
||||
|
||||
Reference in New Issue
Block a user