2018-08-13 23:37:06 +00:00
|
|
|
package wavefront
|
|
|
|
|
|
|
|
type Token int
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Special tokens
|
|
|
|
ILLEGAL Token = iota
|
|
|
|
EOF
|
|
|
|
WS
|
|
|
|
|
|
|
|
// Literals
|
|
|
|
literal_beg
|
|
|
|
LETTER // metric name, source/point tags
|
|
|
|
NUMBER
|
|
|
|
MINUS_SIGN
|
|
|
|
UNDERSCORE
|
|
|
|
DOT
|
|
|
|
SLASH
|
|
|
|
BACKSLASH
|
|
|
|
COMMA
|
2018-12-11 00:42:25 +00:00
|
|
|
DELTA
|
2018-08-13 23:37:06 +00:00
|
|
|
literal_end
|
|
|
|
|
|
|
|
// Misc characters
|
|
|
|
QUOTES
|
|
|
|
EQUALS
|
|
|
|
NEWLINE
|
|
|
|
)
|
|
|
|
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
|
2018-12-11 00:42:25 +00:00
|
|
|
func isDelta(ch rune) bool {
|
|
|
|
return ch == '\u2206' || ch == '\u0394'
|
|
|
|
}
|
|
|
|
|
2018-08-13 23:37:06 +00:00
|
|
|
var eof = rune(0)
|