booklit: github.com/vito/booklit/ast Index | Files

package ast

import "github.com/vito/booklit/ast"

Index

Package Files

booklit.peg.go node.go

func Parse Uses

func Parse(filename string, b []byte, opts ...Option) (interface{}, error)

Parse parses the data from b using filename as information in the error messages.

func ParseFile Uses

func ParseFile(filename string, opts ...Option) (i interface{}, err error)

ParseFile parses the file identified by filename.

func ParseReader Uses

func ParseReader(filename string, r io.Reader, opts ...Option) (interface{}, error)

ParseReader parses the data from r using filename as information in the error messages.

type Invoke Uses

type Invoke struct {
    Function  string
    Arguments []Node
}

func (Invoke) Method Uses

func (node Invoke) Method() string

func (Invoke) Visit Uses

func (node Invoke) Visit(visitor Visitor) error

type Node Uses

type Node interface {
    Visit(Visitor) error
}

type Option Uses

type Option func(*parser) Option

Option is a function that can set an option on the parser. It returns the previous setting as an Option.

func Debug Uses

func Debug(b bool) Option

Debug creates an Option to set the debug flag to b. When set to true, debugging information is printed to stdout while parsing.

The default is false.

func GlobalStore Uses

func GlobalStore(key string, value interface{}) Option

GlobalStore creates an Option to set a key to a certain value in the globalStore.

func Memoize Uses

func Memoize(b bool) Option

Memoize creates an Option to set the memoize flag to b. When set to true, the parser will cache all results so each expression is evaluated only once. This guarantees linear parsing time even for pathological cases, at the expense of more memory and slower times for typical cases.

The default is false.

func Recover Uses

func Recover(b bool) Option

Recover creates an Option to set the recover flag to b. When set to true, this causes the parser to recover from panics and convert it to an error. Setting it to false can be useful while debugging to access the full stack trace.

The default is true.

type Paragraph Uses

type Paragraph []Sequence

func (Paragraph) Visit Uses

func (node Paragraph) Visit(visitor Visitor) error

type Preformatted Uses

type Preformatted []Sequence

func (Preformatted) Visit Uses

func (node Preformatted) Visit(visitor Visitor) error

type Sequence Uses

type Sequence []Node

func (Sequence) Visit Uses

func (node Sequence) Visit(visitor Visitor) error

type String Uses

type String string

func (String) Visit Uses

func (node String) Visit(visitor Visitor) error

type Visitor Uses

type Visitor interface {
    VisitString(String) error
    VisitInvoke(Invoke) error
    VisitSequence(Sequence) error
    VisitParagraph(Paragraph) error
    VisitPreformatted(Preformatted) error
}

Package ast imports 10 packages (graph) and is imported by 4 packages. Updated 2017-08-22. Refresh now. Tools for package owners.