Commit aade5fc5 authored by Taddeus Kroes's avatar Taddeus Kroes

Division now has a higher precedece than multiplication (like implemented by MathJax).

parent ade1a950
...@@ -6,7 +6,8 @@ OPERATORS = ( ...@@ -6,7 +6,8 @@ OPERATORS = (
('^^', ), ('^^', ),
('=', ), ('=', ),
('+', '-'), ('+', '-'),
('*', '/', 'mod'), ('*', 'mod'),
('/', ),
('^', '_'), ('^', '_'),
) )
......
...@@ -51,7 +51,7 @@ class TestLine(unittest.TestCase): ...@@ -51,7 +51,7 @@ class TestLine(unittest.TestCase):
def test_parentheses_equal_precedence_left(self): def test_parentheses_equal_precedence_left(self):
a, b, c, d = L('a'), L('b'), L('c'), L('d') a, b, c, d = L('a'), L('b'), L('c'), L('d')
exp = N('*', N('/', N('*', a, b), c), d) exp = N('*', N('/', N('*', a, b), c), d)
self.assertEquals(generate_line(exp), 'ab / c * d') self.assertEquals(generate_line(exp), '(ab) / c * d')
def test_parentheses_unary(self): def test_parentheses_unary(self):
neg = N('-', N('+', L(1), L(2))) neg = N('-', N('+', L(1), L(2)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment