Skip to content

Commit

Permalink
Fix damage-roll parsing of math functions when first argument is 0 (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam authored Feb 27, 2023
1 parent 03d24b6 commit 033a3ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion roll-grammar.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Term = head:TermOperand tail:(_ ("*" / "/") _ TermOperand)* {
TermOperand = DiceTerm / MathTerm / Grouping / FlavoredNumber / Number;

MathTerm = fn:Identifier "(" _ head:Expression? _ tail:(_ "," _ @Expression)* _ ")" {
const terms = head
const terms = head !== null
? [head, ...tail].map((t) => typeof t === "number" ? t.toString() : t.formula)
: [];
return {
Expand Down

0 comments on commit 033a3ab

Please sign in to comment.