# HG changeset patch # User jwe # Date 1068849979 0 # Node ID d1786f2d8a3c4b2d40e3a9892598de392bb96d3c # Parent d44675070f1a2e6e60ed54d7e89a19a2cad7590c [project @ 2003-11-14 22:46:19 by jwe] diff --git a/doc/interpreter/preface.txi b/doc/interpreter/preface.txi --- a/doc/interpreter/preface.txi +++ b/doc/interpreter/preface.txi @@ -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. diff --git a/scripts/miscellaneous/path.m b/scripts/miscellaneous/path.m --- a/scripts/miscellaneous/path.m +++ b/scripts/miscellaneous/path.m @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,22 @@ 2003-11-14 John W. Eaton + * 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. diff --git a/src/lex.h b/src/lex.h --- a/src/lex.h +++ b/src/lex.h @@ -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; diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -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; diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -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--;