all test passed!

This commit is contained in:
Benjamin Bertrand 2016-02-14 20:59:04 +03:00
parent deb5be0955
commit ab8b80758c

View File

@ -102,11 +102,11 @@ def in2post_fix(infix_tokens):
@param infix_tokens: the infix list of tokens to transform into postfix form.
@return: the corresponding postfix list of tokens.
>>> in2post_fix([op.par, 2, op.add, 5, op.sub, 1, ')', op.div, op.par, 3, op.mul, 4, ')'])
>>> in2post_fix(['(', 2, '+', 5, '-', 1, ')', '/', '(', 3, '*', 4, ')'])
[2, 5, 1, '-', '+', 3, 4, '*', '/']
>>> in2post_fix([op.sub1, op.par, op.sub1, 2, ')'])
>>> in2post_fix(['-', '(', '-', 2, ')'])
[2, '-', '-']
>>> in2post_fix([op.sub1, op.par, op.sub1, 2, op.add, 3, op.mul, 4, ')'])
>>> in2post_fix(['-', '(', '-', 2, '+', 3, '*', 4, ')'])
[2, '-', 3, 4, '*', '+', '-']
"""
# Stack where operator will be stocked