@dice-roller/rpg-dice-roller / Parser
Class: Parser
Defined in: src/parser/Parser.ts:18
Parses dice notation into the AST.
See
https://dice-roller.github.io/documentation/guide/notation/
Constructors
Constructor
new Parser(
options?):Parser
Defined in: src/parser/Parser.ts:23
Creates a parser with the supplied literal quantity limit.
Parameters
options?
ParserOptions = {}
Returns
Parser
Properties
maxQty
readonlymaxQty:number
Defined in: src/parser/Parser.ts:20
Maximum literal pool quantity accepted by the grammar.
Methods
parse()
parse(
notation):ExpressionNode
Defined in: src/parser/Parser.ts:36
Parses a notation string into an expression tree without rolling any dice.
Literal pool quantities are checked against maxQty; evaluated quantities are checked separately by the evaluator's roll limits.
Parameters
notation
string
Returns
Throws
the notation is empty or not a string
Throws
the notation is invalid, with its source location and syntax error cause