diff options
author | ptmcg <ptmcg@austin.rr.com> | 2020-04-26 10:33:12 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2020-04-26 10:33:12 -0500 |
commit | 203fa36d7ae6b79344e4bf13531b77c09f313793 (patch) | |
tree | 443459f498f38b97618344c6f707eeaa117cf670 /examples/shapes.py | |
parent | 813ba3bed433a96e02d82cad2e2940a6850d96a5 (diff) | |
download | pyparsing-git-203fa36d7ae6b79344e4bf13531b77c09f313793.tar.gz |
change some lambdas to explicit methods for clarity (see discussion in #207); deleted duplicated examples (commit *all* changes this time)
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> |