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/
Date: Thu, 07 Apr 2011 16:45:22
Message-Id: b5c3aeace9f791de74b93c35c2118cc67f8db0f1.betelgeuse@gentoo
1 commit: b5c3aeace9f791de74b93c35c2118cc67f8db0f1
2 Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu>
3 AuthorDate: Thu Apr 7 09:10:11 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 7 16:39:17 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=b5c3aeac
7
8 Use negation to simplify sqstr rule
9
10 Instead of listing all the alternatives use negation to find out where
11 the single quoted string ends.
12
13 ---
14 bashast/bashast.g | 8 +++-----
15 1 files changed, 3 insertions(+), 5 deletions(-)
16
17 diff --git a/bashast/bashast.g b/bashast/bashast.g
18 index 7126bdd..3d52c27 100644
19 --- a/bashast/bashast.g
20 +++ b/bashast/bashast.g
21 @@ -372,10 +372,6 @@ ns_str : ns_str_part* -> ^(STRING ns_str_part*);
22 dq_str_part
23 : BLANK|EOL|AMP|LOGICAND|LOGICOR|LESS_THAN|GREATER_THAN|PIPE|SQUOTE|SEMIC|COMMA|LPAREN|RPAREN|LLPAREN|RRPAREN|DOUBLE_SEMIC|LBRACE|RBRACE|TICK|LEQ|GEQ
24 | str_part_with_pound;
25 -//Allowable parts of single quoted strings
26 -sq_str_part
27 - : str_part_with_pound
28 - | BLANK|EOL|AMP|LOGICAND|LOGICOR|LESS_THAN|GREATER_THAN|PIPE|QUOTE|SEMIC|COMMA|LPAREN|RPAREN|LLPAREN|RRPAREN|DOUBLE_SEMIC|LBRACE|RBRACE|DOLLAR|TICK|BOP|UOP;
29 //Generic strings/filenames.
30 fname : nqstr -> ^(STRING nqstr);
31 //A string that is NOT a bash reserved word
32 @@ -411,7 +407,9 @@ dqstr_part
33 | pattern_match_trigger
34 | BANG;
35 //single quoted string rule, no expansions
36 -sqstr : SQUOTE sq_str_part* SQUOTE -> ^(SINGLE_QUOTED_STRING sq_str_part*);
37 +sqstr_part
38 + : ~SQUOTE*;
39 +sqstr : SQUOTE sqstr_part SQUOTE -> ^(SINGLE_QUOTED_STRING sqstr_part);
40 //certain tokens that trigger pattern matching
41 pattern_match_trigger
42 : LSQUARE