commit bash-20090917 snapshot

This commit is contained in:
Chet Ramey
2011-12-08 20:15:57 -05:00
parent e6dfa71744
commit a8fd3f3e51
67 changed files with 11594 additions and 8731 deletions
+180 -81
View File
@@ -442,6 +442,18 @@ redirection: '>' WORD
redir.filename = $3;
$$ = make_redirection (source, r_input_direction, redir, 0);
}
| REDIR_WORD '>' WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_output_direction, redir, REDIR_VARASSIGN);
}
| REDIR_WORD '<' WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_input_direction, redir, REDIR_VARASSIGN);
}
| GREATER_GREATER WORD
{
source.dest = 1;
@@ -454,6 +466,48 @@ redirection: '>' WORD
redir.filename = $3;
$$ = make_redirection (source, r_appending_to, redir, 0);
}
| REDIR_WORD GREATER_GREATER WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_appending_to, redir, REDIR_VARASSIGN);
}
| GREATER_BAR WORD
{
source.dest = 1;
redir.filename = $2;
$$ = make_redirection (source, r_output_force, redir, 0);
}
| NUMBER GREATER_BAR WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_output_force, redir, 0);
}
| REDIR_WORD GREATER_BAR WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_output_force, redir, REDIR_VARASSIGN);
}
| LESS_GREATER WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_input_output, redir, 0);
}
| NUMBER LESS_GREATER WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_input_output, redir, 0);
}
| REDIR_WORD LESS_GREATER WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_input_output, redir, REDIR_VARASSIGN);
}
| LESS_LESS WORD
{
source.dest = 0;
@@ -468,65 +522,12 @@ redirection: '>' WORD
$$ = make_redirection (source, r_reading_until, redir, 0);
redir_stack[need_here_doc++] = $$;
}
| LESS_LESS_LESS WORD
| REDIR_WORD LESS_LESS WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_reading_string, redir, 0);
}
| NUMBER LESS_LESS_LESS WORD
{
source.dest = $1;
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_reading_string, redir, 0);
}
| LESS_AND NUMBER
{
source.dest = 0;
redir.dest = $2;
$$ = make_redirection (source, r_duplicating_input, redir, 0);
}
| NUMBER LESS_AND NUMBER
{
source.dest = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_input, redir, 0);
}
| GREATER_AND NUMBER
{
source.dest = 1;
redir.dest = $2;
$$ = make_redirection (source, r_duplicating_output, redir, 0);
}
| NUMBER GREATER_AND NUMBER
{
source.dest = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_output, redir, 0);
}
| LESS_AND WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_duplicating_input_word, redir, 0);
}
| NUMBER LESS_AND WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_input_word, redir, 0);
}
| GREATER_AND WORD
{
source.dest = 1;
redir.filename = $2;
$$ = make_redirection (source, r_duplicating_output_word, redir, 0);
}
| NUMBER GREATER_AND WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_output_word, redir, 0);
$$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN);
redir_stack[need_here_doc++] = $$;
}
| LESS_LESS_MINUS WORD
{
@@ -542,6 +543,103 @@ redirection: '>' WORD
$$ = make_redirection (source, r_deblank_reading_until, redir, 0);
redir_stack[need_here_doc++] = $$;
}
| REDIR_WORD LESS_LESS_MINUS WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN);
redir_stack[need_here_doc++] = $$;
}
| LESS_LESS_LESS WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_reading_string, redir, 0);
}
| NUMBER LESS_LESS_LESS WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_reading_string, redir, 0);
}
| REDIR_WORD LESS_LESS_LESS WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_reading_string, redir, REDIR_VARASSIGN);
}
| LESS_AND NUMBER
{
source.dest = 0;
redir.dest = $2;
$$ = make_redirection (source, r_duplicating_input, redir, 0);
}
| NUMBER LESS_AND NUMBER
{
source.dest = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_input, redir, 0);
}
| REDIR_WORD LESS_AND NUMBER
{
source.filename = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_input, redir, REDIR_VARASSIGN);
}
| GREATER_AND NUMBER
{
source.dest = 1;
redir.dest = $2;
$$ = make_redirection (source, r_duplicating_output, redir, 0);
}
| NUMBER GREATER_AND NUMBER
{
source.dest = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_output, redir, 0);
}
| REDIR_WORD GREATER_AND NUMBER
{
source.filename = $1;
redir.dest = $3;
$$ = make_redirection (source, r_duplicating_output, redir, REDIR_VARASSIGN);
}
| LESS_AND WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_duplicating_input_word, redir, 0);
}
| NUMBER LESS_AND WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_input_word, redir, 0);
}
| REDIR_WORD LESS_AND WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_input_word, redir, REDIR_VARASSIGN);
}
| GREATER_AND WORD
{
source.dest = 1;
redir.filename = $2;
$$ = make_redirection (source, r_duplicating_output_word, redir, 0);
}
| NUMBER GREATER_AND WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_output_word, redir, 0);
}
| REDIR_WORD GREATER_AND WORD
{
source.filename = $1;
redir.filename = $3;
$$ = make_redirection (source, r_duplicating_output_word, redir, REDIR_VARASSIGN);
}
| GREATER_AND '-'
{
source.dest = 1;
@@ -554,6 +652,12 @@ redirection: '>' WORD
redir.dest = 0;
$$ = make_redirection (source, r_close_this, redir, 0);
}
| REDIR_WORD GREATER_AND '-'
{
source.filename = $1;
redir.dest = 0;
$$ = make_redirection (source, r_close_this, redir, REDIR_VARASSIGN);
}
| LESS_AND '-'
{
source.dest = 0;
@@ -566,6 +670,12 @@ redirection: '>' WORD
redir.dest = 0;
$$ = make_redirection (source, r_close_this, redir, 0);
}
| REDIR_WORD LESS_AND '-'
{
source.filename = $1;
redir.dest = 0;
$$ = make_redirection (source, r_close_this, redir, REDIR_VARASSIGN);
}
| AND_GREATER WORD
{
source.dest = 1;
@@ -578,30 +688,6 @@ redirection: '>' WORD
redir.filename = $2;
$$ = make_redirection (source, r_append_err_and_out, redir, 0);
}
| NUMBER LESS_GREATER WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_input_output, redir, 0);
}
| LESS_GREATER WORD
{
source.dest = 0;
redir.filename = $2;
$$ = make_redirection (source, r_input_output, redir, 0);
}
| GREATER_BAR WORD
{
source.dest = 1;
redir.filename = $2;
$$ = make_redirection (source, r_output_force, redir, 0);
}
| NUMBER GREATER_BAR WORD
{
source.dest = $1;
redir.filename = $3;
$$ = make_redirection (source, r_output_force, redir, 0);
}
;
simple_command_element: WORD
@@ -4511,6 +4597,19 @@ got_token:
yylval.word = the_word;
if (token[0] == '{' && token[token_index-1] == '}' &&
(character == '<' || character == '>'))
{
/* can use token; already copied to the_word */
token[token_index-1] = '\0';
if (legal_identifier (token+1))
{
strcpy (the_word->word, token+1);
/*itrace("read_token_word: returning REDIR_WORD for %s", the_word->word);*/
return (REDIR_WORD);
}
}
result = ((the_word->flags & (W_ASSIGNMENT|W_NOSPLIT)) == (W_ASSIGNMENT|W_NOSPLIT))
? ASSIGNMENT_WORD : WORD;