mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Make braces expand right-to-left, to make syntax more consistent
darcs-hash:20060617142652-ac50b-3c6ca24e37ae723fea6e74d1e4a9c66fd2f60c50.gz
This commit is contained in:
parent
e007a5c203
commit
43b6b703ff
1 changed files with 9 additions and 9 deletions
12
expand.c
12
expand.c
|
@ -987,14 +987,13 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
||||||
int len1, len2, tot_len;
|
int len1, len2, tot_len;
|
||||||
|
|
||||||
for( pos=in;
|
for( pos=in;
|
||||||
(!bracket_end) && (*pos) && !syntax_error;
|
(*pos) && !syntax_error;
|
||||||
pos++ )
|
pos++ )
|
||||||
{
|
{
|
||||||
switch( *pos )
|
switch( *pos )
|
||||||
{
|
{
|
||||||
case BRACKET_BEGIN:
|
case BRACKET_BEGIN:
|
||||||
{
|
{
|
||||||
if(( bracket_count == 0)&&(bracket_begin==0))
|
|
||||||
bracket_begin = pos;
|
bracket_begin = pos;
|
||||||
|
|
||||||
bracket_count++;
|
bracket_count++;
|
||||||
|
@ -1004,8 +1003,10 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
||||||
case BRACKET_END:
|
case BRACKET_END:
|
||||||
{
|
{
|
||||||
bracket_count--;
|
bracket_count--;
|
||||||
if( (bracket_count == 0) && (bracket_end == 0) )
|
if( bracket_end < bracket_begin )
|
||||||
|
{
|
||||||
bracket_end = pos;
|
bracket_end = pos;
|
||||||
|
}
|
||||||
|
|
||||||
if( bracket_count < 0 )
|
if( bracket_count < 0 )
|
||||||
{
|
{
|
||||||
|
@ -1024,7 +1025,9 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
||||||
if( bracket_count > 0 )
|
if( bracket_count > 0 )
|
||||||
{
|
{
|
||||||
if( !(flags & ACCEPT_INCOMPLETE) )
|
if( !(flags & ACCEPT_INCOMPLETE) )
|
||||||
|
{
|
||||||
syntax_error = 1;
|
syntax_error = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1042,9 +1045,6 @@ static int expand_brackets( wchar_t *in, int flags, array_list_t *out )
|
||||||
sb_append_char( &mod, BRACKET_END );
|
sb_append_char( &mod, BRACKET_END );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return expand_brackets( (wchar_t*)mod.buff, 1, out );
|
return expand_brackets( (wchar_t*)mod.buff, 1, out );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue