From 2bcc4ed9ea1b78036807a4c914003922343e7b04 Mon Sep 17 00:00:00 2001 From: Mu Qiao Date: Thu, 28 Jul 2011 16:00:11 +0800 Subject: Parser: support process sub as redirection dest --- bashast/bashast.g | 9 +++++---- bashast/gunit/process_substitution.gunit | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'bashast') 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 -- cgit v1.2.3-65-gdbad