mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-22 17:00:25 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@13 e7d03fd6-7b0d-0410-9947-9c21f3af8025
19 lines
No EOL
484 B
Python
19 lines
No EOL
484 B
Python
import MathParser
|
|
|
|
class MyMathParser(MathParser.MathParser):
|
|
def addfunc(self, left, plus, right):
|
|
print "%d + %d" % (left, right)
|
|
return left + right
|
|
def parenfunc(self, lp, expr, rp):
|
|
print "handling parens"
|
|
return expr
|
|
def timesfunc(self, left, times, right):
|
|
print "%d * %d" % (left, right)
|
|
return left * right
|
|
|
|
def _test():
|
|
p = MyMathParser()
|
|
p.parse("4 * (3 + 2 * 5)", 1)
|
|
|
|
if __name__=='__main__':
|
|
_test() |