func (s *scanner) scanNumber() (tok token, lit string) {
	// Create a buffer and read the current character into it.
	var buf bytes.Buffer
	buf.WriteRune(s.read())

	tok = tokInt

	// Read every subsequent ident character into the buffer.
	// Non-int characters and EOF will cause the loop to exit.
	for {
		if ch := s.read(); ch == eof {
			break
		} else if !isDigit(ch) && !isDot(ch) {
			s.unread()
			break
		} else {
			_, _ = buf.WriteRune(ch)
			if isDot(ch) {
				if tok == tokInt {
					tok = tokFloat
				} else {
					return tokIllegal, buf.String()
				}
			}
		}
	}

	// Otherwise return as a regular identifier.
	return tok, buf.String()
}
// scanNumber consumes the current rune and all contiguous runes creating an int or a float.
scanNumber consumes the current rune and all contiguous runes creating an int or a float.
// scanNumber consumes the current rune and all contiguous runes creating an int or a float .
func (s *scanner) scanNumber() (tok token, lit string) {
	var buf bytes.Buffer
	buf.WriteRune(s.read())
	tok = tokInt
	for {
		if ch := s.read(); ch == eof {
			break
		} else if !isDigit(ch) && !isDot(ch) {
			s.unread()
			break
		} else {
			_, _ = buf.WriteRune(ch)
			if isDot(ch) {
				if tok == tokInt {
					tok = tokFloat
				} else {
					return tokIllegal, buf.String()
				}
			}
		}
	}
	return tok, buf.String()
}
func ( s * scanner ) scanNumber ( ) ( tok token , lit string ) { var buf bytes . Buffer buf . WriteRune ( s . read ( ) ) tok = tokInt for { if ch := s . read ( ) ; ch == eof { break } else if ! isDigit ( ch ) && ! isDot ( ch ) { s . unread ( ) break } else { _ , _ = buf . WriteRune ( ch ) if isDot ( ch ) { if tok == tokInt { tok = tokFloat } else { return tokIllegal , buf . String ( ) } } } } return tok , buf . String ( ) }
scanNumber consumes the current rune and all contiguous runes creating an int or a float.
scanNumber consumes the current rune and all contiguous runes creating an int or a float .
// Create a buffer and read the current character into it. // Read every subsequent ident character into the buffer. // Non-int characters and EOF will cause the loop to exit. // Otherwise return as a regular identifier.