Use ahead-of-time syntax checker to validate input for complete builtin

darcs-hash:20060521192630-ac50b-c469f5bb3bd2afddce3ffa80adba0589d515b938.gz
This commit is contained in:
axel 2006-05-22 05:26:30 +10:00
parent 1c2cbb00bc
commit 409a407ca0

View File

@ -443,6 +443,42 @@ int builtin_complete( wchar_t **argv )
}
if( !res )
{
if( condition && wcslen( condition ) )
{
if( parser_test( condition, 0 ) )
{
sb_printf( sb_err,
L"%ls: Condition '%ls' contained a syntax error\n",
argv[0],
condition );
parser_test( condition, 1 );
res = 1;
}
}
}
if( !res )
{
if( comp && wcslen( comp ) )
{
if( parser_test_args( comp, 0 ) )
{
sb_printf( sb_err,
L"%ls: Completion '%ls' contained a syntax error\n",
argv[0],
comp );
parser_test_args( comp, 1 );
res = 1;
}
}
}
if( !res )
{
if( do_complete )