diff options
Diffstat (limited to 'examples/shapes.py')
-rw-r--r-- | examples/shapes.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/shapes.py b/examples/shapes.py index 5f621b1..418ade2 100644 --- a/examples/shapes.py +++ b/examples/shapes.py @@ -35,7 +35,11 @@ class Circle(Shape): import pyparsing as pp -number = pp.Regex(r"-?\d+(\.\d*)?").setParseAction(lambda t: float(t[0])) +ppc = pp.pyparsing_common + +# use pyparsing-defined numeric expression that converts all parsed +# numeric values as floats +number = ppc.fnumber() # Shape expressions: # square : S <centerx> <centery> <side> |