aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-28 16:00:11 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:52:18 +0800
commit2bcc4ed9ea1b78036807a4c914003922343e7b04 (patch)
tree181796cde7eb410a302c72468d2a7f46536fd334 /bashast
parentWalker: support brace expansion for local and export (diff)
downloadlibbash-2bcc4ed9ea1b78036807a4c914003922343e7b04.tar.gz
libbash-2bcc4ed9ea1b78036807a4c914003922343e7b04.tar.bz2
libbash-2bcc4ed9ea1b78036807a4c914003922343e7b04.zip
Parser: support process sub as redirection dest
Diffstat (limited to 'bashast')
-rw-r--r--bashast/bashast.g9
-rw-r--r--bashast/gunit/process_substitution.gunit6
2 files changed, 11 insertions, 4 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 818a598..d09138a 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -275,8 +275,8 @@ time_posix
redirection
: redirection_atom+;
redirection_atom
- : redirection_operator BLANK? redirection_destination -> ^(REDIR redirection_operator redirection_destination)
- | BLANK!? process_substitution
+ : redirection_operator redirection_destination -> ^(REDIR redirection_operator redirection_destination)
+ | BLANK! process_substitution
| here_string;
process_substitution
@@ -284,8 +284,9 @@ process_substitution
-> ^(PROCESS_SUBSTITUTION $dir command_list);
redirection_destination
- : (file_descriptor) => file_descriptor
- | string_expr;
+ : (BLANK? file_descriptor) => BLANK!? file_descriptor
+ | BLANK! process_substitution
+ | BLANK!? string_expr;
file_descriptor
: DIGIT -> ^(FILE_DESCRIPTOR DIGIT)
| DIGIT MINUS -> ^(FILE_DESCRIPTOR_MOVE DIGIT);
diff --git a/bashast/gunit/process_substitution.gunit b/bashast/gunit/process_substitution.gunit
index b0d2754..f7e0ec2 100644
--- a/bashast/gunit/process_substitution.gunit
+++ b/bashast/gunit/process_substitution.gunit
@@ -21,3 +21,9 @@ gunit java_libbash;
process_substitution:
"<( true )" -> (PROCESS_SUBSTITUTION < (LIST (COMMAND (STRING true))))
">(false)" -> (PROCESS_SUBSTITUTION > (LIST (COMMAND (STRING false))))
+
+command:
+"while read -d $'\0' -r nspkg_pth_file; do
+ nspkg_pth_files+=(\"${nspkg_pth_file}\")
+done < <(find \"${ED}\" -name \"*-nspkg.pth\" -type f -print0)" -> (COMMAND (while (LIST (COMMAND (STRING read) (STRING - d) (STRING (ANSI_C_QUOTING '\0')) (STRING - r) (STRING nspkg_pth_file))) (LIST (COMMAND (VARIABLE_DEFINITIONS (PLUS_ASSIGN nspkg_pth_files (ARRAY (STRING (DOUBLE_QUOTED_STRING (VAR_REF nspkg_pth_file))))))))) (REDIR < (PROCESS_SUBSTITUTION < (LIST (COMMAND (STRING find) (STRING (DOUBLE_QUOTED_STRING (VAR_REF ED))) (STRING - name) (STRING (DOUBLE_QUOTED_STRING * - nspkg . pth)) (STRING - type) (STRING f) (STRING - print0))))))
+"echo<(cat)" FAIL