diff --git a/examples/example3.json b/examples/example3.json index ab826afc85b9e98d56cb8106e1a41d803b4721ec..b7ca9411a89a8167a6bb930fa91e32444ad22c98 100644 --- a/examples/example3.json +++ b/examples/example3.json @@ -3,7 +3,7 @@ "value": "_&File", "popup": { "menuitem": [ - {"value": "_&New", "onclick": "CreateNewDoc(\"\")"}, + {"value": "_&New", "onclick": "CreateNewDoc(\"\"\")"}, {"value": "_&Open", "onclick": "OpenDoc()"}, {"value": "_&Close", "onclick": "CloseDoc()"} ] diff --git a/loadjson.m b/loadjson.m index 8c92409f3f63438b78d052d0a6415eefb81417b6..fcbaf9b003750e57879be0fceab887bd972b4f17 100644 --- a/loadjson.m +++ b/loadjson.m @@ -50,6 +50,10 @@ end pos = 1; len = length(string); inStr = string; isoct=exist('OCTAVE_VERSION'); arraytoken=find(inStr=='[' | inStr==']' | inStr=='"'); +jstr=inStr; +jstr=regexprep(jstr,'\\\\',' '); +escquote=regexp(jstr,'\\"'); +arraytoken=sort([arraytoken escquote]); % String delimiters and escape chars identified to improve speed: esc = find(inStr=='"' | inStr=='\' ); % comparable to: regexp(inStr, '["\\]'); @@ -452,7 +456,7 @@ while(pos<len) end pos=pos+1; end - +error('unmatched quotation mark'); %%------------------------------------------------------------------------- function [endpos e1l e1r maxlevel] = matching_bracket(str,pos) global arraytoken