parser

package
v0.0.0-...-96ec32d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2020 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Name     string
	Currency string
	OpenAt   time.Time
}

Account empty currency means default currency

func (Account) String

func (a Account) String() string

type Balance

type Balance struct {
	Account  Account
	Number   float64
	Currency string
	At       time.Time
}

func (Balance) String

func (b Balance) String() string

type Body

type Body struct {
	Account  string
	Number   float64
	Currency string
}

func (Body) String

func (d Body) String() string

type Configuration

type Configuration struct {
	Log      *log.Logger                           // Log is used to print warnings during parsing.
	ReadFile func(filename string) ([]byte, error) // ReadFile is used to read e.g. #+INCLUDE files.
}

func New

func New() *Configuration

New returns a new Configuration with (hopefully) sane defaults.

func (*Configuration) Parse

func (c *Configuration) Parse(input io.Reader, path string) (*Document, error)

Parse parses the input into an AST (and some other helpful fields like Outline). To allow method chaining, errors are stored in document.Error rather than being returned.

func (*Configuration) Silent

func (c *Configuration) Silent() *Configuration

Silent disables all logging of warnings during parsing.

type Document

type Document struct {
	*Configuration
	Path string // Path of the file containing the parse input - used to resolve relative paths during parsing (e.g. INCLUDE).

	Nodes      []Node
	NamedNodes map[string]Node
	Options    Options
	Error      error
	// contains filtered or unexported fields
}

Document contains the parsing results and a pointer to the Configuration.

type Heading

type Heading struct {
	Payee  string
	Name   string
	Status string
	At     time.Time
	Tags   []string
	Body   []Body
}

func (Heading) String

func (t Heading) String() string

type Node

type Node interface {
	String() string // String returns the pretty printed Org mode string for the node (see OrgWriter).
	// contains filtered or unexported methods
}

Node represents a parsed node of the document.

type Note

type Note struct {
	AccountName string
	Note        string
	At          time.Time
}

func (Note) String

func (n Note) String() string

type Option

type Option struct {
	Kind  string
	Value string
}

func (Option) String

func (o Option) String() string

type Options

type Options struct {
	Title             string
	OperatingCurrency []string
}

type Pad

type Pad struct {
	AccountIn  Account
	AccountOut Account
	At         time.Time
}

func (Pad) String

func (p Pad) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL