Commit 492f3b52 authored by Taddeüs Kroes's avatar Taddeüs Kroes

'&' can now be used for conjunction (alias for '^^').

parent 3d2a13ab
...@@ -37,3 +37,4 @@ ...@@ -37,3 +37,4 @@
# Now works: # Now works:
# int_(-3)^(3) \pi (3^2 - x^2) dx -> 36pi # int_(-3)^(3) \pi (3^2 - x^2) dx -> 36pi
# int_(-r)^(r) \pi (r^2 - x^2) dx -> 4 / 3 * pi * r ^ 3 # int_(-r)^(r) \pi (r^2 - x^2) dx -> 4 / 3 * pi * r ^ 3
# "&" instead of "^^"
...@@ -105,6 +105,7 @@ OP_MAP = { ...@@ -105,6 +105,7 @@ OP_MAP = {
'^': OP_POW, '^': OP_POW,
'_': OP_SUBSCRIPT, '_': OP_SUBSCRIPT,
'^^': OP_AND, '^^': OP_AND,
'&': OP_AND,
'vv': OP_OR, 'vv': OP_OR,
'sin': OP_SIN, 'sin': OP_SIN,
'cos': OP_COS, 'cos': OP_COS,
......
...@@ -63,6 +63,9 @@ class TestParser(RulesTestCase): ...@@ -63,6 +63,9 @@ class TestParser(RulesTestCase):
self.assertEqual(tree('a vv b vv c'), (a | b) | c) self.assertEqual(tree('a vv b vv c'), (a | b) | c)
self.assertEqual(tree('a vv b ^^ c'), a | (b & c)) self.assertEqual(tree('a vv b ^^ c'), a | (b & c))
self.assertEqual(tree('a & b'), a & b)
self.assertEqual(tree('a vv b & c'), a | (b & c))
def test_preprocessor(self): def test_preprocessor(self):
self.assertEqual(tree('ab'), tree('a * b')) self.assertEqual(tree('ab'), tree('a * b'))
self.assertEqual(tree('abc'), tree('a * b * c')) self.assertEqual(tree('abc'), tree('a * b * c'))
......
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