Skip to content

Commit 936fde7

Browse files
committed
test: add test case for exponentiation-expr
1 parent d0870cb commit 936fde7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lexer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ func (l *lexer) next() (*Token, error) {
8787
case '&':
8888
l.nextch()
8989
return newToken(l.pos, l.pos, Concat, "&"), nil
90+
case '^':
91+
l.nextch()
92+
return newToken(l.pos, l.pos, Exponentiation, "^"), nil
9093
case '%':
9194
l.nextch()
9295
return newToken(l.pos, l.pos, Percent, "%"), nil

parser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ func TestParse(t *testing.T) {
77
src string
88
expected string
99
}{
10+
{"=A1^B1", "BinaryExpr(Left: CellExpr(A1), Operator: ^, Right: CellExpr(B1))"},
1011
{"=A1&B1", "BinaryExpr(Left: CellExpr(A1), Operator: &, Right: CellExpr(B1))"},
1112
{"=1<>2", "BinaryExpr(Left: LiteralExpr(Value: 1), Operator: <>, Right: LiteralExpr(Value: 2))"},
1213
{"=$A:$A", "RangeExpr(CellExpr($A):CellExpr($A))"},

0 commit comments

Comments
 (0)