Documentation
¶
Overview ¶
Package charmed provides common useful states for document parsing
Index ¶
- func DecodeDouble(out *strings.Builder) charm.State
- func DecodePipe(out *strings.Builder) charm.State
- func DecodePos(y, x *int) charm.State
- func DecodeQuote(q rune, out *strings.Builder) (ret charm.State, okay bool)
- func DecodeRaw(out *strings.Builder) charm.State
- func DecodeSingle(out *strings.Builder) charm.State
- func EscapeHere(q rune) (okay bool)
- func FilterInvalidRunes() charm.State
- func KeepEnding(q rune) (okay bool)
- func StringMatch(str string) charm.State
- func UnhandledError(watch charm.State) charm.State
- type NumParser
- type QuoteOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeDouble ¶ added in v0.9.0
read until a (new) double-quote (") marker is found.
func DecodePipe ¶ added in v0.9.0
read until a heredoc ending marker is found.
func DecodeQuote ¶ added in v0.9.0
assuming q is a rune that starts a string scalar or heredoc return an appropriate decoder for decoding the rest of the string. otherwise, returns false.
func DecodeSingle ¶ added in v0.9.0
read until a (new) single-quote (') marker is found.
func EscapeHere ¶ added in v0.9.0
func FilterInvalidRunes ¶
returns an state which errors on all control codes other than newlines
func KeepEnding ¶ added in v0.9.0
func StringMatch ¶
returns error if failed to match, or unhandled on the rune after the matched string. the empty string will return unmatched immediately.
Types ¶
type NumParser ¶
type NumParser struct {
// contains filtered or unexported fields
}
return a state which reads until the end of string, returns error if finished incorrectly
func (*NumParser) Decode ¶
return a state capable of digit parsing. note: this doesn't support leading with just a "."
type QuoteOptions ¶ added in v0.9.0
type QuoteOptions int
these control how inline strings are processed
const ( AllowHere QuoteOptions = 1 << iota FoldLines // otherwise, keep all line feeds and leading spaces. AllowEscapes // otherwise, backslashes are backslashes. )
func (QuoteOptions) Is ¶ added in v0.9.0
func (opt QuoteOptions) Is(flag QuoteOptions) bool