We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
if number is not natural, example : .001 23. -.01 1e+2 -1E-2 ....
then decode function is error, example : k = json_decode( [{"number":1E+1}] )
My solution is :
#define df_begin_number '+-.'
function parseNumber()
local m.tk m.tk = this.getToken()
&& if it not begin digit if not ( isdigit( m.tk) or m.tk $ df_begin_number ) this.setError( 'number is missing') return 0 endif
local nStartPos, c, isInt, cNumero m.nStartPos = this.nPos
&& scan digits m.c = this.nextChar() do while isdigit( m.c) or m.c $ 'Ee' + df_begin_number m.c = this.nextChar() enddo
&& get digits m.cNumero = substr( this.cJson, m.nStartPos, this.nPos - m.nStartPos)
&& is valid number if type( m.cNumero) = 'N' return Evalu( m.cNumero) else && error this.setError( 'Invalid number: ' + m.cNumero) return 0 endif
The text was updated successfully, but these errors were encountered:
No branches or pull requests
if number is not natural, example :
.001
23.
-.01
1e+2
-1E-2
....
then decode function is error, example :
k = json_decode( [{"number":1E+1}] )
My solution is :
#define df_begin_number '+-.'
function parseNumber()
local m.tk
m.tk = this.getToken()
&& if it not begin digit
if not ( isdigit( m.tk) or m.tk $ df_begin_number )
this.setError( 'number is missing')
return 0
endif
local nStartPos, c, isInt, cNumero
m.nStartPos = this.nPos
&& scan digits
m.c = this.nextChar()
do while isdigit( m.c) or m.c $ 'Ee' + df_begin_number
m.c = this.nextChar()
enddo
&& get digits
m.cNumero = substr( this.cJson, m.nStartPos, this.nPos - m.nStartPos)
&& is valid number
if type( m.cNumero) = 'N'
return Evalu( m.cNumero)
else
&& error
this.setError( 'Invalid number: ' + m.cNumero)
return 0
endif
The text was updated successfully, but these errors were encountered: