diff --git a/dice/lib.py b/dice/lib.py index efd8fa0..ba5c434 100644 --- a/dice/lib.py +++ b/dice/lib.py @@ -35,6 +35,10 @@ class DiceRoller(object): output = "" + def __init__(self): + """Build the parsing tables.""" + self.build() + def roll_dice(self, keep, dice, size): """Takes the parsed dice string for a single roll (eg 3/4d20) and performs the actual roll. Returns a string representing the result. @@ -253,7 +257,6 @@ class DiceRoller(object): dS: roll a S-sided die +M: add M to the result (-M for subtraction) (optional) """ - self.build() yacc.parse(dicestr) return self.get_result()