summaryrefslogtreecommitdiff
path: root/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go
blob: 7ffb4ae06ff0c3b3e8edaf605e8956873cb5ae40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ini

import (
	"unicode"
)

// isWhitespace will return whether or not the character is
// a whitespace character.
//
// Whitespace is defined as a space or tab.
func isWhitespace(c rune) bool {
	return unicode.IsSpace(c) && c != '\n' && c != '\r'
}

func newWSToken(b []rune) (Token, int, error) {
	i := 0
	for ; i < len(b); i++ {
		if !isWhitespace(b[i]) {
			break
		}
	}

	return newToken(TokenWS, b[:i], NoneType), i, nil
}