Documentation
¶
Index ¶
- type Scanner
- func (s *Scanner) Emit() parse.Token
- func (s *Scanner) MatchFloat() int
- func (s *Scanner) MatchIdentifier() int
- func (s *Scanner) MatchInteger() int
- func (s *Scanner) MatchString() int
- func (s *Scanner) MatchTimeWhence() int
- func (s *Scanner) MatchTimespan() int
- func (s *Scanner) MatchTopic() int
- func (s *Scanner) Rewind()
- func (s *Scanner) SkipToBoundary(boundary boundaryFunc) int
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
func (*Scanner) MatchFloat ¶
MatchFloat returns the length of the next token, assuming it is a floating point number
Grammar:
float = *DIGIT "." 1*DIGIT
func (*Scanner) MatchIdentifier ¶
MatchIdentifier returns the length of the next token, assuming it is an identifier.
Grammar:
identifier = 1*(ALPHA / DIGIT / '_' / '-')
func (*Scanner) MatchInteger ¶
MatchInteger returns the length of the next token, assuming it is a number
Grammar:
integer = 1*DIGIT
func (*Scanner) MatchString ¶
MatchString returns the length of the next token, assuming it is a string
Grammar:
string = DQUOTE *ALPHANUM DQUOTE / SQUOTE *ALPHANUM SQUOTE
func (*Scanner) MatchTimeWhence ¶
MatchTimeWhence returns the length of the next token, assuming it is a time-whence
Grammar:
time-whence = "~now" / "~" RFC3339
func (*Scanner) MatchTimespan ¶
MatchTimespan returns the length of the next token, assuming it is a timespan
Grammar:
timespan = "@second" / "@minute" / "@hour" / "@day" / "@week" / "@month" / "@year"
func (*Scanner) MatchTopic ¶
MatchTopic returns the length of the next token, assuming it is a topic string.
Grammar:
topic = "/" 1*(ALPHA / DIGIT / "/")
func (*Scanner) SkipToBoundary ¶
SkipToBoundary returns the number of bytes until the next delimiter. This is useful for skipping over invalid tokens.
type TokenType ¶
type TokenType int
const ( TOK_INVALID TokenType = iota TOK_EOF TOK_NL TOK_IDENTIFIER TOK_KEYWORD TOK_INTEGER TOK_FLOAT TOK_STRING TOK_TOPIC TOK_COMMA TOK_COLON TOK_PIPE // Expressions TOK_EQ_EQ TOK_NOT_EQ TOK_LESS TOK_LESS_EQ TOK_GREATER TOK_GREATER_EQ TOK_PLUS TOK_MINUS TOK_SLASH TOK_STAR // Time TOK_WHENCE TOK_TIMESPAN TOK_PAREN_L TOK_PAREN_R TOK_BRACKET_L TOK_BRACKET_R TOK_ARROW )