Documentation
¶
Overview ¶
Package ast defines Abstract Syntax Tree (AST) nodes for a sheet cell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCalculate = errors.New("calculate error")
ErrCalculate means the AST has an error can can't be calculated.
var ErrCellRange = errors.New("invalid cell range")
ErrCellRange means the cell range is invalid.
var ErrParse = errors.New("parse error")
ErrParse means the was en error parsing data.
Functions ¶
Types ¶
type BinOpNode ¶
type BinOpNode struct {
Op string // binary operator
Left Node // left operand
Right Node // right operand
}
BinOpNode is a binary operation of the form "left op right".
type CallNode ¶
type CallNode struct {
Name string // function name
Args []Node // function arguments, can be empty
}
CallNode is a function call.
type CellScanner ¶
type CellScanner struct {
// contains filtered or unexported fields
}
CellScanner scans through cells in the inclusive range [from, to].
It supports inverted range, e.g. "A3:A1". In either case, the scanner generates a sequence of cell IDs, sorted by row and column.
func NewCellScanner ¶
func NewCellScanner(from, to string) (*CellScanner, error)
NewCellScanner creates a cell scanner. It returns an error if the range is invalid, e.g. the cell reference uses double-letter cells (unsupported).
func (*CellScanner) Len ¶
func (sc *CellScanner) Len() int
Len returns the number of cells in the cell range.
type Engine ¶
type Engine struct{}
Engine uses AST for intermediate representation.
type IfNode ¶
type IfNode struct {
Cond *RelOpNode // a comparison binary expression
IfPass Node // an expression to be executed when if-condition is true
IfFail Node // an expression to be executed when if-condition is false
}
IfNode is if-clause, e.g. IF(Cond, IfPassExpr, IfFailExpr).
type NumberNode ¶
type NumberNode struct {
Number string // number text value
}
NumberNode is a number value.