From e97fdc696928fd27538d9fc4789fa6a6d9f71a16 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sat, 5 May 2012 02:05:57 -0400 Subject: [PATCH] Fix parsing of multi-argument functions in Maxima interface. --- pymbolic/maxima.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pymbolic/maxima.py b/pymbolic/maxima.py index 3faf898..c4da310 100644 --- a/pymbolic/maxima.py +++ b/pymbolic/maxima.py @@ -139,6 +139,20 @@ class MaximaParser(ParserBase): pstate.advance() left_exp **= self.parse_expression(pstate, p._PREC_POWER) did_something = True + elif next_tag is p._comma and p._PREC_COMMA > min_precedence: + # The precedence makes the comma left-associative. + + pstate.advance() + if pstate.is_at_end() or pstate.next_tag() is p._closepar: + left_exp = (left_exp,) + else: + new_el = self.parse_expression(pstate, p._PREC_COMMA) + if isinstance(left_exp, tuple): + left_exp = left_exp + (new_el,) + else: + left_exp = (left_exp, new_el) + + did_something = True return left_exp, did_something -- GitLab