1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00

Parse float literals of the kind ".01", ".0..." properly

This commit is contained in:
Robert Krimen 2013-04-29 09:55:20 +02:00
parent b5e40f8a85
commit a6d6f26c01
2 changed files with 9 additions and 3 deletions

View File

@ -396,10 +396,8 @@ func (self *_lexer) scanNumericLiteral() _token {
isHex, isOctal := false, false
{
self.accept(".")
acceptable := "0123456789"
if self.accept("0") {
if !self.accept(".") && self.accept("0") {
if self.accept("xX") {
acceptable = "0123456789abcdefABCDEF"
isHex = true

View File

@ -288,4 +288,12 @@ Second line \
"number 0",
)
test(`.01`,
"number .01",
)
test(`.01e+2`,
"number .01e+2",
)
}