Documentation
¶
Index ¶
- Constants
- func IsAsciiAlpha(char rune) bool
- func IsAsciiAlphaNumeric(char rune) bool
- func IsAsciiHexDigit(char rune) bool
- func IsAsciiLower(char rune) bool
- func IsAsciiNumeric(char rune) bool
- func IsAsciiUpper(char rune) bool
- func IsOneOf(set string, char rune) bool
- type Cursor
- func (self *Cursor) Consume() rune
- func (self *Cursor) ConsumeMatch(expected string) bool
- func (self *Cursor) ConsumeMatchIgnoreCase(expected string) bool
- func (self *Cursor) LookAhead(n uint) string
- func (self *Cursor) Peek() rune
- func (self *Cursor) Pos() int
- func (self *Cursor) Reconsume()
- func (self *Cursor) Remaining() string
- func (self *Cursor) Rewind()
- func (self *Cursor) Save()
Constants ¶
const Eof rune = math.MaxInt32
Methods returning a rune will return this sentinel value if the input has been exhausted.
Variables ¶
This section is empty.
Functions ¶
func IsAsciiAlpha ¶
Returns true if the current rune is an ASCII letter.
func IsAsciiAlphaNumeric ¶
Returns true if the current rune is an ASCII digit or letter.
func IsAsciiHexDigit ¶
Returns true if the current rune is an hex digit
func IsAsciiLower ¶
Returns true if the current rune is an ASCII lowercase letter.
func IsAsciiNumeric ¶
Returns true if the current rune is an ASCII digit.
func IsAsciiUpper ¶
Returns true if the current rune is an ASCII uppercase letter.
Types ¶
type Cursor ¶
type Cursor struct {
Inner string
// contains filtered or unexported fields
}
Cursor wraps an in-memory byte buffer and provides methods for matching its contents.
func (*Cursor) ConsumeMatch ¶
Consumes as many bytes as there are in the expected string if the next few codepoints match it case-sensitively.
func (*Cursor) ConsumeMatchIgnoreCase ¶
Consumes as many bytes as there are in the expected string if the next few codepoints match it case-insensitively.
func (*Cursor) LookAhead ¶
Returns the next n codepoints as a string.
Returns an empty string if there are not enough bytes in the string to accumulate n codepoints.
func (*Cursor) Reconsume ¶
func (self *Cursor) Reconsume()
Adjust the cursor's position within the input so that next time Cursor.Consume is called, it returns the same rune it just returned.