Documentation
¶
Index ¶
- Constants
- Variables
- func IsAlnum(r rune) bool
- func IsNumeric(r rune) bool
- func StringPredicate(valid string) func(rune) bool
- type L
- func (l *L) AcceptOnce(pred func(rune) bool) bool
- func (l *L) AcceptWhile(pred func(rune) bool) bool
- func (l *L) Current() string
- func (l *L) Emit(t tokens.TokenType)
- func (l *L) Err() error
- func (l *L) Errorf(format string, args ...any) lexingState
- func (l *L) Next() rune
- func (l *L) NextToken() tokens.Token
- func (l *L) Peek() rune
- func (l *L) Rewind()
- func (l *L) Skip()
- func (l *L) Tokens() <-chan tokens.Token
Constants ¶
View Source
const EOF rune = -1
Variables ¶
View Source
var ErrUnexpectedToken = errors.New("unexpected token")
Functions ¶
func StringPredicate ¶
Types ¶
type L ¶
type L struct {
// contains filtered or unexported fields
}
func (*L) AcceptOnce ¶
AcceptOnce accepts a single rune if the predicate is true. Returns true when a rune is accepted. Otherwise, the state is rewound and false is returned.
func (*L) AcceptWhile ¶
AcceptWhile accepts runes while the predicate is true. Returns true when at least one rune is accepted. Otherwise, the state is rewound and returns false.
Click to show internal directories.
Click to hide internal directories.