File tree Expand file tree Collapse file tree 5 files changed +29
-4
lines changed Expand file tree Collapse file tree 5 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -84,10 +84,16 @@ impl ArithmeticExpr {
84
84
if word. text . starts_with ( "\" " ) && word. text . ends_with ( "\" " ) {
85
85
let mut f = Feeder :: new ( & w) ;
86
86
if let Some ( mut e) = ArithmeticExpr :: parse ( & mut f, core, false ) {
87
- if e. elements . len ( ) != 1 && f. len ( ) == 0 {
88
- //ans.elements.push( ArithElem::InParen(e) );
89
- ans. elements . append ( & mut e. elements ) ;
90
- return true ;
87
+ if f. len ( ) == 0 {
88
+ if e. elements . len ( ) != 1 {
89
+ ans. elements . append ( & mut e. elements ) ;
90
+ return true ;
91
+ }
92
+
93
+ match & e. elements [ 0 ] {
94
+ ArithElem :: Word ( w, _) => word = w. clone ( ) ,
95
+ _ => { } ,
96
+ }
91
97
}
92
98
}
93
99
}
Original file line number Diff line number Diff line change 14
14
../../../test/test_others.bash
15
15
../../../test/test_others.bash
16
16
../../../test/test_others.bash
17
+ ../../../test/test_others.bash
18
+ ../../../test/test_others.bash
19
+ ../../../test/test_others.bash
20
+ ../../../test/test_others.bash
21
+ ../../../test/test_others.bash
Original file line number Diff line number Diff line change
1
+ ../../../test/test_others.bash
2
+ ../../../test/test_others.bash
3
+ ../../../test/test_others.bash
4
+ ../../../test/test_others.bash
5
+ ../../../test/test_others.bash
Original file line number Diff line number Diff line change 5
5
./test_others.bash
6
6
./test_job.bash
7
7
../../../test/test_others.bash
8
+ ../../../test/test_others.bash
Original file line number Diff line number Diff line change @@ -612,6 +612,14 @@ res=$($com <<< 'A=1; echo $(("A"++ )); echo $A')
612
612
[ " $res " == " 1
613
613
2" ] || err $LINENO
614
614
615
+ res=$( $com <<< ' A=1; echo $(("A "++ )); echo $A' )
616
+ [ " $res " == " 1
617
+ 2" ] || err $LINENO
618
+
619
+ res=$( $com <<< ' A=1; echo $((" A"++ )); echo $A' )
620
+ [ " $res " == " 1
621
+ 2" ] || err $LINENO
622
+
615
623
res=$( $com <<< ' A=1; echo $((++"A" )); echo $A' )
616
624
[ " $res " == " 2
617
625
2" ] || err $LINENO
You can’t perform that action at this time.
0 commit comments