[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47091] string representation of a colon expre

From: Rik
Subject: [Octave-bug-tracker] [bug #47091] string representation of a colon expression may be missing parentheses
Date: Fri, 17 Aug 2018 18:37:07 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #5, bug #47091 (project octave):

This should be relatively simple to fix, but Lachlan was right that this is an
issue in the parser rather than an issue with printing.  I'm adding jwe to the
CC list since I don't know the parser at all well.

If I create a file tmp.m with the following contents

a = 1;
b = 4;
a + (2:b)

and then run it with all commands set to be echoed I get

octave:2> echo on all
octave:3> blah
+ a = 1;
+ b = 4;
+ a + (2:b)
ans =

   3   4   5


In this case, the parentheses are properly printed.

Looking at oct-parse.yy, there is only one place where the function
mark_in_parens() is used which is in the rule for "primary_expr"

                | '(' expression ')'
                  { $$ = $2->mark_in_parens (); }

It seems like somehow the rule for anon_fcn_handle does not manange to hit

anon_fcn_handle : '@' param_list stmt_begin expr_no_assign


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]