update scanner comment and test float with trailing dot

This commit is contained in:
Matt Jaffee 2017-03-07 15:56:02 -06:00
parent 7ffeeeede3
commit be8b976ba1
2 changed files with 4 additions and 2 deletions

View file

@ -82,7 +82,7 @@ func TestParser_Parse(t *testing.T) {
// Parse with float arguments.
t.Run("WithFloatArgs", func(t *testing.T) {
q, err := pql.ParseString(`MyCall( key=12.25, foo= 13.167)`)
q, err := pql.ParseString(`MyCall( key=12.25, foo= 13.167, bar=2., baz=0.9)`)
if err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(q.Calls[0],
@ -91,6 +91,8 @@ func TestParser_Parse(t *testing.T) {
Args: map[string]interface{}{
"key": 12.25,
"foo": 13.167,
"bar": 2.,
"baz": 0.9,
},
},
) {

View file

@ -140,7 +140,7 @@ func (s *Scanner) scanIdent() (tok Token, pos Pos, lit string) {
return IDENT, pos, lit
}
// scanNumber consumes consecutive integer digits.
// scanNumber consumes consecutive digits and up to one '.' character.
func (s *Scanner) scanNumber() (tok Token, pos Pos, lit string) {
pos = s.pos
tok = NUMBER