diff --git a/src/ioc/dbStatic/dbLex.l b/src/ioc/dbStatic/dbLex.l index e79120a0e..d4f232518 100644 --- a/src/ioc/dbStatic/dbLex.l +++ b/src/ioc/dbStatic/dbLex.l @@ -18,6 +18,7 @@ bareword [a-zA-Z0-9_\-+:.\[\]<>;] punctuation [:,\[\]{}] normalchar [^"\\\0-\x1f] +barechar [a-zA-Z0-9_\-+.] escapedchar ({backslash}["\\/bfnrt]) hexdigit [0-9a-fA-F] unicodechar ({backslash}"u"{hexdigit}{4}) @@ -102,6 +103,11 @@ static int yyreset(void) return jsonSTRING; } +{barechar}+ { + yylval.Str = dbmfStrdup((char *) yytext); + return jsonBARE; +} + {number} { yylval.Str = dbmfStrdup((char *) yytext); return jsonNUMBER; diff --git a/src/ioc/dbStatic/dbYacc.y b/src/ioc/dbStatic/dbYacc.y index 870ff01b0..25df127ed 100644 --- a/src/ioc/dbStatic/dbYacc.y +++ b/src/ioc/dbStatic/dbYacc.y @@ -30,9 +30,9 @@ static int yyAbort = 0; %token tokenSTRING tokenCDEFS %token jsonNULL jsonTRUE jsonFALSE -%token jsonNUMBER jsonSTRING +%token jsonNUMBER jsonSTRING jsonBARE %type json_value json_object json_array -%type json_members json_pair json_elements +%type json_members json_pair json_elements json_string %% @@ -296,13 +296,21 @@ json_members: json_pair if (dbStaticDebug>2) printf("json %s\n", $$); }; -json_pair: jsonSTRING ':' json_value +json_pair: json_string ':' json_value { $$ = dbmfStrcat3($1, ":", $3); dbmfFree($1); dbmfFree($3); if (dbStaticDebug>2) printf("json %s\n", $$); }; +json_string: jsonSTRING + | jsonBARE +{ + $$ = dbmfStrcat3("\"", $1, "\""); + dbmfFree($1); + if (dbStaticDebug>2) printf("json %s\n", $$); +}; + json_array: '[' ']' { $$ = dbmfStrdup("[]"); @@ -327,7 +335,7 @@ json_value: jsonNULL { $$ = dbmfStrdup("null"); } | jsonTRUE { $$ = dbmfStrdup("true"); } | jsonFALSE { $$ = dbmfStrdup("false"); } | jsonNUMBER - | jsonSTRING + | json_string | json_array | json_object ;