Render ~work with letters still some bugs

This commit is contained in:
lafrite 2014-01-17 14:57:45 +01:00 committed by Lafrite
parent 0c4306c058
commit b0a60f706b
2 changed files with 14 additions and 1 deletions

View File

@ -324,7 +324,11 @@ class Expression(object):
"""
return type(exp) == int or \
type(exp) == Fraction or \
<<<<<<< HEAD
type(exp) == FormalExp
=======
exp.isalpha()
>>>>>>> Render ~work with letters still some bugs
@staticmethod
def isOperator(exp):
@ -405,6 +409,15 @@ if __name__ == '__main__':
#e = Expression(exp)
#print(e)
exp="-2*a(12 + 1)(3-12)"
e = Expression(exp)
print(e)
# TODO: The next one doesn't work |ven. janv. 17 14:56:58 CET 2014
#exp="-2*(-a)(12 + 1)(3-12)"
#e = Expression(exp)
#print(e)
## Can't handle it yet!!
#exp="-(-2)"
#test(exp)

View File

@ -15,7 +15,7 @@ class Render(object):
PRIORITY = {"^": 4,"*" : 3, "/": 3, ":": 3, "+": 2, "-":2, "(": 1}
def __init__(self, op_infix = {}, op_postfix = {}, other = {}, join = " ", type_render = {int: str, Fraction: str, FormalExp: str}):
def __init__(self, op_infix = {}, op_postfix = {}, other = {}, join = " ", type_render = {int: str, Fraction: str, str: str}):
"""Initiate the render
@param op_infix: the dictionnary of infix operator with how they have to be render