oct2mat script based on parse tree
Muthiah Annamalai
muthuspost at gmail.com
Wed Jan 9 00:29:45 CST 2008
John W. Eaton wrote:
> On 8-Jan-2008, I wrote:
>
> | I don't think you need to modify the parse tree here when you
> | encounter something like "+=". You just need to emit the lhs, then
> | the binary op corresponding to the OP= operator (you can get that with
> | the octave_value::op_eq_to_binary_op method) and then emit the rhs.
>
> Oops, I meant to say
>
> emit lhs
> emit "="
> emit lhs again
> emit binary operator corresponding to original OP= operator
> emit rhs
>
> jwe
>
>
But I think to make this possible we must have a method by which
we can turn off the fold()-ing of the parse tree, which happens
automatically
right now.
Since Octave is a moving target (which is nice actually!) we have some
issues,like I didnt have boolean expressions involving strings folded
over. Now all the bad ways of handling this can be avoided if we can
introduce a variable for handlingthe folding of code conditionally.
Like I would want to call
folding_option = false;
retval = octave_parse( folding_option );
Or, one way I could think of it, is to use the parser again, to
parse the 'print_original_text' function. This is a little bit of
a hassle but well avoids a global delta fractions of a second, which
means we maynot need the previous route.
-Muthu
More information about the Octave-maintainers
mailing list