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: bashast/, bashast/gunit/
Date: Wed, 01 Jun 2011 12:03:40
Message-Id: bf0e206d28d3cd9f5de4d63700a06c75d9581e23.betelgeuse@gentoo
1 commit: bf0e206d28d3cd9f5de4d63700a06c75d9581e23
2 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 30 08:30:18 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 1 06:11:32 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=bf0e206d
7
8 Parser: allow spaces at the end of arithmetic expansion
9
10 ---
11 bashast/bashast.g | 4 ++--
12 bashast/gunit/arith_main.gunit | 1 +
13 2 files changed, 3 insertions(+), 2 deletions(-)
14
15 diff --git a/bashast/bashast.g b/bashast/bashast.g
16 index 26d362f..c560644 100644
17 --- a/bashast/bashast.g
18 +++ b/bashast/bashast.g
19 @@ -554,8 +554,8 @@ explicit_arithmetic
20 //the square bracket from is deprecated
21 //http://permalink.gmane.org/gmane.comp.shells.bash.bugs/14479
22 arithmetic_expansion
23 - : DOLLAR LLPAREN BLANK* arithmetics RRPAREN -> ^(ARITHMETIC_EXPRESSION arithmetics)
24 - | DOLLAR LSQUARE BLANK* arithmetics RSQUARE -> ^(ARITHMETIC_EXPRESSION arithmetics);
25 + : DOLLAR LLPAREN BLANK* arithmetics BLANK* RRPAREN -> ^(ARITHMETIC_EXPRESSION arithmetics)
26 + | DOLLAR LSQUARE BLANK* arithmetics BLANK* RSQUARE -> ^(ARITHMETIC_EXPRESSION arithmetics);
27
28 process_substitution
29 : (dir=LESS_THAN|dir=GREATER_THAN)LPAREN clist BLANK* RPAREN -> ^(PROCESS_SUBSTITUTION $dir clist);
30
31 diff --git a/bashast/gunit/arith_main.gunit b/bashast/gunit/arith_main.gunit
32 index 4490eb3..b462450 100644
33 --- a/bashast/gunit/arith_main.gunit
34 +++ b/bashast/gunit/arith_main.gunit
35 @@ -134,4 +134,5 @@ arithmetic_expansion:
36 start:
37 "echo $(( 3 + 2 ))" -> (LIST (COMMAND (STRING echo) (STRING (ARITHMETIC_EXPRESSION (+ 3 2)))))
38 "echo $((++i))" -> (LIST (COMMAND (STRING echo) (STRING (ARITHMETIC_EXPRESSION (PRE_INCR (VAR_REF i))))))
39 +"echo $(( ++i ))" -> (LIST (COMMAND (STRING echo) (STRING (ARITHMETIC_EXPRESSION (PRE_INCR (VAR_REF i))))))
40 "echo \"The solution is: $(( 3+2 ))\""-> (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING The solution is : (ARITHMETIC_EXPRESSION (+ 3 2))))))