aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/quasilyte/regex/syntax/utils.go
blob: e5b6548254bd9d5959633dc45fe975cfafc204e7 (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
25
26
27
28
29
30
package syntax

func isSpace(ch byte) bool {
	switch ch {
	case '\r', '\n', '\t', '\f', '\v', ' ':
		return true
	default:
		return false
	}
}

func isAlphanumeric(ch byte) bool {
	return (ch >= 'a' && ch <= 'z') ||
		(ch >= 'A' && ch <= 'Z') ||
		(ch >= '0' && ch <= '9')
}

func isDigit(ch byte) bool {
	return ch >= '0' && ch <= '9'
}

func isOctalDigit(ch byte) bool {
	return ch >= '0' && ch <= '7'
}

func isHexDigit(ch byte) bool {
	return (ch >= '0' && ch <= '9') ||
		(ch >= 'a' && ch <= 'f') ||
		(ch >= 'A' && ch <= 'F')
}