From 873fd833073ddf1afa57db321e438e19d5e6186e Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 5 Oct 2006 09:32:06 +1000 Subject: [PATCH] Drop the optional checking of block type for the end builtin darcs-hash:20061004233206-ac50b-cf72c879b4b58c8e5ba4e1dff5c2746ca2e8844f.gz --- builtin.c | 31 ------------------------------- parser.c | 53 ----------------------------------------------------- 2 files changed, 84 deletions(-) diff --git a/builtin.c b/builtin.c index 3d947c202..6c343ae8e 100644 --- a/builtin.c +++ b/builtin.c @@ -2759,37 +2759,6 @@ static int builtin_end( wchar_t **argv ) variables in the current loop scope won't die between laps. */ int kill_block = 1; - wchar_t *type = argv[1]; - if( type ) - { - int t = parser_get_block_type( type ); - if( t != current_block->type ) - { - if( t == -1 ) - { - sb_printf( sb_err, - BUILTIN_END_BLOCK_UNKNOWN, - argv[0], - type, - parser_get_block_command( current_block->type ) ); - } - else - { - sb_printf( sb_err, - BUILTIN_END_BLOCK_MISMATCH, - argv[0], - type, - parser_get_block_command( current_block->type ) ); - } - - builtin_print_help( argv[0], sb_err ); - return 1; - - - } - - } - switch( current_block->type ) { diff --git a/parser.c b/parser.c index ba2308694..c5a81fac6 100644 --- a/parser.c +++ b/parser.c @@ -3441,59 +3441,6 @@ int parser_test( const wchar_t * buff, } } - /* - Try to make sure that arguments passed to 'end' - is always the type of block to close - */ - if( wcscmp( cmd, L"end" ) == 0 ) - { - if( (arg_count == 1) /*&& (count > 0)*/ ) - { - - int t = parser_get_block_type( tok_last( &tok ) ); - - /* - This is ugly. We peek at the element - past the current element on the - block_type stack. It will always contain - the type of the block that just went out - of scope, which is what we need, but it - is not nice coding practice to search - through the 'junk pile' like that... - */ - if( t != block_type[count] ) - { - err=1; - if( out ) - { - if( t == -1 ) - { - error( SYNTAX_ERROR, - tok_get_pos( &tok ), - BUILTIN_END_BLOCK_UNKNOWN, - L"end", - tok_last( &tok ) ); - } - else - { - error( SYNTAX_ERROR, - tok_get_pos( &tok ), - BUILTIN_END_BLOCK_MISMATCH, - L"end", - tok_last( &tok ), - parser_get_block_command( block_type[count-1] ) ); - } - - print_errors( out, prefix ); - - } - } - - } - - } - - } break;