oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1package calc
2
3// Node is any expression node.
4type Node interface{ node() }
5
6type Num struct{ V float64 }
7type Str struct{ V string }
8type Bool struct{ V bool }
9
10// Ref is a single-cell reference as written. Positions are what the source
11// says; binding to stable ids happens in the reference pass, because
12// relative references are positional offsets and must stay that way until
13// a paste anchor is known.
14type Ref struct {
15 ColPos, RowPos int
16 AbsCol, AbsRow bool
17}
18
19type Range struct{ From, To *Ref }
20
21type Binary struct {
22 Op string
23 Left, Right Node
24}
25
26type Unary struct {
27 Op string
28 X Node
29}
30
31type Call struct {
32 Name string
33 Args []Node
34}
35
36func (*Num) node() {}
37func (*Str) node() {}
38func (*Bool) node() {}
39func (*Ref) node() {}
40func (*Range) node() {}
41func (*Binary) node() {}
42func (*Unary) node() {}
43func (*Call) node() {}
44