diff --git a/modules/database/src/ioc/dbStatic/dbLex.l b/modules/database/src/ioc/dbStatic/dbLex.l
index 33185133c..19812c9da 100644
--- a/modules/database/src/ioc/dbStatic/dbLex.l
+++ b/modules/database/src/ioc/dbStatic/dbLex.l
@@ -130,6 +130,14 @@ static int yyreset(void)
<INITIAL,JSON>{whitespace} ;
+<JSON>{doublequote}({stringchar}|{escape})*{doublequote} { /* bad JSON */
+ yyerrorAbort("Bad character in JSON string");
+}
+
+<JSON>{singlequote}({stringchar}|{escape})*{singlequote} { /* bad JSON */
+ yyerrorAbort("Bad character in JSON string");
+}
+
<INITIAL,JSON>. {
char message[40];
YY_BUFFER_STATE *dummy=0;
results in this error message:
woz$ softIoc -d ~/db/test.db
Error: Bad character in JSON string
at or before ""a b"" in file "/Users/anj/db/test.db" line 5
Error: Invalid character ')'
Error: syntax error
dbLoadRecords: failed to load '/Users/anj/db/test.db'
Error: Failed to load: /Users/anj/db/test.db
which is better, although not perfect because of the messages afterwards. Instead of just calling yyerrorAbort() it could take a look at the string (found in yytext) and explain what's wrong with it. Contributions welcomed...
This change
diff --git a/modules/ database/ src/ioc/ dbStatic/ dbLex.l b/modules/ database/ src/ioc/ dbStatic/ dbLex.l .19812c9da 100644 database/ src/ioc/ dbStatic/ dbLex.l database/ src/ioc/ dbStatic/ dbLex.l
index 33185133c.
--- a/modules/
+++ b/modules/
@@ -130,6 +130,14 @@ static int yyreset(void)
<INITIAL, JSON>{whitespac e} ;
+<JSON> {doublequote} ({stringchar} |{escape} )*{doublequote} { /* bad JSON */ {singlequote} ({stringchar} |{escape} )*{singlequote} { /* bad JSON */ BUFFER_ STATE *dummy=0;
+ yyerrorAbort("Bad character in JSON string");
+}
+
+<JSON>
+ yyerrorAbort("Bad character in JSON string");
+}
+
<INITIAL,JSON>. {
char message[40];
YY_
results in this error message:
woz$ softIoc -d ~/db/test.db anj/db/ test.db" line 5 anj/db/ test.db' anj/db/ test.db
Error: Bad character in JSON string
at or before ""a b"" in file "/Users/
Error: Invalid character ')'
Error: syntax error
dbLoadRecords: failed to load '/Users/
Error: Failed to load: /Users/
which is better, although not perfect because of the messages afterwards. Instead of just calling yyerrorAbort() it could take a look at the string (found in yytext) and explain what's wrong with it. Contributions welcomed...