diff libinterp/parse-tree/oct-parse.in.yy @ 16237:70f465930546

rearrange class heirarchy for tree_cell and tree_matrix * pt-array-list.h, pt-array-list.cc: New files. (tree_array_list): New class. * pt-cell.h, pt-cell.cc (tree_cell): Derive from tree_array_list. * pt-mat.h, pt-mat.cc (tree_matrix): Derive from tree_array_list. * oct-parse.in.yy (octave_parser::finish_array_list): New function adapted from octave_parser::finish_matrix. (octave_parser::finish_matrix, octave_parser::finish_cell): Call finish_array_list to do the work. * pt-arg-list.h: Include symtab.h. * base-list.h: Include cstdlib.
author John W. Eaton <jwe@octave.org>
date Sat, 09 Mar 2013 18:04:51 -0500
parents 78365c56a762
children 38bd5ae8463b
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy	Sat Mar 09 18:42:43 2013 +0000
+++ b/libinterp/parse-tree/oct-parse.in.yy	Sat Mar 09 18:04:51 2013 -0500
@@ -2956,12 +2956,12 @@
   return row;
 }
 
-// Finish building a matrix list.
+// Finish building an array_list.
 
 tree_expression *
-octave_parser::finish_matrix (tree_matrix *m)
+octave_parser::finish_array_list (tree_array_list *array_list)
 {
-  tree_expression *retval = m;
+  tree_expression *retval = array_list;
 
   unwind_protect frame;
 
@@ -2974,24 +2974,25 @@
   discard_error_messages = true;
   discard_warning_messages = true;
 
-  if (m->all_elements_are_constant ())
+  if (array_list->all_elements_are_constant ())
     {
-      octave_value tmp = m->rvalue1 ();
+      octave_value tmp = array_list->rvalue1 ();
 
       if (! (error_state || warning_state))
         {
           tree_constant *tc_retval
-            = new tree_constant (tmp, m->line (), m->column ());
+            = new tree_constant (tmp, array_list->line (),
+                                 array_list->column ());
 
           std::ostringstream buf;
 
           tree_print_code tpc (buf);
 
-          m->accept (tpc);
+          array_list->accept (tpc);
 
           tc_retval->stash_original_text (buf.str ());
 
-          delete m;
+          delete array_list;
 
           retval = tc_retval;
         }
@@ -3000,12 +3001,20 @@
   return retval;
 }
 
+// Finish building a matrix list.
+
+tree_expression *
+octave_parser::finish_matrix (tree_matrix *m)
+{
+  return finish_array_list (m);
+}
+
 // Finish building a cell list.
 
 tree_expression *
 octave_parser::finish_cell (tree_cell *c)
 {
-  return finish_matrix (c);
+  return finish_array_list (c);
 }
 
 void