Don't allow floats starting with a dot

This commit is contained in:
Thomas Pelletier
2013-12-10 17:17:15 +01:00
parent c743c90315
commit 278c4d97ec
3 changed files with 21 additions and 0 deletions
+7
View File
@@ -234,6 +234,10 @@ func lexRvalue(l *lexer) stateFn {
return lexNumber
}
if next == '.' {
return l.errorf("cannot start float with a dot")
}
if isSpace(next) {
l.ignore()
}
@@ -416,6 +420,9 @@ func lexNumber(l *lexer) stateFn {
l.backup()
break
}
if point_seen && !digit_seen {
return l.errorf("cannot start float with a dot")
}
}
if !digit_seen {