Versions in this module Expand all Collapse all v0 v0.1.1 Dec 20, 2022 v0.1.0 Nov 22, 2022 Changes in this version + const ErrCodeExpected + const ErrCodeIncomplete + const ErrCodeInvalid + const ErrCodeNone + const ErrCodeOverflow + const ErrCodeUnexpected + const ErrCodeUnmatched + const ErrCodeUnpaired + const ErrCodeUnterminated + const Unmatched + func ExtractHex32n(src Source, max_chars int) (v uint32, overflow bool, n_chars int) + func ExtractHex64n(src Source, max_chars int) (v uint64, overflow bool, n_chars int) + func ExtractOct32n(src Source, max_chars int) (v uint32, overflow bool, n_chars int) + func Static(buf []byte, lc *LineCol) *static_impl + func Tokenize(buf []byte, bindings []*Binding[T], on_token func(k T, c *Context, lc LineCol)) error + type Binding struct + func Bind(key K, descr string, sequence ...any) *Binding[K] + type Context struct + Values []any + func (c *Context) Reset() + type ErrAtLineCol struct + Err error + Loc LineCol + func (e *ErrAtLineCol) Error() string + type ErrCode int + func EOF(src Source, ctx *Context) ErrCode + func EOL(src Source, ctx *Context) ErrCode + func HexCodepoint_XXXX(src Source, ctx *Context) ErrCode + func HexCodepoint_XXXXXXXX(src Source, ctx *Context) ErrCode + func HexCodeunit_XX(src Source, ctx *Context) ErrCode + func HexCodeunit_Xn(src Source, ctx *Context) ErrCode + func OctCodeunit_X3n(src Source, ctx *Context) ErrCode + func (ec ErrCode) String() string + type ErrContent struct + Code ErrCode + What string + func Expected(v string) *ErrContent + func Invalid(v string) *ErrContent + func Unexpected(v string) *ErrContent + func Unpaired(v string) *ErrContent + func Unterminated(v string) *ErrContent + func (e *ErrContent) Error() string + type Key = any + type LineCol struct + ColumnIndex int + LineIndex int + func (lc *LineCol) String() string + type Location struct + LineNumber int + LineOffset int + Offset int + func (l *Location) ColumnNumber() int + type Source interface + Done func() bool + Fetch func(f func(rune) bool) rune + Hop func(c rune) bool + Leap func(seq string) bool + Peek func() rune + Skip func(seq string, term func(rune) bool) rune + type Term interface + type TermFunc = func(Source, *Context) ErrCode + func AnyOf(args ...string) TermFunc + func Between(prefix, terminator any, content ...any) TermFunc + func Codepoint(r rune) TermFunc + func CodepointFunc(m func(rune) bool) TermFunc + func Escaped(prefix rune, escapers map[rune]any) TermFunc + func FirstOf(args ...any) TermFunc + func HexCodeunit_XXXX(first_prefix, second_prefix string) TermFunc + func HexN(prefix string) TermFunc + func Literal(s string) TermFunc + func OneOrMore(a T) TermFunc + func Optional(a T) TermFunc + func Sequence(args ...any) TermFunc + func Skip(content ...any) TermFunc + func Uint(prefix string, base uint, maxval T) TermFunc + func ZeroOrMore(a T) TermFunc