Skip to content
Snippets Groups Projects
Commit 69c3cd5d authored by Taddeus Kroes's avatar Taddeus Kroes Committed by Taddeüs Kroes
Browse files

Fixed pi notation.

parent 903dfc6f
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,7 @@ class Parser(BisonParser):
return data
# Replace known keywords with escape sequences.
words = list(self.__class__.words)
words = list(self.words)
words.insert(10, '\n')
words.insert(13, '\r')
......@@ -211,8 +211,8 @@ class Parser(BisonParser):
# inserted between a function and its argument(s): "sin x" should
# not be written as "sin*x", because that is bogus.
# Bugfix: omit 0x0e (pi) to prevent "pi a" (should be "pi*a")
if ord(left) <= 0x9 or 0x0b <= ord(left) <= 0x0d \
or 0x0f <= ord(left) <= 0x19:
o = ord(left)
if o <= 0x9 or 0x0b <= o <= 0x0d or 0x0f <= o <= 0x19:
return left + ' ' + right
# If all characters on the right are numbers. e.g. "a4", the
......
......@@ -83,6 +83,8 @@ class TestParser(RulesTestCase):
# FIXME: self.assertEqual(tree('|a|b'), tree('|a| * b'))
self.assertEqual(tree('|a||b|'), tree('|a| * |b|'))
self.assertEqual(tree('pi2'), tree('pi * 2'))
def test_functions(self):
x = tree('x')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment