Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is used to tokenize Flux source.
func (*Scanner) Scan ¶
Scan will scan the next token while excluding regex literal tokens. This is useful in situations where the parser is not expecting a regular expression such as when reading a binary operator in an expression. This method is needed because the start token for division and the token for a regular expression are the same so this ensures the expression "a / b / c" will not be parsed as a regular expression.
func (*Scanner) ScanWithRegex ¶
ScanWithRegex will scan the next token for the entire grammar.
func (*Scanner) Unread ¶
func (s *Scanner) Unread()
Unread will reset the Scanner to go back to the Scanner's location before the last ScanWithRegex or Scan call. If either of the ScanWithRegex methods returned an EOF token, a call to Unread will not unread the discarded whitespace. This method is a no-op if called multiple times.