fix 32 bit problem

This commit is contained in:
andri lim 2019-08-14 18:34:59 +07:00 committed by zah
parent f6a7da52e0
commit a0607c6375
3 changed files with 6 additions and 2 deletions

View File

@ -276,7 +276,7 @@ proc scanNumber(lexer: var JsonLexer) =
lexer.tok = tkInt
let scannedValue = lexer.scanInt()
checkForNonPortableInt scannedValue
lexer.intVal = int(scannedValue)
lexer.intVal = int64(scannedValue)
if lexer.stream[].eof: return
c = lexer.stream[].peek()
if c == '.':

View File

@ -40,6 +40,10 @@ suite "lexer tests":
expectedToken tkInt, lexer.intVal == 190
expectedToken tkEof
lexerTest "int64 literal", "3568257348920230622":
expectedToken tkInt, lexer.intVal == 3568257348920230622'i64
expectedToken tkEof
lexerTest "float literal", ".340":
expectedToken tkFloat, lexer.floatVal =~ 0.340
expectedToken tkEof

View File

@ -3,7 +3,7 @@ import
proc dedent*(s: string): string =
var s = s.strip(leading = false)
var minIndent = 99999999999
var minIndent = high(int)
for l in s.splitLines:
let indent = count(l, ' ')
if indent == 0: continue