# HG changeset patch # User jwe # Date 1040786078 0 # Node ID 9c8034434982735ae77851deb6e2ad9b4ca96043 # Parent a01ea6c855a3d6eed14392984b11ddde9eaa91d7 [project @ 2002-12-25 03:14:37 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2002-12-24 John W. Eaton + * parse.y (begin_obj_idx): Increment + lexer_flags.looking_at_object_index. + (postfix_expr): Decrement it as appropriate here. + * lex.h (lexical_feedback::looking_at_object_index): Now int. + * parse.y (postfix_expr): Reset lexer_flags.looking_at_object_index in () and {} cases too. diff --git a/src/lex.h b/src/lex.h --- a/src/lex.h +++ b/src/lex.h @@ -162,8 +162,8 @@ // multi-value assignment statement. bool looking_at_matrix_or_assign_lhs; - // TRUE means we're parsing an indexing operation for an object. - bool looking_at_object_index; + // Nonzero means we're parsing an indexing operation for an object. + int looking_at_object_index; // GAG. Stupid kludge so that [[1,2][3,4]] will work. bool do_comma_insert; diff --git a/src/lex.l b/src/lex.l --- a/src/lex.l +++ b/src/lex.l @@ -2546,7 +2546,7 @@ looking_at_matrix_or_assign_lhs = false; // Not parsing an object index. - looking_at_object_index = false; + looking_at_object_index = 0; // Next token can be identifier. cant_be_identifier = false; diff --git a/src/parse.y b/src/parse.y --- a/src/parse.y +++ b/src/parse.y @@ -706,7 +706,7 @@ ; begin_obj_idx : // empty - { lexer_flags.looking_at_object_index = true; } + { lexer_flags.looking_at_object_index++; } ; postfix_expr : primary_expr @@ -714,22 +714,22 @@ | postfix_expr '(' begin_obj_idx ')' { $$ = make_index_expression ($1, 0, '('); - lexer_flags.looking_at_object_index = false; + lexer_flags.looking_at_object_index--; } | postfix_expr '(' begin_obj_idx arg_list ')' { $$ = make_index_expression ($1, $4, '('); - lexer_flags.looking_at_object_index = false; + lexer_flags.looking_at_object_index--; } | postfix_expr '{' begin_obj_idx '}' { $$ = make_index_expression ($1, 0, '{'); - lexer_flags.looking_at_object_index = false; + lexer_flags.looking_at_object_index--; } | postfix_expr '{' begin_obj_idx arg_list '}' { $$ = make_index_expression ($1, $4, '{'); - lexer_flags.looking_at_object_index = false; + lexer_flags.looking_at_object_index--; } | postfix_expr PLUS_PLUS { $$ = make_postfix_op (PLUS_PLUS, $1, $2); }