Documentation
¶
Index ¶
- Constants
- type Location
- type Scanner
- func (s *Scanner) Advance() error
- func (s *Scanner) ConsumeRune(r rune) error
- func (s *Scanner) ConsumeUntil(pred func(r rune) bool) error
- func (s *Scanner) ConsumeWhile(pred func(r rune) bool) error
- func (s *Scanner) Current() rune
- func (s *Scanner) ParseError(err error) error
- func (s *Scanner) ParseString(str string) error
- func (s *Scanner) ReadN(n int) (string, error)
- func (s *Scanner) ReadRune() (r rune, size int, err error)
- func (s *Scanner) ReadWhile(pred func(r rune) bool) (string, error)
Constants ¶
View Source
const EOF = rune(0)
EOF is a rune representing the end of a file
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Location ¶ added in v0.0.13
type Location struct {
BytePos, RunePos, Line, Column int
}
Location describes a location in the Scanner's stream.
type Scanner ¶
type Scanner struct {
// Path is the file path.
Path string
// Location is the current position in the stream.
Location Location
// contains filtered or unexported fields
}
Scanner is a backtracking reader.
func (*Scanner) ConsumeRune ¶
ConsumeRune consumes the given rune
func (*Scanner) ConsumeUntil ¶
ConsumeUntil advances the parser until the predicate holds
func (*Scanner) ConsumeWhile ¶
ConsumeWhile advances the parser while the predicate holds
func (*Scanner) ParseError ¶ added in v0.0.6
ParseError creates a new parser error with the current position.
func (*Scanner) ParseString ¶
ParseString parses the given string
Click to show internal directories.
Click to hide internal directories.