We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7903b90 commit df6a01dCopy full SHA for df6a01d
jparse/lexer.go
@@ -455,7 +455,20 @@ func (l *lexer) scanNumber() token {
455
}
456
// Handle leading zeros
457
if isDigit(next) {
458
- return token{Type: typeNumber, Value: "0", Position: pos}
+ l.acceptAll(isDigit)
459
+ if l.acceptRune('.') {
460
+ if !l.acceptAll(isDigit) {
461
+ l.backup()
462
+ return token{Type: typeNumber, Value: l.input[pos:l.current-1], Position: pos}
463
+ }
464
465
+ if l.acceptRunes2('e', 'E') {
466
+ l.acceptRunes2('+', '-')
467
468
+ return token{Type: typeError, Value: "invalid number literal", Position: pos}
469
470
471
+ return token{Type: typeNumber, Value: l.input[pos:l.current], Position: pos}
472
473
474
0 commit comments