Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on parsing Float #31

Open
KanedaFr opened this issue May 18, 2020 · 0 comments
Open

Error on parsing Float #31

KanedaFr opened this issue May 18, 2020 · 0 comments

Comments

@KanedaFr
Copy link

KanedaFr commented May 18, 2020

exception on parsing a float value.
since float use "," also the key:value separator

to fix (sorry, I don't know how to make a PR)
replace

if (inSymbol){
	if(c==' ' || c=="\n" || c=="\r" || c=="\t" || c==',' || c==":" || c=="}" || c=="]"){ //end of symbol, return it
		pos--;
		return symbol;
	}
	else{
		symbol+=c;
		continue;
	}

by

if (inSymbol){
	if(c==' ' || c=="\n" || c=="\r" || c=="\t" || c==":" || c=="}" || c=="]"){ //end of symbol, return it
		pos--;
		return symbol;
	}
	else if(c==","){
		//i doubt pos > json.length in this case
		var c2 = json.charAt(pos);
		if ((c2 >= '0') && (c2<= '9'))
		{
			symbol+=c;
			continue;
		}
		else 
		{
			//not in float
			pos--;
			return symbol;
		}
	}
	else{
		symbol+=c;
		continue;
	}

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant