1 |
commit: 351f71b0267b090cc5825fafeb9eef6ee102169f |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Fri Apr 15 12:53:58 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 17 10:44:18 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=351f71b0 |
7 |
|
8 |
Parser: other expansions inside pathname expansion |
9 |
|
10 |
Pathname expansions like configu[e${a}] are now supported. |
11 |
|
12 |
--- |
13 |
bashast/bashast.g | 8 +++++++- |
14 |
bashast/gunit/fname.gunit | 1 + |
15 |
2 files changed, 8 insertions(+), 1 deletions(-) |
16 |
|
17 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
18 |
index 4bd3447..d5c3415 100644 |
19 |
--- a/bashast/bashast.g |
20 |
+++ b/bashast/bashast.g |
21 |
@@ -413,7 +413,13 @@ bracket_pattern_match |
22 |
//allowable patterns with bracket pattern matching |
23 |
pattern_match |
24 |
: pattern_class_match |
25 |
- | str_part str_part_with_pound*; |
26 |
+ | pattern_string_part+; |
27 |
+pattern_string_part |
28 |
+ : var_ref |
29 |
+ | command_sub |
30 |
+ | arithmetic_expansion |
31 |
+ | ns_str_part; |
32 |
+ |
33 |
//special class patterns to match: [:alpha:] etc |
34 |
pattern_class_match |
35 |
: LSQUARE COLON NAME COLON RSQUARE -> ^(CHARACTER_CLASS NAME) |
36 |
|
37 |
diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit |
38 |
index e783504..eb8f080 100644 |
39 |
--- a/bashast/gunit/fname.gunit |
40 |
+++ b/bashast/gunit/fname.gunit |
41 |
@@ -48,6 +48,7 @@ fname: |
42 |
"ctrlx\cx" -> (STRING ctrlx \ cx) |
43 |
"tab\\ttab" -> "(STRING tab \\ \t tab)" |
44 |
"abc[def]" -> (STRING abc (MATCH_PATTERN def)) |
45 |
+"abc[d${more}]" -> (STRING abc (MATCH_PATTERN d (VAR_REF more))) |
46 |
"a[]" -> (STRING a [ ]) |
47 |
"ab[d-h]" -> (STRING ab (MATCH_PATTERN d - h)) |
48 |
"ab[!d-h]" -> (STRING ab (MATCH_ANY_EXCEPT d - h)) |