Documentation
¶
Index ¶
- type Scanner
- func (s *Scanner) File() *token.File
- func (s *Scanner) Init(f *token.File, data []byte)
- func (s *Scanner) Scan() (pos token.Pos, tok token.Token, lit string)
- func (s *Scanner) ScanStringExpr() (pos token.Pos, tok token.Token, lit string)
- func (s *Scanner) ScanWithRegex() (pos token.Pos, tok token.Token, lit string)
- func (s *Scanner) Unread()
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) ScanStringExpr ¶ added in v0.39.0
ScanStringExpr will scan the next token in a string expression context.
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.