Documentation ¶
Index ¶
- func HasChar(r rune, accept string) bool
- func IsAlphaNumeric(r rune) bool
- func IsNumber(r rune) bool
- func IsQoute(r rune) bool
- func IsSpace(r rune) bool
- type Pos
- type Scanner
- func (this *Scanner) Accept(valid string) bool
- func (this *Scanner) AcceptRun(valid string) (found int)
- func (this *Scanner) Backup()
- func (this *Scanner) Commit() string
- func (this *Scanner) Ignore()
- func (this *Scanner) IsEOF() bool
- func (this *Scanner) LineNumber() int
- func (this *Scanner) LoadState(state ScannerState)
- func (this *Scanner) MoveStart(pos int)
- func (this *Scanner) Next() rune
- func (this *Scanner) Peek() rune
- func (this *Scanner) Prefix(pre string) bool
- func (this *Scanner) Rollback()
- func (this *Scanner) RunTo(valid string) rune
- func (this *Scanner) SaveState() ScannerState
- func (this *Scanner) Scan(valid func(r rune) bool) bool
- func (this *Scanner) ScanNumber() bool
- func (this *Scanner) ScanWord() bool
- func (this *Scanner) SetPosition(pos int)
- func (this *Scanner) SetStartPosition(pos int)
- func (this *Scanner) Size() int
- func (this *Scanner) Skip()
- func (this *Scanner) SkipSpaces()
- func (this *Scanner) SkipToNewLine()
- func (this *Scanner) StartPosition() int
- type ScannerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAlphaNumeric ¶
isAlphaNumeric reports whether r is an alphabetic, digit, or underscore.
Types ¶
type Pos ¶
type Pos int
Pos represents a byte position in the original input text from which this template was parsed.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner, Iterates through a string.
func NewScanner ¶
NewScanner Creates a New Scanner pointer.
func (*Scanner) Backup ¶
func (this *Scanner) Backup()
Backup steps back one rune. Can only be called once per call of next.
func (*Scanner) Commit ¶
Token return the current selected text and move the start position to the current position
func (*Scanner) Ignore ¶
func (this *Scanner) Ignore()
Ignore skips over the pending input before this point.
func (*Scanner) LineNumber ¶
lineNumber reports which line we're on, based on the position of the previous item returned by nextItem. Doing it this way means we don't have to worry about peek double counting.
func (*Scanner) LoadState ¶
func (this *Scanner) LoadState(state ScannerState)
func (*Scanner) Rollback ¶
func (this *Scanner) Rollback()
Rollback move the curr pos back to the start pos.
func (*Scanner) SaveState ¶
func (this *Scanner) SaveState() ScannerState
func (*Scanner) ScanNumber ¶
func (*Scanner) ScanWord ¶
scan upto to the end of a word, returns true if a word was scanned. a word must start with a letter or '_' and can contain numbers after the first character.
func (*Scanner) SetPosition ¶
func (*Scanner) SetStartPosition ¶
func (*Scanner) SkipSpaces ¶
func (this *Scanner) SkipSpaces()
func (*Scanner) SkipToNewLine ¶
func (this *Scanner) SkipToNewLine()
func (*Scanner) StartPosition ¶
type ScannerState ¶
type ScannerState struct {
// contains filtered or unexported fields
}