mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Make validation code show offening parameter on perameter expansion problems
darcs-hash:20060531154147-ac50b-dd9b9a3e000352b045a4a9c3122a45a312c43f19.gz
This commit is contained in:
25
parser.c
25
parser.c
@@ -2565,7 +2565,7 @@ static int parser_get_block_type( const wchar_t *cmd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int parser_test_argument( const wchar_t *arg, int babble )
|
static int parser_test_argument( const wchar_t *arg, int babble, int offset )
|
||||||
{
|
{
|
||||||
wchar_t *unesc;
|
wchar_t *unesc;
|
||||||
wchar_t *pos;
|
wchar_t *pos;
|
||||||
@@ -2587,7 +2587,7 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
if( babble )
|
if( babble )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
-1,
|
offset,
|
||||||
L"Mismatched parans" );
|
L"Mismatched parans" );
|
||||||
print_errors();
|
print_errors();
|
||||||
}
|
}
|
||||||
@@ -2619,13 +2619,13 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Do _not_ call sb_destroy on this stringbuffer - it's
|
Do _not_ call sb_destroy on this stringbuffer - it's
|
||||||
buffer is used as the new 'arg_cpy'.
|
buffer is used as the new 'arg_cpy'. It is free'd at
|
||||||
|
the end of the loop.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unesc = unescape( arg_cpy, 1 );
|
unesc = unescape( arg_cpy, 1 );
|
||||||
free( arg_cpy );
|
free( arg_cpy );
|
||||||
@@ -2648,8 +2648,9 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
if( babble )
|
if( babble )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
-1,
|
offset,
|
||||||
COMPLETE_VAR_BRACKET_DESC );
|
COMPLETE_VAR_BRACKET_DESC );
|
||||||
|
|
||||||
print_errors();
|
print_errors();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2661,7 +2662,7 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
if( babble )
|
if( babble )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
-1,
|
offset,
|
||||||
COMPLETE_VAR_PARAN_DESC );
|
COMPLETE_VAR_PARAN_DESC );
|
||||||
print_errors();
|
print_errors();
|
||||||
}
|
}
|
||||||
@@ -2674,7 +2675,7 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
if( babble )
|
if( babble )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
-1,
|
offset,
|
||||||
COMPLETE_VAR_NULL_DESC );
|
COMPLETE_VAR_NULL_DESC );
|
||||||
print_errors();
|
print_errors();
|
||||||
}
|
}
|
||||||
@@ -2692,7 +2693,7 @@ static int parser_test_argument( const wchar_t *arg, int babble )
|
|||||||
if( babble )
|
if( babble )
|
||||||
{
|
{
|
||||||
error( SYNTAX_ERROR,
|
error( SYNTAX_ERROR,
|
||||||
-1,
|
offset,
|
||||||
COMPLETE_VAR_DESC,
|
COMPLETE_VAR_DESC,
|
||||||
*(pos+1) );
|
*(pos+1) );
|
||||||
print_errors();
|
print_errors();
|
||||||
@@ -2737,7 +2738,7 @@ int parser_test_args(const wchar_t * buff,
|
|||||||
|
|
||||||
case TOK_STRING:
|
case TOK_STRING:
|
||||||
{
|
{
|
||||||
err |= parser_test_argument( tok_last( &tok ), babble );
|
err |= parser_test_argument( tok_last( &tok ), babble, tok_get_pos( &tok ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3055,7 +3056,7 @@ int parser_test( const wchar_t * buff,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err |= parser_test_argument( tok_last( &tok ), babble );
|
err |= parser_test_argument( tok_last( &tok ), babble, tok_get_pos( &tok ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If possible, keep track of number of supplied arguments
|
If possible, keep track of number of supplied arguments
|
||||||
|
|||||||
Reference in New Issue
Block a user