diff options
-rw-r--r-- | bashast/bashast.g | 8 | ||||
-rw-r--r-- | bashast/gunit/cond_main.gunit | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g index 700f865..8d627c4 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -600,9 +600,9 @@ condition_expr #endif keyword_condition_and - : keyword_condition_primary (BLANK!? LOGICAND^ BLANK!? keyword_condition_primary)?; + : keyword_condition_primary (BLANK!? LOGICAND^ BLANK!? keyword_condition_primary)*; keyword_condition - : keyword_condition_and (BLANK!? LOGICOR^ BLANK!? keyword_condition_and)?; + : keyword_condition_and (BLANK!? LOGICOR^ BLANK!? keyword_condition_and)*; keyword_negation_primary : BANG BLANK keyword_condition_primary -> ^(NEGATION keyword_condition_primary); keyword_condition_primary @@ -655,9 +655,9 @@ keyword_binary_string_operator builtin_condition_and - : builtin_condition_primary (builtin_logic_and^ BLANK! builtin_condition_primary)?; + : builtin_condition_primary (builtin_logic_and^ BLANK! builtin_condition_primary)*; builtin_condition - : builtin_condition_and (builtin_logic_or^ BLANK! builtin_condition_and)?; + : builtin_condition_and (builtin_logic_or^ BLANK! builtin_condition_and)*; builtin_negation_primary : BANG BLANK builtin_condition_primary -> ^(NEGATION builtin_condition_primary); builtin_condition_primary diff --git a/bashast/gunit/cond_main.gunit b/bashast/gunit/cond_main.gunit index bf86d7d..cb8ffef 100644 --- a/bashast/gunit/cond_main.gunit +++ b/bashast/gunit/cond_main.gunit @@ -34,9 +34,13 @@ condition_expr: "[ -n \"$FROM_LANG\" -a -n \"$TO_LANG\" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC_AND (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF TO_LANG)))))) "[ -n \"$FROM_LANG\" -o -n \"$TO_LANG\" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC_OR (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF TO_LANG)))))) "[ -n \"a\" -o -n \"a\" -a -n \"a\" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC_OR (n (STRING (DOUBLE_QUOTED_STRING a))) (BUILTIN_LOGIC_AND (n (STRING (DOUBLE_QUOTED_STRING a))) (n (STRING (DOUBLE_QUOTED_STRING a)))))) +"[ -n \"a\" -a -n \"a\" -a -n \"a\" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC_AND (BUILTIN_LOGIC_AND (n (STRING (DOUBLE_QUOTED_STRING a))) (n (STRING (DOUBLE_QUOTED_STRING a)))) (n (STRING (DOUBLE_QUOTED_STRING a))))) +"[ -n \"a\" -o -n \"a\" -o -n \"a\" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC_OR (BUILTIN_LOGIC_OR (n (STRING (DOUBLE_QUOTED_STRING a))) (n (STRING (DOUBLE_QUOTED_STRING a)))) (n (STRING (DOUBLE_QUOTED_STRING a))))) "[[ \"${element}\" =~ (^[^[:space:]]+\ .) ]]" -> (KEYWORD_TEST (MATCH_REGULAR_EXPRESSION (STRING (DOUBLE_QUOTED_STRING (VAR_REF element))) (STRING ( ^ [ ^ [ : space : ] ] + \ . )))) "[[ a<b ]]" -> (KEYWORD_TEST (< (STRING a) (STRING b))) "[[ a>b ]]" -> (KEYWORD_TEST (> (STRING a) (STRING b))) "[[ ${VIRTUALX_REQUIRED} == always || ${VIRTUALX_REQUIRED} == test ]]" -> (KEYWORD_TEST (|| (MATCH_PATTERN (STRING (VAR_REF VIRTUALX_REQUIRED)) (STRING always)) (MATCH_PATTERN (STRING (VAR_REF VIRTUALX_REQUIRED)) (STRING test)))) "[[ a == b || c == d && e == f ]]" -> (KEYWORD_TEST (|| (MATCH_PATTERN (STRING a) (STRING b)) (&& (MATCH_PATTERN (STRING c) (STRING d)) (MATCH_PATTERN (STRING e) (STRING f))))) "[[ a == b && c == d || e == f ]]" -> (KEYWORD_TEST (|| (&& (MATCH_PATTERN (STRING a) (STRING b)) (MATCH_PATTERN (STRING c) (STRING d))) (MATCH_PATTERN (STRING e) (STRING f)))) +"[[ a == b && c == d && e == f ]]" -> (KEYWORD_TEST (&& (&& (MATCH_PATTERN (STRING a) (STRING b)) (MATCH_PATTERN (STRING c) (STRING d))) (MATCH_PATTERN (STRING e) (STRING f)))) +"[[ a == b || c == d || e == f ]]" -> (KEYWORD_TEST (|| (|| (MATCH_PATTERN (STRING a) (STRING b)) (MATCH_PATTERN (STRING c) (STRING d))) (MATCH_PATTERN (STRING e) (STRING f)))) |