1 |
commit: b28640eea98b8d3e691c83fece6ef66dcfa49976 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Fri Apr 8 13:41:29 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 8 13:41:29 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=b28640ee |
7 |
|
8 |
Simplify $_ handling |
9 |
|
10 |
The special variable doesn't need its own branch as the name rule |
11 |
already covers it. |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 3 +-- |
15 |
bashast/gunit/param_main.gunit | 2 ++ |
16 |
2 files changed, 3 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
19 |
index 7f4bed5..e167f9f 100644 |
20 |
--- a/bashast/bashast.g |
21 |
+++ b/bashast/bashast.g |
22 |
@@ -246,8 +246,7 @@ var_ref |
23 |
| DOLLAR POUND -> ^(VAR_REF POUND) |
24 |
| DOLLAR QMARK -> ^(VAR_REF QMARK) |
25 |
| DOLLAR MINUS -> ^(VAR_REF MINUS) |
26 |
- | DOLLAR BANG -> ^(VAR_REF BANG) |
27 |
- | DOLLAR '_' -> ^(VAR_REF '_'); |
28 |
+ | DOLLAR BANG -> ^(VAR_REF BANG); |
29 |
//Variable expansions |
30 |
var_exp : var_name (USE_DEFAULT|USE_ALTERNATE|DISPLAY_ERROR|ASSIGN_DEFAULT)^ word |
31 |
| var_name COLON wspace* LPAREN? os=arithmetic RPAREN? (COLON len=arithmetic)? -> ^(OFFSET var_name $os ^($len)?) |
32 |
|
33 |
diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gunit |
34 |
index eb49309..6668dd9 100644 |
35 |
--- a/bashast/gunit/param_main.gunit |
36 |
+++ b/bashast/gunit/param_main.gunit |
37 |
@@ -45,6 +45,8 @@ var_ref: |
38 |
"${@}" -> (VAR_REF @) |
39 |
"${3}" -> (VAR_REF 3) |
40 |
"$?" -> (VAR_REF ?) |
41 |
+"$_" -> (VAR_REF _) |
42 |
+"${_}" -> (VAR_REF _) |
43 |
"${PV//./_}" -> (VAR_REF (REPLACE_ALL PV (STRING .) (STRING _))) |
44 |
"${PV/#foo/bar}" -> (VAR_REF (REPLACE_FIRST PV (STRING foo) (STRING bar))) |
45 |
"${PV/%foo/bar}" -> (VAR_REF (REPLACE_LAST PV (STRING foo) (STRING bar))) |