Documentation ¶
Index ¶
- Variables
- func ContainsRune(rs []rune, ru rune) bool
- func SurroundingString(b []byte, k int, pad int) string
- type Error
- type MFn
- type Match
- func (m *Match) And(pos int, fns ...MFn) (int, error)
- func (m *Match) AndR(pos int, fns ...MFn) (int, error)
- func (m *Match) Byte(pos int, b byte) (int, error)
- func (m *Match) ByteFn(pos int, fn func(byte) bool) (int, error)
- func (m *Match) ByteFnLoop(pos int, fn func(byte) bool) (int, error)
- func (m *Match) ByteSequence(pos int, seq []byte) (int, error)
- func (m *Match) BytesValue(pos int, fn MFn) (any, int, error)
- func (m *Match) Digit(pos int) (int, error)
- func (m *Match) Digits(pos int) (int, error)
- func (m *Match) DoubleQuotedString(pos int, maxLen int) (int, error)
- func (m *Match) Eof(pos int) (int, error)
- func (m *Match) EscapeAny(pos int, escape rune) (int, error)
- func (m *Match) FatalOnError(pos int, s string, fn MFn) (int, error)
- func (m *Match) Float(pos int) (int, error)
- func (m *Match) Float64Value(pos int) (any, int, error)
- func (m *Match) FnTrue(pos int, fn func() bool) (int, error)
- func (m *Match) Int64Value(pos int) (any, int, error)
- func (m *Match) IntFnValue(pos int, fn MFn) (any, int, error)
- func (m *Match) IntValue(pos int) (any, int, error)
- func (m *Match) Integer(pos int) (int, error)
- func (m *Match) Letter(pos int) (int, error)
- func (m *Match) LimitedLoop(pos int, min, max int, fn MFn) (int, error)
- func (m *Match) Loop(pos int, fn MFn) (int, error)
- func (m *Match) LoopSep(pos int, fn, sep MFn) (int, error)
- func (m *Match) LoopSepCanHaveLast(pos int, fn, sep MFn) (int, error)
- func (m *Match) MustErr(pos int, fn MFn) (int, error)
- func (m *Match) NBytes(pos int, n int) (int, error)
- func (m *Match) NBytesFn(pos int, n int, fn func(byte) bool) (int, error)
- func (m *Match) NLoop(pos int, n int, fn MFn) (int, error)
- func (m *Match) NRunes(pos int, n int) (int, error)
- func (m *Match) NRunesFn(pos int, n int, fn func(rune) bool) (int, error)
- func (m *Match) NotEof(p int) (int, error)
- func (m *Match) OnValue(pos int, fn VFn, cb func(any)) (int, error)
- func (m *Match) OnValue2(pos int, fn VFn, cb func(any) error) (int, error)
- func (m *Match) OneByte(pos int) (int, error)
- func (m *Match) OneRune(pos int) (int, error)
- func (m *Match) OptLoop(pos int, fn MFn) (int, error)
- func (m *Match) Optional(pos int, fn MFn) (int, error)
- func (m *Match) Or(pos int, fns ...MFn) (int, error)
- func (m *Match) OrValue(pos int, fns ...VFn) (any, int, error)
- func (m *Match) PrintfErr(pos int, f string, args ...any) (int, error)
- func (m *Match) PrintfNoErr(pos int, f string, args ...any) (int, error)
- func (m *Match) PtrFalse(pos int, v *bool) (int, error)
- func (m *Match) PtrFn(pos int, fn *MFn) (int, error)
- func (m *Match) PtrTrue(pos int, v *bool) (int, error)
- func (m *Match) QuotedString(pos int) (int, error)
- func (m *Match) QuotedString2(pos int, esc rune, maxLen1, maxLen2 int) (int, error)
- func (m *Match) RegexpFromStart(pos int, res string, cache bool, maxLen int) (int, error)
- func (m *Match) RegexpFromStartCached(pos int, res string, maxLen int) (int, error)
- func (m *Match) ReverseMode(pos int, reverse bool, fn MFn) (int, error)
- func (m *Match) Rune(pos int, ru rune) (int, error)
- func (m *Match) RuneFn(pos int, fn func(rune) bool) (int, error)
- func (m *Match) RuneFnLoop(pos int, fn func(rune) bool) (int, error)
- func (m *Match) RuneNoneOf(pos int, rs []rune) (int, error)
- func (m *Match) RuneOneOf(pos int, rs []rune) (int, error)
- func (m *Match) RuneRanges(pos int, rrs ...RuneRange) (int, error)
- func (m *Match) RuneSequence(pos int, seq []rune) (int, error)
- func (m *Match) RuneSequenceMid(pos int, rs []rune) (int, error)
- func (m *Match) RuneValue(pos int, fn MFn) (any, int, error)
- func (m *Match) Section(pos int, open, close string, esc rune, failOnNewline bool, maxLen int, ...) (int, error)
- func (m *Match) Sequence(pos int, seq string) (int, error)
- func (m *Match) SequenceMid(pos int, seq string) (int, error)
- func (m *Match) Spaces(pos int, includeNL bool, escape rune) (int, error)
- func (m *Match) StaticFalse(pos int, v bool) (int, error)
- func (m *Match) StaticTrue(pos int, v bool) (int, error)
- func (m *Match) StringSection(pos int, openclose string, esc rune, failOnNewline bool, maxLen int, ...) (int, error)
- func (m *Match) StringValue(pos int, fn MFn) (any, int, error)
- func (m *Match) ToNLOrErr(pos int, includeNL bool, esc rune) (int, error)
- type RuneRange
- type Scanner
- func (sc *Scanner) EnsureFatalError(err error) error
- func (sc *Scanner) NewValueKeeper() *ValueKeeper
- func (sc *Scanner) NewValueKeepers(n int) []*ValueKeeper
- func (sc *Scanner) ReadByte(pos int) (byte, int, error)
- func (sc *Scanner) ReadRune(pos int) (rune, int, error)
- func (sc *Scanner) SetSrc(src []byte)
- func (sc *Scanner) SetSrc2(src []byte, offset int)
- func (sc *Scanner) SrcByte(i int) byte
- func (sc *Scanner) SrcError(pos int, err error) error
- func (sc *Scanner) SrcFrom(a int) []byte
- func (sc *Scanner) SrcFromTo(a, b int) []byte
- func (sc *Scanner) SrcFullFromOffset() []byte
- func (sc *Scanner) SrcLen() int
- func (sc *Scanner) SrcMin() int
- func (sc *Scanner) SrcSection(pos int) string
- func (sc *Scanner) SrcTo(b int) []byte
- func (sc *Scanner) ValidPos(i int) int
- type VFn
- type ValueKeeper
- type Wrap
- func (w *Wrap) And(fns ...MFn) MFn
- func (w *Wrap) AndR(fns ...MFn) MFn
- func (w *Wrap) Byte(b byte) MFn
- func (w *Wrap) ByteFn(fn func(byte) bool) MFn
- func (w *Wrap) ByteFnLoop(fn func(byte) bool) MFn
- func (w *Wrap) ByteSequence(seq []byte) MFn
- func (w *Wrap) BytesValue(fn MFn) VFn
- func (w *Wrap) Digit() MFn
- func (w *Wrap) Digits() MFn
- func (w *Wrap) DoubleQuotedString(maxLen int) MFn
- func (w *Wrap) Eof() MFn
- func (w *Wrap) EscapeAny(escape rune) MFn
- func (w *Wrap) FatalOnError(s string, fn MFn) MFn
- func (w *Wrap) Float() MFn
- func (w *Wrap) Float64Value() VFn
- func (w *Wrap) FnTrue(fn func() bool) MFn
- func (w *Wrap) Int64Value() VFn
- func (w *Wrap) IntFnValue(fn MFn) VFn
- func (w *Wrap) IntValue() VFn
- func (w *Wrap) Integer() MFn
- func (w *Wrap) Letter() MFn
- func (w *Wrap) LimitedLoop(min, max int, fn MFn) MFn
- func (w *Wrap) Loop(fn MFn) MFn
- func (w *Wrap) LoopSep(fn, sep MFn) MFn
- func (w *Wrap) LoopSepCanHaveLast(fn, sep MFn) MFn
- func (w *Wrap) MustErr(fn MFn) MFn
- func (w *Wrap) NBytes(n int) MFn
- func (w *Wrap) NBytesFn(n int, fn func(byte) bool) MFn
- func (w *Wrap) NLoop(n int, fn MFn) MFn
- func (w *Wrap) NRunes(n int) MFn
- func (w *Wrap) NRunesFn(n int, fn func(rune) bool) MFn
- func (w *Wrap) NotEof() MFn
- func (w *Wrap) OnValue(fn VFn, cb func(any)) MFn
- func (w *Wrap) OnValue2(fn VFn, cb func(any) error) MFn
- func (w *Wrap) OneByte() MFn
- func (w *Wrap) OneRune() MFn
- func (w *Wrap) OptLoop(fn MFn) MFn
- func (w *Wrap) Optional(fn MFn) MFn
- func (w *Wrap) Or(fns ...MFn) MFn
- func (w *Wrap) OrValue(fns ...VFn) VFn
- func (w *Wrap) PrintfErr(f string, args ...any) MFn
- func (w *Wrap) PrintfNoErr(f string, args ...any) MFn
- func (w *Wrap) PtrFalse(v *bool) MFn
- func (w *Wrap) PtrFn(fn *MFn) MFn
- func (w *Wrap) PtrTrue(v *bool) MFn
- func (w *Wrap) QuotedString() MFn
- func (w *Wrap) QuotedString2(esc rune, maxLen1, maxLen2 int) MFn
- func (w *Wrap) RegexpFromStart(res string, cache bool, maxLen int) MFn
- func (w *Wrap) RegexpFromStartCached(res string, maxLen int) MFn
- func (w *Wrap) ReverseMode(reverse bool, fn MFn) MFn
- func (w *Wrap) Rune(ru rune) MFn
- func (w *Wrap) RuneFn(fn func(rune) bool) MFn
- func (w *Wrap) RuneFnLoop(fn func(rune) bool) MFn
- func (w *Wrap) RuneNoneOf(rs []rune) MFn
- func (w *Wrap) RuneOneOf(rs []rune) MFn
- func (w *Wrap) RuneRanges(rrs ...RuneRange) MFn
- func (w *Wrap) RuneSequence(seq []rune) MFn
- func (w *Wrap) RuneSequenceMid(rs []rune) MFn
- func (w *Wrap) RuneValue(fn MFn) VFn
- func (w *Wrap) Section(open, close string, esc rune, failOnNewline bool, maxLen int, eofClose bool, ...) MFn
- func (w *Wrap) Sequence(seq string) MFn
- func (w *Wrap) SequenceMid(seq string) MFn
- func (w *Wrap) Spaces(includeNL bool, escape rune) MFn
- func (w *Wrap) StaticFalse(v bool) MFn
- func (w *Wrap) StaticTrue(v bool) MFn
- func (w *Wrap) StringSection(openclose string, esc rune, failOnNewline bool, maxLen int, eofClose bool) MFn
- func (w *Wrap) StringValue(fn MFn) VFn
- func (w *Wrap) ToNLOrErr(includeNL bool, esc rune) MFn
Constants ¶
This section is empty.
Variables ¶
View Source
var EOF = io.EOF
View Source
var NoMatchErr = errors.New("no match")
View Source
var SOF = errors.New("SOF") // start-of-file (as opposed to EOF)
Functions ¶
func ContainsRune ¶
Types ¶
type Match ¶
type Match struct { W *Wrap // contains filtered or unexported fields }
func (*Match) ByteFnLoop ¶
one or more
func (*Match) DoubleQuotedString ¶
func (*Match) LimitedLoop ¶
max<=-1 means no upper limit
func (*Match) LoopSepCanHaveLast ¶
func (*Match) PrintfNoErr ¶
useful in And's
func (*Match) QuotedString2 ¶
allows escaped runes with esc!=0
func (*Match) RegexpFromStart ¶
func (*Match) RegexpFromStartCached ¶
func (*Match) RuneFnLoop ¶
one or more
func (*Match) RuneNoneOf ¶
previously "RuneAnyNot"
func (*Match) Section ¶
func (m *Match) Section(pos int, open, close string, esc rune, failOnNewline bool, maxLen int, eofClose bool, consumeFn MFn) (int, error)
match opened/closed sections.
func (*Match) StringSection ¶
type Scanner ¶
NOTE: to debug, use fatal error wrappers
func NewScanner ¶
func NewScanner() *Scanner
func (*Scanner) EnsureFatalError ¶
func (*Scanner) NewValueKeeper ¶
func (sc *Scanner) NewValueKeeper() *ValueKeeper
func (*Scanner) NewValueKeepers ¶
func (sc *Scanner) NewValueKeepers(n int) []*ValueKeeper
func (*Scanner) SrcFullFromOffset ¶
WARNING: use with caution, using pos in resulting []byte might fail when there is offset
func (*Scanner) SrcSection ¶
type ValueKeeper ¶
type ValueKeeper struct { V any // value // contains filtered or unexported fields }
func (*ValueKeeper) WKeepValue ¶
func (vk *ValueKeeper) WKeepValue(fn VFn) MFn
type Wrap ¶
type Wrap struct { M *Match // contains filtered or unexported fields }
func (*Wrap) ByteSequence ¶
func (*Wrap) BytesValue ¶
func (*Wrap) DoubleQuotedString ¶
func (*Wrap) Float64Value ¶
func (*Wrap) Int64Value ¶
func (*Wrap) IntFnValue ¶
func (*Wrap) LoopSepCanHaveLast ¶
func (*Wrap) QuotedString ¶
func (*Wrap) RegexpFromStart ¶
func (*Wrap) RegexpFromStartCached ¶
func (*Wrap) RuneNoneOf ¶
func (*Wrap) RuneRanges ¶
func (*Wrap) RuneSequence ¶
func (*Wrap) RuneSequenceMid ¶
func (*Wrap) SequenceMid ¶
func (*Wrap) StaticFalse ¶
func (*Wrap) StaticTrue ¶
func (*Wrap) StringSection ¶
func (*Wrap) StringValue ¶
Click to show internal directories.
Click to hide internal directories.