Documentation
¶
Overview ¶
Package ast defines the abstract syntax tree nodes for the CSV spreadsheet language.
Index ¶
- func ErrCircularDependency() error
- func ErrCircularInclude(chain []string) error
- func ErrIncludeFileNotFound(path string, position scanner.Position) error
- func ErrIncludeReadError(path string, err error) error
- func ErrInvalidRange(start, end string) error
- func ExpandRange(start, end string) ([]string, error)
- func ExtractDependencies(expr Node) []string
- func GetStatementDependencies(stmt Node) []string
- func GetStatementName(stmt Node) string
- func IsBoolean(expr Node) bool
- func IsCell(expr Node) bool
- func IsCellIdentifier(identifier string) bool
- func IsDate(expr Node) bool
- func IsFloat(expr Node) bool
- func IsFunction(expr Node) bool
- func IsIdentifier(expr Node) bool
- func IsInt(expr Node) bool
- func IsLiteral(expr Node) bool
- func IsNumeric(expr Node) bool
- func IsRange(expr Node) bool
- func IsString(expr Node) bool
- func ParseCell(cell string) (c, r int)
- func ToCell(column, row int) string
- func TypeName(expr Node) string
- type BooleanExpression
- type CallExpression
- type DateExpression
- type DependencyGraph
- type DependencyInfo
- type ExpressionStatement
- type FloatExpression
- type FmtStatement
- type IdentifierExpression
- type IncludeStatement
- type InfixExpression
- type IntExpression
- type LetStatement
- type Node
- type PrefixExpression
- type Program
- type RangeExpression
- type StringExpression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrCircularDependency ¶
func ErrCircularDependency() error
func ErrCircularInclude ¶
func ErrIncludeFileNotFound ¶
func ErrIncludeReadError ¶
func ErrInvalidRange ¶
func ExpandRange ¶
func ExtractDependencies ¶
func GetStatementDependencies ¶
GetStatementDependencies returns the dependencies of a statement
func GetStatementName ¶
GetStatementName returns the name/identifier of a statement if it defines one
func IsCellIdentifier ¶
IsCellIdentifier returns true if the identifier matches A1 cell name format
func IsFunction ¶
func IsIdentifier ¶
func ParseCell ¶
ParseCell parses a cell reference like "A1" into a zero based column and row components
Types ¶
type BooleanExpression ¶
func (BooleanExpression) String ¶
func (expr BooleanExpression) String() string
type CallExpression ¶
func (CallExpression) String ¶
func (expr CallExpression) String() string
type DateExpression ¶
func (DateExpression) String ¶
func (expr DateExpression) String() string
type DependencyGraph ¶
type DependencyGraph struct {
Nodes map[string]*DependencyInfo
AdjList map[string][]string
InDegree map[string]int
}
func NewDependencyGraph ¶
func NewDependencyGraph(program Program) *DependencyGraph
NewDependencyGraph creates a new dependency graph from a program
func (*DependencyGraph) Sort ¶
func (g *DependencyGraph) Sort() ([]Node, error)
Sort performs Kahn's algorithm for topological sorting
type DependencyInfo ¶
type ExpressionStatement ¶
func (ExpressionStatement) String ¶
func (stmt ExpressionStatement) String() string
type FloatExpression ¶
func ToFloat ¶
func ToFloat(expr *Node) (*FloatExpression, bool)
func (FloatExpression) String ¶
func (expr FloatExpression) String() string
type FmtStatement ¶
type FmtStatement struct {
Node
Identifier IdentifierExpression
Value Node
}
func (FmtStatement) String ¶
func (stmt FmtStatement) String() string
type IdentifierExpression ¶
func (IdentifierExpression) String ¶
func (expr IdentifierExpression) String() string
type IncludeStatement ¶
func (IncludeStatement) String ¶
func (stmt IncludeStatement) String() string
type InfixExpression ¶
func (InfixExpression) String ¶
func (expr InfixExpression) String() string
type IntExpression ¶
func ToInt ¶
func ToInt(expr *Node) (*IntExpression, bool)
func (IntExpression) String ¶
func (expr IntExpression) String() string
type LetStatement ¶
type LetStatement struct {
Node
Identifier IdentifierExpression
Value Node
}
func (LetStatement) String ¶
func (stmt LetStatement) String() string
type PrefixExpression ¶
func (PrefixExpression) String ¶
func (expr PrefixExpression) String() string
type Program ¶
type Program []Node
func SortProgram ¶
SortProgram sorts a program's statements in topological order
type RangeExpression ¶
func (RangeExpression) String ¶
func (expr RangeExpression) String() string
type StringExpression ¶
func (StringExpression) String ¶
func (expr StringExpression) String() string
Click to show internal directories.
Click to hide internal directories.