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: Sun, 03 Jun 2012 09:10:21
Message-Id: 1330590632.19f82f9686e67da79b9f265f8baf228223d069b4.betelgeuse@gentoo
1 commit: 19f82f9686e67da79b9f265f8baf228223d069b4
2 Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 1 08:30:32 2012 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 1 08:30:32 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=19f82f96
7
8 Parser: Allow EOLs in builtin array definition
9
10 ---
11 bashast/bashast.g | 13 ++++++++++++-
12 bashast/gunit/array.gunit | 12 ++++++++++++
13 2 files changed, 24 insertions(+), 1 deletions(-)
14
15 diff --git a/bashast/bashast.g b/bashast/bashast.g
16 index 73249ef..92f4f92 100644
17 --- a/bashast/bashast.g
18 +++ b/bashast/bashast.g
19 @@ -461,7 +461,18 @@ array_atom
20 );
21
22 builtin_variable_definition_item
23 - : ((~EOL) => expansion_base)+;
24 +scope {
25 + int parens;
26 +}
27 +@init {
28 + $builtin_variable_definition_item::parens = 0;
29 +}
30 + : (
31 + (LPAREN) => LPAREN { ++$builtin_variable_definition_item::parens; }
32 + |(RPAREN) => RPAREN { --$builtin_variable_definition_item::parens; }
33 + |(~EOL) => expansion_base
34 + | {LA(1) == EOL && $builtin_variable_definition_item::parens > 0}? => EOL
35 + )+;
36
37 #ifdef OUTPUT_C
38 builtin_variable_definitions[bool local]
39
40 diff --git a/bashast/gunit/array.gunit b/bashast/gunit/array.gunit
41 index ddfdfeb..1958836 100644
42 --- a/bashast/gunit/array.gunit
43 +++ b/bashast/gunit/array.gunit
44 @@ -34,6 +34,18 @@ variable_definition_atom:
45 builtin_variable_definitions:
46 "asdf=(a b c d) ade acd=bde" -> (LIST (COMMAND (VARIABLE_DEFINITIONS (= asdf (ARRAY (STRING a) (STRING b) (STRING c) (STRING d))) (EQUALS ade (STRING (VAR_REF ade))) (= acd (STRING bde)))))
47
48 +builtin_variable_definition_item:
49 +"local cmakeargs=(
50 + abc
51 + def
52 + ghi
53 +)" -> "local cmakeargs = ( \n abc \n def \n ghi \n )"
54 +"export cmakeargs=(
55 + abc
56 + def
57 + ghi
58 +)" -> "export cmakeargs = ( \n abc \n def \n ghi \n )"
59 +
60 variable_reference:
61 "$asdf" -> (VAR_REF asdf)
62 "${asdf[0]:-default}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL (asdf (ARITHMETIC 0)) (STRING default)))