aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-07-05 03:00:22 +0100
committerMu Qiao <qiaomuf@gentoo.org>2012-07-20 09:20:22 +0800
commit4e7532418091e60ba632350eb865698dd208e968 (patch)
tree0bb0c06b21ec6bf1ea9aabed31c0e3c78c5ae6ec
parentBuiltin: Support more options for declare (diff)
downloadlibbash-4e7532418091e60ba632350eb865698dd208e968.tar.gz
libbash-4e7532418091e60ba632350eb865698dd208e968.tar.bz2
libbash-4e7532418091e60ba632350eb865698dd208e968.zip
Parser: Support line continuation inside keyword test
-rw-r--r--bashast/bashast.g4
-rw-r--r--scripts/compound_command.bash22
2 files changed, 24 insertions, 2 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 2d425ce..0fb8212 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -614,9 +614,9 @@ condition_expr
#endif
keyword_condition_and
- : keyword_condition_primary (BLANK!? LOGICAND^ BLANK!? keyword_condition_primary)*;
+ : keyword_condition_primary ( wspace!? LOGICAND^ wspace!? keyword_condition_primary)*;
keyword_condition
- : keyword_condition_and (BLANK!? LOGICOR^ BLANK!? keyword_condition_and)*;
+ : keyword_condition_and ( wspace!? LOGICOR^ wspace!? keyword_condition_and)*;
keyword_negation_primary
: BANG BLANK keyword_condition_primary -> ^(NEGATION keyword_condition_primary);
keyword_condition_primary
diff --git a/scripts/compound_command.bash b/scripts/compound_command.bash
index fe3eac4..f328f85 100644
--- a/scripts/compound_command.bash
+++ b/scripts/compound_command.bash
@@ -385,3 +385,25 @@ case ${EAPI} in
*)
echo "Unknown EAPI=${EAPI} for ruby-ng.eclass"
esac
+
+if [[ 1 == 0 ||
+ 1 == 0
+|| 1 == 0
+ || 1 == 0 || # Extra space here
+ 1 == 1 ]]; then
+ echo or
+fi
+
+if [[ 1 == 1 # Extra space here
+ && 1 == 1 && 1 == 1 &&
+ 1 == 1&&
+ 1 == 1 ]]; then
+ echo and
+fi
+
+if [[ 1 == 1 &&
+ 1 == 0 || 1 == 1
+ && 1 == 1 ||
+ 1 == 1 && 1 == 1 ]]; then
+ echo and or
+fi