roll-parser - v3.0.0-beta.0
    Preparing search index...

    Function parse

    • Parse a dice notation string into an AST.

      Parameters

      • notation: string

        The dice notation to parse

      Returns ASTNode

      The root AST node

      If the input contains invalid characters

      If the input has invalid syntax

      const ast = parse('2d6+3');
      // { type: 'BinaryOp', operator: '+',
      // left: { type: 'Dice', count: 2, sides: 6 },
      // right: { type: 'Literal', value: 3 } }