changeset 4613:d1786f2d8a3c

[project @ 2003-11-14 22:46:19 by jwe]
author jwe
date Fri, 14 Nov 2003 22:46:19 +0000
parents d44675070f1a
children 1e8d49b93fab
files doc/interpreter/preface.txi scripts/miscellaneous/path.m src/ChangeLog src/lex.h src/lex.l src/parse.y
diffstat 6 files changed, 77 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/preface.txi	Fri Nov 14 19:50:38 2003 +0000
+++ b/doc/interpreter/preface.txi	Fri Nov 14 22:46:19 2003 +0000
@@ -167,15 +167,20 @@
 
 @item
 Gabriele Pannocchia  @email{pannocchia@@ing.unipi.it} provided the
-@code{dkalman.m} function and added support for singular system matrices
-to @code{dlqe} and @code{dlqr}.
+@code{dkalman.m} function, added support for singular system matrices
+to @code{dlqe} and @code{dlqr}, and has made various other
+improvements to the control system functions.
 
 @item
-Tony Richardson @email{richardson@@evansville.edu?} wrote Octave's
+Tony Richardson @email{richardson@@evansville.edu} wrote Octave's
 image processing functions as well as most of the original polynomial
 functions.
 
 @item
+Petter Risholm @email{Petter.Risholm@@idi.ntnu.no} helped to implement
+much of Octave's N-d array functionality.
+
+@item
 Ben Sapp @email{bsapp@@lanl.gov} implemented the debugger functions and
 added Texinfo markup commands to the internal doc strings.
 
--- a/scripts/miscellaneous/path.m	Fri Nov 14 19:50:38 2003 +0000
+++ b/scripts/miscellaneous/path.m	Fri Nov 14 22:46:19 2003 +0000
@@ -40,8 +40,8 @@
 
   if (nargin == 0)
     if (nargout == 0)
-      stdout << "\nLOADPATH contains the following directories:\n\n  ";
-      stdout << strrep (LOADPATH, ":", "\n  ") << "\n\n";
+      puts ("\nLOADPATH contains the following directories:\n\n  %s\n\n",
+	    strrep (DEFAULT_LOADPATH, ":", "\n  ");
     else
       p = LOADPATH;
     endif
--- a/src/ChangeLog	Fri Nov 14 19:50:38 2003 +0000
+++ b/src/ChangeLog	Fri Nov 14 22:46:19 2003 +0000
@@ -1,5 +1,22 @@
 2003-11-14  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* lex.l (maybe_unput_comma, handle_close_bracket):
+	Don't insert comma if we are looking at an object index and the
+	closest nesting level is a brace.
+
+	* parse.y (postfix_expr): Use begin_obj_idx between postfix_expr
+	and the indexing delimiter rather than after it.
+
+	* lex.h (lexical_feedback::braceflag): New member variable.
+	* lex.l	(lexical_feedback::init): Initialize braceflag.
+	(\{{S}*): Increment lexer_flags.braceflag, not
+	lexer_flags.bracketflag.
+	(handle_close_bracket): Handle lexer_flags.braceflag and
+	lexer_flags.bracketflag separately based on bracket_type.
+	Delete unnecesary yyinput/yyunput.
+
+	* lex.l (next_token_is_postfix_unary_op): Also recognize ++ and --.
+
 	* ov-typeinfo.cc (octave_value_typeinfo::register_type,
 	octave_value_typeinfo::do_register_type):
 	New arg, c_name for class name.
--- a/src/lex.h	Fri Nov 14 19:50:38 2003 +0000
+++ b/src/lex.h	Fri Nov 14 22:46:19 2003 +0000
@@ -129,6 +129,9 @@
   // Square bracket level count.
   int bracketflag;
 
+  // Curly brace level count.
+  int braceflag;
+
   // TRUE means we're in the middle of defining a loop.
   int looping;
 
--- a/src/lex.l	Fri Nov 14 19:50:38 2003 +0000
+++ b/src/lex.l	Fri Nov 14 22:46:19 2003 +0000
@@ -754,7 +754,7 @@
     promptflag--;
     eat_whitespace ();
 
-    lexer_flags.bracketflag++;
+    lexer_flags.braceflag++;
     BEGIN (MATRIX_START);
     return '{';
   }
@@ -1508,6 +1508,18 @@
       un_op = (c1 == '\'');
       yyunput (c1, yytext);
     }
+  else if (c0 == '+')
+    {
+      int c1 = yyinput ();
+      un_op = (c1 == '+');
+      yyunput (c1, yytext);
+    }
+  else if (c0 == '-')
+    {
+      int c1 = yyinput ();
+      un_op = (c1 == '-');
+      yyunput (c1, yytext);
+    }
 
   yyunput (c0, yytext);
 
@@ -2234,10 +2246,16 @@
   if (! nesting_level.none ())
     {
       nesting_level.remove ();
-      lexer_flags.bracketflag--;
+
+      if (bracket_type == ']')
+	lexer_flags.bracketflag--;
+      else if (bracket_type == '}')
+	lexer_flags.braceflag--;
+      else
+	panic_impossible ();
     }
 
-  if (lexer_flags.bracketflag == 0)
+  if (lexer_flags.bracketflag == 0 && lexer_flags.braceflag == 0)
     BEGIN (INITIAL);
 
   if (bracket_type == ']'
@@ -2246,28 +2264,24 @@
     {
       retval = CLOSE_BRACE;
     }
-  else
+  else if ((lexer_flags.bracketflag || lexer_flags.braceflag)
+	   && lexer_flags.convert_spaces_to_comma
+	   && (nesting_level.is_bracket ()
+	       || (nesting_level.is_brace ()
+		   && ! lexer_flags.looking_at_object_index)))
     {
-      int c1 = yyinput ();
-      yyunput (c1, yytext);
-
-      if (lexer_flags.bracketflag)
+      int bin_op = next_token_is_bin_op (spc_gobbled);
+
+      int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
+
+      int sep_op = next_token_is_sep_op ();
+
+      if (! (postfix_un_op || bin_op || sep_op))
 	{
-	  int bin_op = next_token_is_bin_op (spc_gobbled);
-
-	  int postfix_un_op = next_token_is_postfix_unary_op (spc_gobbled);
-
-	  int sep_op = next_token_is_sep_op ();
-
-	  if (! (postfix_un_op || bin_op || sep_op)
-	      && nesting_level.is_bracket_or_brace ()
-	      && lexer_flags.convert_spaces_to_comma)
-	    {
-	      maybe_warn_separator_insert (',');
-
-	      yyunput (',', yytext);
-	      return retval;
-	    }
+	  maybe_warn_separator_insert (',');
+
+	  yyunput (',', yytext);
+	  return retval;
 	}
     }
 
@@ -2281,7 +2295,9 @@
 static void
 maybe_unput_comma (int spc_gobbled)
 {
-  if (nesting_level.is_bracket_or_brace ())
+  if (nesting_level.is_bracket ()
+      || (nesting_level.is_brace ()
+	  && ! lexer_flags.looking_at_object_index))
     {
       int bin_op = next_token_is_bin_op (spc_gobbled);
 
@@ -2499,6 +2515,9 @@
   // Not initially defining a matrix list.
   bracketflag = 0;
 
+  // Not initially defining a cell array list.
+  braceflag = 0;
+
   // Not initially inside a loop or if statement.
   looping = 0;
 
--- a/src/parse.y	Fri Nov 14 19:50:38 2003 +0000
+++ b/src/parse.y	Fri Nov 14 22:46:19 2003 +0000
@@ -731,22 +731,22 @@
 
 postfix_expr	: primary_expr
 		  { $$ = $1; }
-		| postfix_expr '(' begin_obj_idx ')'
+		| postfix_expr begin_obj_idx '(' ')'
 		  {
 		    $$ = make_index_expression ($1, 0, '(');
 		    lexer_flags.looking_at_object_index--;
 		  }
-		| postfix_expr '(' begin_obj_idx arg_list ')'
+		| postfix_expr begin_obj_idx '(' arg_list ')'
 		  {
 		    $$ = make_index_expression ($1, $4, '(');
 		    lexer_flags.looking_at_object_index--;
 		  }
-		| postfix_expr '{' begin_obj_idx '}'
+		| postfix_expr begin_obj_idx '{' '}'
 		  {
 		    $$ = make_index_expression ($1, 0, '{');
 		    lexer_flags.looking_at_object_index--;
 		  }
-		| postfix_expr '{' begin_obj_idx arg_list '}'
+		| postfix_expr begin_obj_idx '{' arg_list '}'
 		  {
 		    $$ = make_index_expression ($1, $4, '{');
 		    lexer_flags.looking_at_object_index--;