The full formula.
Protected
_collapseProtected
Collapse multiple additive operators into a single one.
A sequence of additive operators.
Protected
_onProtected
Handle a dice term.
The number of dice.
The number of die faces or a string denomination like "c" or "f".
The matched modifiers string.
Associated flavor text.
The original matched text.
Protected
_onProtected
Handle a base roll expression.
The first operand.
Zero or more subsequent (operators, operand) tuples.
Optional
leading: stringA leading operator.
The original matched text.
The peggy error callback to invoke on a parse error.
Protected
_onProtected
Handle a math term.
The Math function.
The first term.
Zero or more additional terms.
Associated flavor text.
The original matched text.
Protected
_onProtected
Handle a numeric term.
The number.
Associated flavor text.
Protected
_onProtected
Handle a parenthetical.
The inner term.
Associated flavor text.
The original matched text.
Protected
_onProtected
Handle a pool term.
The first term.
Zero or more additional terms.
The matched modifiers string.
Associated flavor text.
The original matched text.
Protected
_onProtected
Handle some string that failed to be classified.
The term.
Optional
flavor: null | stringAssociated flavor text.
Protected
_wrapProtected
Wrap a term with a leading minus.
The term to wrap.
Static
flattenFlatten a tree structure (either a parse tree or AST) into an array with operators in infix notation.
The root of the tree.
Static
formatFormat a parser argument.
The argument.
Static
formatFormat arguments for debugging.
The method name.
The arguments.
Static
formatFormat a list argument.
The list to format.
Static
isDetermine if a given node is an operator term.
Static
toASTUse the Shunting Yard algorithm to convert a parse tree or list of terms into an AST with correct operator precedence. See https://en.wikipedia.org/wiki/Shunting_yard_algorithm for a description of the algorithm in detail.
The root of the parse tree or a list of terms.
The root of the AST.
A class for transforming events from the Peggy grammar lexer into various formats.