telegraf/plugins/parsers/wavefront/token.go

47 lines
622 B
Go
Raw Normal View History

2018-08-14 07:37:06 +08:00
package wavefront
type Token int
const (
// Special tokens
Illegal Token = iota
2018-08-14 07:37:06 +08:00
EOF
Ws
2018-08-14 07:37:06 +08:00
// Literals
literalBeg
Letter // metric name, source/point tags
Number
MinusSign
Underscore
Dot
Slash
Backslash
Comma
Delta
literalEnd
2018-08-14 07:37:06 +08:00
// Misc characters
Quotes
Equals
Newline
2018-08-14 07:37:06 +08:00
)
func isWhitespace(ch rune) bool {
return ch == ' ' || ch == '\t' || ch == '\n'
}
func isLetter(ch rune) bool {
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
}
func isNumber(ch rune) bool {
return ch >= '0' && ch <= '9'
}
func isDelta(ch rune) bool {
return ch == '\u2206' || ch == '\u0394'
}
2018-08-14 07:37:06 +08:00
var eof = rune(0)