Skip to content

Commit

Permalink
fix(): parentheses without values
Browse files Browse the repository at this point in the history
  • Loading branch information
luizzappa committed Apr 2, 2023
1 parent 3b1e4a9 commit e52621c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/syntax.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ formula {
| Constant
| FunctionCall
| ConstantArray
| OpenParen formula CloseParen
| OpenParen formula? CloseParen
}

Constant { Number | TextToken | BoolToken | ErrorToken }
Expand Down
40 changes: 40 additions & 0 deletions test/FunctionCall.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,46 @@ Program(
)
)

# Single FunctionCall arguments with parentheses

SUM((),(2),(A1),(A1:A4),(2+2))

===>

Program(
FunctionCall(
Function,
Arguments(
Argument(OpenParen,CloseParen),
Separator,
Argument(OpenParen,Constant(Number),CloseParen),
Separator,
Argument(OpenParen,Reference(ReferenceItem(CellToken)),CloseParen),
Separator,
Argument(
OpenParen,
Reference(
ReferenceFunctionCall(
Reference(ReferenceItem(CellToken)),
Reference(ReferenceItem(CellToken))
)
),
CloseParen
),
Separator,
Argument(
OpenParen,
FunctionCall(
Constant(Number),
Constant(Number)
),
CloseParen
)
),
CloseParen
)
)

# Nested FunctionCall

SUM(1,2 + SUM(3, 4), 1)
Expand Down

0 comments on commit e52621c

Please # to comment.