Commit d3feae46 authored by Taddeus Kroes's avatar Taddeus Kroes

Added subscript operator with precedence equal to power.

parent 755c9b50
......@@ -4,7 +4,7 @@ from traverse import traverse_depth_first
OPERATORS = [
('+', '-'),
('*', '/', 'mod'),
('^', )
('^', '_')
]
MAX_PRED = len(OPERATORS)
......
......@@ -38,6 +38,9 @@ class TestLine(unittest.TestCase):
power = N('^', l0, N('^', N('^', l1, l2), l3))
self.assertEquals(generate_line(power), '1 ^ (2 ^ 3) ^ 4')
power = N('^', l0, N('^', N('_', l1, l2), l3))
self.assertEquals(generate_line(power), '1 ^ (2 _ 3) ^ 4')
def test_parentheses_equal_precedence_left(self):
a, b, c, d = L('a'), L('b'), L('c'), L('d')
exp = N('*', N('/', N('*', a, b), c), d)
......
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