1 |
commit: 4e7532418091e60ba632350eb865698dd208e968 |
2 |
Author: André Aparício <aparicio99 <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Jul 5 02:00:22 2012 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 20 01:20:22 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=4e753241 |
7 |
|
8 |
Parser: Support line continuation inside keyword test |
9 |
|
10 |
--- |
11 |
bashast/bashast.g | 4 ++-- |
12 |
scripts/compound_command.bash | 22 ++++++++++++++++++++++ |
13 |
2 files changed, 24 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
16 |
index 2d425ce..0fb8212 100644 |
17 |
--- a/bashast/bashast.g |
18 |
+++ b/bashast/bashast.g |
19 |
@@ -614,9 +614,9 @@ condition_expr |
20 |
#endif |
21 |
|
22 |
keyword_condition_and |
23 |
- : keyword_condition_primary (BLANK!? LOGICAND^ BLANK!? keyword_condition_primary)*; |
24 |
+ : keyword_condition_primary ( wspace!? LOGICAND^ wspace!? keyword_condition_primary)*; |
25 |
keyword_condition |
26 |
- : keyword_condition_and (BLANK!? LOGICOR^ BLANK!? keyword_condition_and)*; |
27 |
+ : keyword_condition_and ( wspace!? LOGICOR^ wspace!? keyword_condition_and)*; |
28 |
keyword_negation_primary |
29 |
: BANG BLANK keyword_condition_primary -> ^(NEGATION keyword_condition_primary); |
30 |
keyword_condition_primary |
31 |
|
32 |
diff --git a/scripts/compound_command.bash b/scripts/compound_command.bash |
33 |
index fe3eac4..f328f85 100644 |
34 |
--- a/scripts/compound_command.bash |
35 |
+++ b/scripts/compound_command.bash |
36 |
@@ -385,3 +385,25 @@ case ${EAPI} in |
37 |
*) |
38 |
echo "Unknown EAPI=${EAPI} for ruby-ng.eclass" |
39 |
esac |
40 |
+ |
41 |
+if [[ 1 == 0 || |
42 |
+ 1 == 0 |
43 |
+|| 1 == 0 |
44 |
+ || 1 == 0 || # Extra space here |
45 |
+ 1 == 1 ]]; then |
46 |
+ echo or |
47 |
+fi |
48 |
+ |
49 |
+if [[ 1 == 1 # Extra space here |
50 |
+ && 1 == 1 && 1 == 1 && |
51 |
+ 1 == 1&& |
52 |
+ 1 == 1 ]]; then |
53 |
+ echo and |
54 |
+fi |
55 |
+ |
56 |
+if [[ 1 == 1 && |
57 |
+ 1 == 0 || 1 == 1 |
58 |
+ && 1 == 1 || |
59 |
+ 1 == 1 && 1 == 1 ]]; then |
60 |
+ echo and or |
61 |
+fi |