Skip to content
Snippets Groups Projects
Commit 4046cfb8 authored by fangq's avatar fangq
Browse files

loadjson quotation mark escape bug, see http://bit.ly/yyk1nS

git-svn-id: http://svn.code.sf.net/p/iso2mesh/code/trunk/jsonlab@358 786e58fb-9377-0410-9ff7-e4ac0ac0635c
parent ab8f3e3b
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"value": "_&File", "value": "_&File",
"popup": { "popup": {
"menuitem": [ "menuitem": [
{"value": "_&New", "onclick": "CreateNewDoc(\"\")"}, {"value": "_&New", "onclick": "CreateNewDoc(\"\"\")"},
{"value": "_&Open", "onclick": "OpenDoc()"}, {"value": "_&Open", "onclick": "OpenDoc()"},
{"value": "_&Close", "onclick": "CloseDoc()"} {"value": "_&Close", "onclick": "CloseDoc()"}
] ]
......
...@@ -50,6 +50,10 @@ end ...@@ -50,6 +50,10 @@ end
pos = 1; len = length(string); inStr = string; pos = 1; len = length(string); inStr = string;
isoct=exist('OCTAVE_VERSION'); isoct=exist('OCTAVE_VERSION');
arraytoken=find(inStr=='[' | inStr==']' | inStr=='"'); 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: % String delimiters and escape chars identified to improve speed:
esc = find(inStr=='"' | inStr=='\' ); % comparable to: regexp(inStr, '["\\]'); esc = find(inStr=='"' | inStr=='\' ); % comparable to: regexp(inStr, '["\\]');
...@@ -452,7 +456,7 @@ while(pos<len) ...@@ -452,7 +456,7 @@ while(pos<len)
end end
pos=pos+1; pos=pos+1;
end end
error('unmatched quotation mark');
%%------------------------------------------------------------------------- %%-------------------------------------------------------------------------
function [endpos e1l e1r maxlevel] = matching_bracket(str,pos) function [endpos e1l e1r maxlevel] = matching_bracket(str,pos)
global arraytoken global arraytoken
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment