File: ws_token.go

package info (click to toggle)
golang-github-aws-aws-sdk-go-v2 1.17.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 384,244 kB
  • sloc: java: 13,538; makefile: 400; sh: 137
file content (24 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (11)
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
}