changeset 5615:d01f07aeaec5

[project @ 2006-02-10 21:30:41 by jwe]
author jwe
date Fri, 10 Feb 2006 21:30:42 +0000
parents 4cc6aeb35f93
children 44c592934077
files liboctave/ChangeLog liboctave/mx-inlines.cc src/ChangeLog src/lex.l src/parse.y
diffstat 5 files changed, 40 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Fri Feb 10 15:07:32 2006 +0000
+++ b/liboctave/ChangeLog	Fri Feb 10 21:30:42 2006 +0000
@@ -1,7 +1,12 @@
+2006-02-10  John W. Eaton  <jwe@octave.org>
+
+	* mx-inlines.cc (MX_ND_REDUCTION): Store in cummulative
+	product of all dimensions in CP_SZ.
+
 2006-02-09  John W. Eaton  <jwe@octave.org>
 
 	* mx-inlines.cc (MX_ND_CUMULATIVE_OP): Store in cummulative
-	product of all dimensions in CP.
+	product of all dimensions in CP_SZ.
 
 2006-02-09  David Bateman  <dbateman@free.fr>
 
--- a/liboctave/mx-inlines.cc	Fri Feb 10 15:07:32 2006 +0000
+++ b/liboctave/mx-inlines.cc	Fri Feb 10 21:30:42 2006 +0000
@@ -415,10 +415,12 @@
  \
      The strategy here is to access the elements of A along the \
      dimension  specified by DIM.  This means that we loop over each \
-     element of R and adjust the index into A as needed.  */ \
+     element of R and adjust the index into A as needed.  Store the \
+     cummulative product of all dimensions of A in CP_SZ.  The last \
+     element of CP_SZ is the total number of elements of A.  */ \
  \
-  Array<octave_idx_type> cp_sz (nd, 1); \
-  for (int i = 1; i < nd; i++) \
+  Array<octave_idx_type> cp_sz (nd+1, 1); \
+  for (int i = 1; i <= nd; i++) \
     cp_sz(i) = cp_sz(i-1)*dv(i-1); \
  \
   octave_idx_type reset_at = cp_sz(dim); \
--- a/src/ChangeLog	Fri Feb 10 15:07:32 2006 +0000
+++ b/src/ChangeLog	Fri Feb 10 21:30:42 2006 +0000
@@ -1,3 +1,14 @@
+2006-02-10  John W. Eaton  <jwe@octave.org>
+
+	* lex.l (\[{S}*): Maybe set lexer_flags.looking_at_return_list or
+	lexer_flags.looking_at_matrix_or_assign_lhs here.
+	* parse.y 
+	(return_list_beg): Don't use in_return_list here.
+	(assign_lhs, matrix): Don't use in_matrix_or_assign_lhs here.
+	(in_matrix_or_assign_lhs, in_return_list): Delete unused macros.
+	(matrix): Clear lexer_flags.looking_at_matrix_or_assign_lhs in all
+	cases.
+
 2006-02-09  John W. Eaton  <jwe@octave.org>
 
 	* utils.cc (oct_file_in_path): Check len > 4, not len > 2.
--- a/src/lex.l	Fri Feb 10 15:07:32 2006 +0000
+++ b/src/lex.l	Fri Feb 10 21:30:42 2006 +0000
@@ -484,6 +484,11 @@
     lexer_flags.quote_is_transpose = false;
     lexer_flags.convert_spaces_to_comma = true;
 
+    if (lexer_flags.defining_func && ! lexer_flags.parsed_function_name)
+      lexer_flags.looking_at_return_list = true;
+    else
+      lexer_flags.looking_at_matrix_or_assign_lhs = true;
+
     promptflag--;
     eat_whitespace ();
 
--- a/src/parse.y	Fri Feb 10 15:07:32 2006 +0000
+++ b/src/parse.y	Fri Feb 10 21:30:42 2006 +0000
@@ -601,18 +601,19 @@
 		  { $$ = $1; }
 		;
 
-in_matrix_or_assign_lhs
-		: // empty
-		  { lexer_flags.looking_at_matrix_or_assign_lhs = true; }
-		;
-
 matrix		: '[' ']'
-		  { $$ = new tree_constant (octave_value (Matrix ())); }
+		  {
+		    $$ = new tree_constant (octave_value (Matrix ()));
+		    lexer_flags.looking_at_matrix_or_assign_lhs = false;
+		  }
 		| '[' ';' ']'
-		  { $$ = new tree_constant (octave_value (Matrix ())); }
-		| '[' in_matrix_or_assign_lhs matrix_rows ']'
 		  {
-		    $$ = finish_matrix ($3);
+		    $$ = new tree_constant (octave_value (Matrix ()));
+		    lexer_flags.looking_at_matrix_or_assign_lhs = false;
+		  }
+		| '[' matrix_rows ']'
+		  {
+		    $$ = finish_matrix ($2);
 		    lexer_flags.looking_at_matrix_or_assign_lhs = false;
 		  }
 		;
@@ -866,9 +867,9 @@
 
 assign_lhs	: simple_expr
 		  { $$ = new tree_argument_list ($1); }
-		| '[' in_matrix_or_assign_lhs arg_list CLOSE_BRACE
+		| '[' arg_list CLOSE_BRACE
 		  {
-		    $$ = $3;
+		    $$ = $2;
 		    lexer_flags.looking_at_matrix_or_assign_lhs = false;
 		  }
 		;
@@ -1147,10 +1148,6 @@
 		  { curr_sym_tab = tmp_local_sym_tab; }
 		;
 
-in_return_list	: // empty
-		  { lexer_flags.looking_at_return_list = true; }
-		;
-
 // ===========================
 // List of function parameters
 // ===========================
@@ -1223,7 +1220,7 @@
 // List of function return value names
 // ===================================
 
-return_list_beg	: '[' in_return_list local_symtab
+return_list_beg	: '[' local_symtab
 		;
 
 return_list	: return_list_beg return_list_end