Documentation
¶
Index ¶
- Constants
- Variables
- func EndRune(er rune, ir io.Reader) (ok bool, n int, err error)
- func FromPreserves(v preserves.Value) preserves.Value
- func NewBareSymbol(s string) preserves.Value
- func SkipCommas(ir io.Reader) (n int64, err error)
- func SkipWhitespace(ir io.Reader) (n int64, err error)
- func ToPreserves(v preserves.Value) preserves.Value
- type Annotation
- type Bare
- type BareDouble
- func (b *BareDouble) Equal(y preserves.Value) bool
- func (b *BareDouble) MarshalText() (data []byte, err error)
- func (b *BareDouble) New() preserves.Value
- func (b *BareDouble) ReadFrom(r io.Reader) (n int64, err error)
- func (b *BareDouble) String() string
- func (b *BareDouble) WriteTo(w io.Writer) (n int64, err error)
- type BareSymbol
- func (bs *BareSymbol) Equal(y preserves.Value) bool
- func (bs *BareSymbol) MarshalText() (data []byte, err error)
- func (bs *BareSymbol) New() preserves.Value
- func (bs *BareSymbol) ReadFrom(ir io.Reader) (n int64, err error)
- func (bs *BareSymbol) String() string
- func (bs *BareSymbol) WriteTo(w io.Writer) (n int64, err error)
- type Base64ByteString
- func (bs *Base64ByteString) Equal(v preserves.Value) bool
- func (bs *Base64ByteString) MarshalText() (data []byte, err error)
- func (bs *Base64ByteString) New() preserves.Value
- func (bs *Base64ByteString) ReadFrom(r io.Reader) (n int64, err error)
- func (bs *Base64ByteString) String() string
- func (bs *Base64ByteString) WriteTo(w io.Writer) (n int64, err error)
- type BinByteString
- func (bbs *BinByteString) Equal(v preserves.Value) bool
- func (bbs *BinByteString) MarshalText() (data []byte, err error)
- func (bbs *BinByteString) New() preserves.Value
- func (bbs *BinByteString) ReadFrom(r io.Reader) (n int64, err error)
- func (bbs *BinByteString) String() string
- func (bbs *BinByteString) WriteTo(w io.Writer) (n int64, err error)
- type Boolean
- func (b *Boolean) Equal(y preserves.Value) bool
- func (b *Boolean) MarshalText() (data []byte, err error)
- func (b *Boolean) New() preserves.Value
- func (b *Boolean) ReadFrom(ir io.Reader) (n int64, err error)
- func (b *Boolean) String() string
- func (b *Boolean) WriteTo(w io.Writer) (n int64, err error)
- type Comment
- type Dictionary
- type Embedded
- type HexByteString
- func (hbs *HexByteString) Equal(v preserves.Value) bool
- func (hbs *HexByteString) MarshalText() (data []byte, err error)
- func (hbs *HexByteString) New() preserves.Value
- func (hbs *HexByteString) ReadFrom(r io.Reader) (n int64, err error)
- func (hbs *HexByteString) String() string
- func (hbs *HexByteString) WriteTo(w io.Writer) (n int64, err error)
- type HexDouble
- func (h *HexDouble) Equal(y preserves.Value) bool
- func (h *HexDouble) MarshalText() (data []byte, err error)
- func (h *HexDouble) New() preserves.Value
- func (h *HexDouble) ReadFrom(r io.Reader) (n int64, err error)
- func (h *HexDouble) String() string
- func (h *HexDouble) WriteTo(w io.Writer) (n int64, err error)
- type Maze
- type MazePath
- type QuotedSymbol
- func (bs *QuotedSymbol) Equal(y preserves.Value) bool
- func (qs *QuotedSymbol) MarshalText() (data []byte, err error)
- func (qs *QuotedSymbol) New() preserves.Value
- func (qs *QuotedSymbol) ReadFrom(ir io.Reader) (n int64, err error)
- func (qs *QuotedSymbol) String() string
- func (qs *QuotedSymbol) WriteTo(w io.Writer) (n int64, err error)
- type Record
- type Sequence
- type Set
- type Shebang
- type SignedInteger
- func (s *SignedInteger) Equal(y preserves.Value) bool
- func (s *SignedInteger) MarshalText() (data []byte, err error)
- func (s *SignedInteger) New() preserves.Value
- func (s *SignedInteger) ReadFrom(r io.Reader) (n int64, err error)
- func (s *SignedInteger) String() string
- func (s *SignedInteger) WriteTo(w io.Writer) (n int64, err error)
- type String
- type TextParser
Constants ¶
View Source
const ( StringRunes = "\"\"" RecordRunes = "<>" SequenceRunes = "[]" SetRunes = "#{}" DictionaryRunes = "{}" AnnotationRunes = "@" EmbeddedRunes = "#:" QuotedSymbolRunes = "||" BooleanTrueRunes = "#t" BooleanFalseRunes = "#f" BinByteStringRunes = "#\"\"" HexByteStringRunes = "#x\"\"" Base64ByteStringRunes = "#[]" HexDoubleRunes = "#xd\"\"" CommentRunes = "#" WhiteSpaceRunes = " \t\r\n" ShebangRunes = "#!" )
Variables ¶
View Source
var ( WhiteSpaceRegexp = regexp.MustCompile("[ \t\r\n]") CommasRegexp = regexp.MustCompile("([ \t\r\n]*,)*[ \t\r\n]*") SymbolOrNumberRegexp = regexp.MustCompile(`^[-a-zA-Z0-9~!$%^&*?_=+/.]+$`) NumberRegexp = regexp.MustCompile(`^([-+]?\d+)((\.\d+([eE][-+]?\d+)?)|([eE][-+]?\d+))?$`) DoubleRegexp = regexp.MustCompile(`^([-+]?\d+)((\.\d+([eE][-+]?\d+)?)|([eE][-+]?\d+))$`) SignedIntegerRegexp = regexp.MustCompile(`^([-+]?\d+)$`) Base64Regexp = regexp.MustCompile(`[a-zA-Z0-9+/_=']`) )
MazePath{ Maze: NewMaze(map[rune]MazePath{ rune(QuotedSymbolRunes[0]): {ReadFrom: new(QuotedSymbol)}, rune(StringRunes[0]): {ReadFrom: new(String)}, rune(RecordRunes[0]): {ReadFrom: new(Record)}, rune(DictionaryRunes[0]): {ReadFrom: new(Dictionary)}, rune(SequenceRunes[0]): {ReadFrom: new(Sequence)}, rune(AnnotationRunes[0]): {ReadFrom: new(Annotation)}, rune(CommentRunes[0]): { ReadFrom: new(Comment), Maze: NewMaze(map[rune]MazePath{ rune(ShebangRunes[1]): {ReadFrom: new(Shebang)}, rune(BinByteStringRunes[1]): {ReadFrom: new(BinByteString)}, rune(Base64ByteStringRunes[1]): {ReadFrom: new(Base64ByteString)}, rune(BooleanTrueRunes[1]): {ReadFrom: new(Boolean)}, rune(BooleanFalseRunes[1]): {ReadFrom: new(Boolean)}, rune(EmbeddedRunes[1]): {ReadFrom: new(Embedded)}, rune(SetRunes[1]): {ReadFrom: new(Set)}, rune(HexDoubleRunes[1]): { Maze: NewMaze(map[rune]MazePath{ rune(HexByteStringRunes[2]): {ReadFrom: new(HexByteString)}, rune(HexDoubleRunes[2]): { Maze: NewMaze(map[rune]MazePath{ rune(HexDoubleRunes[3]): {ReadFrom: new(HexDouble)}, }), }, }), }, }), }, }), }
View Source
var RuneMaze = (&MazePath{}). AddPath("", new(Bare)). AddPath(string(QuotedSymbolRunes[0]), new(QuotedSymbol)). AddPath(string(StringRunes[0]), new(String)). AddPath(BinByteStringRunes[0:2], new(BinByteString)). AddPath(Base64ByteStringRunes[0:2], new(Base64ByteString)). AddPath(BooleanTrueRunes, new(Boolean)). AddPath(BooleanFalseRunes, new(Boolean)). AddPath(HexDoubleRunes[0:4], new(HexDouble)). AddPath(HexByteStringRunes[0:3], new(HexByteString)). AddPath(SetRunes[0:2], new(Set)). AddPath(string(RecordRunes[0]), new(Record)). AddPath(string(DictionaryRunes[0]), new(Dictionary)). AddPath(string(SequenceRunes[0]), new(Sequence)). AddPath(AnnotationRunes, new(Annotation)). AddPath(CommentRunes, new(Comment)). AddPath(ShebangRunes, new(Shebang)). AddPath(EmbeddedRunes, new(Embedded))
Functions ¶
func NewBareSymbol ¶
Types ¶
type Annotation ¶
type Annotation struct {
preserves.Annotation
}
func (*Annotation) MarshalText ¶
func (a *Annotation) MarshalText() (data []byte, err error)
func (*Annotation) New ¶
func (a *Annotation) New() preserves.Value
func (*Annotation) String ¶
func (a *Annotation) String() string
type BareDouble ¶
func (*BareDouble) MarshalText ¶
func (b *BareDouble) MarshalText() (data []byte, err error)
func (*BareDouble) New ¶
func (b *BareDouble) New() preserves.Value
func (*BareDouble) String ¶
func (b *BareDouble) String() string
type BareSymbol ¶
func (*BareSymbol) MarshalText ¶
func (bs *BareSymbol) MarshalText() (data []byte, err error)
func (*BareSymbol) New ¶
func (bs *BareSymbol) New() preserves.Value
func (*BareSymbol) String ¶
func (bs *BareSymbol) String() string
type Base64ByteString ¶
type Base64ByteString struct {
preserves.ByteString
}
func (*Base64ByteString) MarshalText ¶
func (bs *Base64ByteString) MarshalText() (data []byte, err error)
func (*Base64ByteString) New ¶
func (bs *Base64ByteString) New() preserves.Value
func (*Base64ByteString) ReadFrom ¶
func (bs *Base64ByteString) ReadFrom(r io.Reader) (n int64, err error)
func (*Base64ByteString) String ¶
func (bs *Base64ByteString) String() string
type BinByteString ¶
type BinByteString struct {
preserves.ByteString
}
func (*BinByteString) MarshalText ¶
func (bbs *BinByteString) MarshalText() (data []byte, err error)
func (*BinByteString) New ¶
func (bbs *BinByteString) New() preserves.Value
func (*BinByteString) ReadFrom ¶
func (bbs *BinByteString) ReadFrom(r io.Reader) (n int64, err error)
func (*BinByteString) String ¶
func (bbs *BinByteString) String() string
type Boolean ¶
func (*Boolean) MarshalText ¶
type Dictionary ¶
type Dictionary struct {
preserves.Dictionary
}
func (*Dictionary) MarshalText ¶
func (d *Dictionary) MarshalText() (data []byte, err error)
encoding.TextMarshaler interface
func (*Dictionary) New ¶
func (d *Dictionary) New() preserves.Value
type Embedded ¶
func (*Embedded) MarshalText ¶
type HexByteString ¶
type HexByteString struct {
preserves.ByteString
}
func (*HexByteString) MarshalText ¶
func (hbs *HexByteString) MarshalText() (data []byte, err error)
func (*HexByteString) New ¶
func (hbs *HexByteString) New() preserves.Value
func (*HexByteString) ReadFrom ¶
func (hbs *HexByteString) ReadFrom(r io.Reader) (n int64, err error)
func (*HexByteString) String ¶
func (hbs *HexByteString) String() string
type HexDouble ¶
func (*HexDouble) MarshalText ¶
type MazePath ¶
type MazePath struct { ReadFrom io.ReaderFrom Maze *Maze }
type QuotedSymbol ¶
func (*QuotedSymbol) MarshalText ¶
func (qs *QuotedSymbol) MarshalText() (data []byte, err error)
func (*QuotedSymbol) New ¶
func (qs *QuotedSymbol) New() preserves.Value
func (*QuotedSymbol) String ¶
func (qs *QuotedSymbol) String() string
type Record ¶
func (Record) MarshalText ¶
encoding.TextMarshaler interface
type Sequence ¶
func (*Sequence) MarshalText ¶
type Set ¶
func (*Set) MarshalText ¶
type SignedInteger ¶
type SignedInteger struct {
preserves.SignedInteger
}
func NewSignedInteger ¶
func NewSignedInteger(i int64) *SignedInteger
func (*SignedInteger) MarshalText ¶
func (s *SignedInteger) MarshalText() (data []byte, err error)
func (*SignedInteger) New ¶
func (s *SignedInteger) New() preserves.Value
func (*SignedInteger) String ¶
func (s *SignedInteger) String() string
type String ¶
func (*String) MarshalText ¶
Click to show internal directories.
Click to hide internal directories.