Gentoo Archives: gentoo-commits

From: "Petteri Räty" <betelgeuse@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/libbash:master commit in: scripts/, bashast/
Date: Wed, 27 Apr 2011 15:11:35
Message-Id: 67ae08a05b489c31f9df7453eea3ed8446d4f5ae.betelgeuse@gentoo
1 commit: 67ae08a05b489c31f9df7453eea3ed8446d4f5ae
2 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 26 10:47:40 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 27 14:58:45 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=67ae08a0
7
8 Walker: support until loop
9
10 ---
11 bashast/libbashWalker.g | 5 +++--
12 scripts/compound_command.bash | 12 ++++++++++++
13 scripts/compound_command.bash.result | 4 ++++
14 3 files changed, 19 insertions(+), 2 deletions(-)
15
16 diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
17 index 01c080e..8dc0b41 100644
18 --- a/bashast/libbashWalker.g
19 +++ b/bashast/libbashWalker.g
20 @@ -406,8 +406,9 @@ for_modification
21 while_expr
22 @declarations {
23 ANTLR3_MARKER command_index;
24 + bool negate;
25 }
26 - :^(WHILE {
27 + :^((WHILE { negate = false; } | UNTIL { negate = true; }) {
28 // omit the first DOWN token
29 SEEK(INDEX() + 1);
30
31 @@ -415,7 +416,7 @@ while_expr
32 while(true)
33 {
34 command_list(ctx);
35 - if(walker->get_status())
36 + if(walker->get_status() == (negate? 0 : 1))
37 break;
38 command_list(ctx);
39 SEEK(command_index);
40
41 diff --git a/scripts/compound_command.bash b/scripts/compound_command.bash
42 index 9da53b8..ad00e63 100644
43 --- a/scripts/compound_command.bash
44 +++ b/scripts/compound_command.bash
45 @@ -34,3 +34,15 @@ while [ $i \< 0 ]
46 do
47 echo "Shouldn't print this"
48 done
49 +
50 +i=0;
51 +until [ $i == 4 ]
52 +do
53 + i=$(( i + 1 ))
54 + echo $i
55 +done
56 +
57 +until [ $i \> 0 ]
58 +do
59 + echo "Shouldn't print this"
60 +done
61
62 diff --git a/scripts/compound_command.bash.result b/scripts/compound_command.bash.result
63 index b2d305a..3e2e9f4 100644
64 --- a/scripts/compound_command.bash.result
65 +++ b/scripts/compound_command.bash.result
66 @@ -15,6 +15,10 @@ ghi
67 2
68 3
69 4
70 +1
71 +2
72 +3
73 +4
74 file= foo bar
75 foo=ghi
76 i=4