apparently ply doesn't like docstrings in its functions
This commit is contained in:
parent
01d3c7c80c
commit
d637983ae1
|
@ -138,7 +138,7 @@ class Dice(Module):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def p_roll_r(self, p):
|
def p_roll_r(self, p):
|
||||||
"""Chain rolls together."""
|
# Chain rolls together.
|
||||||
|
|
||||||
# General idea I had when creating this grammar: A roll string is a chain
|
# General idea I had when creating this grammar: A roll string is a chain
|
||||||
# of modifiers, which may be repeated for a certain number of trials. It can
|
# of modifiers, which may be repeated for a certain number of trials. It can
|
||||||
|
@ -151,7 +151,7 @@ class Dice(Module):
|
||||||
output = p[0]
|
output = p[0]
|
||||||
|
|
||||||
def p_roll(self, p):
|
def p_roll(self, p):
|
||||||
"""Parse a basic roll string."""
|
# Parse a basic roll string.
|
||||||
|
|
||||||
'roll : trial modifier comment'
|
'roll : trial modifier comment'
|
||||||
global output
|
global output
|
||||||
|
@ -164,7 +164,7 @@ class Dice(Module):
|
||||||
output = p[0]
|
output = p[0]
|
||||||
|
|
||||||
def p_roll_no_trials(self, p):
|
def p_roll_no_trials(self, p):
|
||||||
"""Parse a roll string without trials."""
|
# Parse a roll string without trials.
|
||||||
|
|
||||||
'roll : modifier comment'
|
'roll : modifier comment'
|
||||||
global output
|
global output
|
||||||
|
@ -177,7 +177,7 @@ class Dice(Module):
|
||||||
output = p[0]
|
output = p[0]
|
||||||
|
|
||||||
def p_comment(self, p):
|
def p_comment(self, p):
|
||||||
"""Parse a comment."""
|
# Parse a comment.
|
||||||
|
|
||||||
'''comment : TEXT
|
'''comment : TEXT
|
||||||
|'''
|
|'''
|
||||||
|
@ -187,7 +187,7 @@ class Dice(Module):
|
||||||
p[0] = None
|
p[0] = None
|
||||||
|
|
||||||
def p_modifier(self, p):
|
def p_modifier(self, p):
|
||||||
"""Parse a modifier on a roll string."""
|
# Parse a modifier on a roll string.
|
||||||
|
|
||||||
'''modifier : modifier "+" modifier
|
'''modifier : modifier "+" modifier
|
||||||
| modifier "-" modifier'''
|
| modifier "-" modifier'''
|
||||||
|
@ -204,7 +204,7 @@ class Dice(Module):
|
||||||
p[0] = [p[1], p[2], p[3]]
|
p[0] = [p[1], p[2], p[3]]
|
||||||
|
|
||||||
def p_die(self, p):
|
def p_die(self, p):
|
||||||
"""Return the left side before the "d", and the number of faces."""
|
# Return the left side before the "d", and the number of faces.
|
||||||
|
|
||||||
'modifier : left NUMBER'
|
'modifier : left NUMBER'
|
||||||
p[0] = (p[1], p[2])
|
p[0] = (p[1], p[2])
|
||||||
|
@ -214,7 +214,7 @@ class Dice(Module):
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
|
|
||||||
def p_left(self, p):
|
def p_left(self, p):
|
||||||
"""Parse the number of dice we are rolling, and how many we are keeping."""
|
# Parse the number of dice we are rolling, and how many we are keeping.
|
||||||
'left : keep dice'
|
'left : keep dice'
|
||||||
if p[1] == None:
|
if p[1] == None:
|
||||||
p[0] = [None, p[2]]
|
p[0] = [None, p[2]]
|
||||||
|
@ -252,7 +252,7 @@ class Dice(Module):
|
||||||
p[0] = 1
|
p[0] = 1
|
||||||
|
|
||||||
def p_error(self, p):
|
def p_error(self, p):
|
||||||
"""Provide the user with something (albeit not much) when the roll can't be parsed."""
|
# Provide the user with something (albeit not much) when the roll can't be parsed.
|
||||||
global output
|
global output
|
||||||
output = "Unable to parse roll"
|
output = "Unable to parse roll"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue