Documentation ¶
Overview ¶
Package ast declares the types used to represent syntax trees for kpr files.
Index ¶
- type Amount
- type AmountLine
- type BadEntry
- type BadLine
- type BalanceHeader
- type BasicValue
- type Comment
- type CommentGroup
- type DeclareAccount
- type DisableAccount
- type End
- type Entry
- type File
- type LineNode
- type MetadataLine
- type MultiBalance
- type Node
- type SingleBalance
- type SplitLine
- type Transaction
- type UnitDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
type Amount struct { Decimal *BasicValue // DECIMAL Unit *BasicValue // USYMBOL }
An Amount node represents an amount.
type AmountLine ¶
type AmountLine struct {
*Amount
}
An AmountLine node represents an amount line node.
type BadEntry ¶
A BadEntry node is a placeholder for an entry containing syntax errors for which a correct entry node cannot be created.
type BadLine ¶
A BadLine node is a placeholder for a line containing syntax errors for which a correct line node cannot be created.
type BalanceHeader ¶
type BalanceHeader struct { TokPos token.Pos Token token.Token Date *BasicValue // DATE Account *BasicValue // ACCTNAME }
A BalanceHeader contains the fields shared by balance entry nodes.
func (*BalanceHeader) End ¶
func (b *BalanceHeader) End() token.Pos
func (*BalanceHeader) Pos ¶
func (b *BalanceHeader) Pos() token.Pos
type BasicValue ¶
type BasicValue struct { ValuePos token.Pos Kind token.Token // STRING, USYMBOL, ACCTNAME, DECIMAL, DATE Value string }
A BasicValue node represents a basic single token value.
func (*BasicValue) End ¶
func (v *BasicValue) End() token.Pos
func (*BasicValue) Pos ¶
func (v *BasicValue) Pos() token.Pos
type Comment ¶ added in v0.17.0
type Comment struct { // Position of starting # TokPos token.Pos // Comment text, including # and excluding trailing newline. Text string }
A Comment node represents a comment.
type CommentGroup ¶ added in v0.17.0
type CommentGroup struct { // Must be non-empty List []*Comment }
A CommentGroup represents consecutive comments.
func (*CommentGroup) End ¶ added in v0.17.0
func (c *CommentGroup) End() token.Pos
func (*CommentGroup) Pos ¶ added in v0.17.0
func (c *CommentGroup) Pos() token.Pos
type DeclareAccount ¶ added in v0.15.0
type DeclareAccount struct { TokPos token.Pos Account *BasicValue // ACCTNAME Metadata []LineNode // MetadataLine, BadLine EndTok *End }
A DeclareAccount node represents a declare account entry node.
func (*DeclareAccount) End ¶ added in v0.15.0
func (c *DeclareAccount) End() token.Pos
func (*DeclareAccount) Pos ¶ added in v0.15.0
func (c *DeclareAccount) Pos() token.Pos
type DisableAccount ¶ added in v0.13.0
type DisableAccount struct { TokPos token.Pos Date *BasicValue // DATE Account *BasicValue // ACCTNAME }
A DisableAccount node represents a disable account entry node.
func (*DisableAccount) End ¶ added in v0.13.0
func (c *DisableAccount) End() token.Pos
func (*DisableAccount) Pos ¶ added in v0.13.0
func (c *DisableAccount) Pos() token.Pos
type End ¶ added in v0.5.0
An End node represents an end keyword ending a multiple line entry.
type Entry ¶
type Entry interface { Node // contains filtered or unexported methods }
All entry nodes implement Entry.
type File ¶ added in v0.17.0
type File struct { Entries []Entry Comments []*CommentGroup }
A File represents a source file.
type LineNode ¶
type LineNode interface { Node // contains filtered or unexported methods }
All line nodes implement LineNode.
type MetadataLine ¶ added in v0.15.0
type MetadataLine struct { TokPos token.Pos Key *BasicValue // STRING Val *BasicValue // STRING }
A MetadataLine node represents a metadata line.
func (*MetadataLine) End ¶ added in v0.15.0
func (v *MetadataLine) End() token.Pos
func (*MetadataLine) Pos ¶ added in v0.15.0
func (v *MetadataLine) Pos() token.Pos
type MultiBalance ¶
type MultiBalance struct { BalanceHeader Amounts []LineNode // AmountLine, BadLine EndTok *End }
A MultiBalance node represents a balance entry node spanning multiple lines.
func (*MultiBalance) End ¶
func (b *MultiBalance) End() token.Pos
type Node ¶
type Node interface { Pos() token.Pos // position of first character belonging to the node End() token.Pos // position of first character immediately after the node }
All node types implement the Node interface.
type SingleBalance ¶
type SingleBalance struct { BalanceHeader Amount *Amount }
A SingleBalance node represents a balance entry node on a single line.
func (*SingleBalance) End ¶
func (b *SingleBalance) End() token.Pos
type SplitLine ¶ added in v0.10.0
type SplitLine struct { Account *BasicValue // STRING Amount *Amount }
A SplitLine node represents a split line node in a transaction.
type Transaction ¶
type Transaction struct { TokPos token.Pos Date *BasicValue // DATE Description *BasicValue // STRING Splits []LineNode // SplitLine, BadLine EndTok *End }
A Transaction node represents a transaction entry node.
func (*Transaction) End ¶
func (t *Transaction) End() token.Pos
func (*Transaction) Pos ¶
func (t *Transaction) Pos() token.Pos