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: Thu, 09 Jun 2011 13:41:40
Message-Id: 06f6705ed79411dfe9c08bbe0298b2b03c666ab5.betelgeuse@gentoo
1 commit: 06f6705ed79411dfe9c08bbe0298b2b03c666ab5
2 Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu>
3 AuthorDate: Thu Jun 9 12:06:57 2011 +0000
4 Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 9 12:06:57 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=06f6705e
7
8 Parser: fix ${var:-public_html}
9
10 -p is no longer a special token. This makes things simpler as you don't
11 need to prepare for it. When the time functionality is implemented in
12 walker it can check the letter given.
13
14 ---
15 bashast/bashast.g | 7 ++-----
16 bashast/gunit/fname.gunit | 2 +-
17 bashast/gunit/param_main.gunit | 1 +
18 bashast/gunit/pipeline.gunit | 6 +++---
19 bashast/gunit/simp_command.gunit | 2 +-
20 5 files changed, 8 insertions(+), 10 deletions(-)
21
22 diff --git a/bashast/bashast.g b/bashast/bashast.g
23 index bea3740..9cd8ca1 100644
24 --- a/bashast/bashast.g
25 +++ b/bashast/bashast.g
26 @@ -123,7 +123,7 @@ pipeline
27 : BLANK!* time? ((BANG) => (BANG BLANK!+))? command^ (BLANK!* PIPE^ BLANK!* command)*;
28 time : TIME^ BLANK!+ ((time_posix) => time_posix)?;
29 time_posix
30 - : TIME_POSIX BLANK!+;
31 + : MINUS! LETTER BLANK!+;
32 //The structure of a command in bash
33 command
34 : compound_command
35 @@ -417,7 +417,7 @@ ns_str_part
36 | esc_char
37 |OTHER|EQUALS|PCT|PCTPCT|MINUS|DOT|DOTDOT|COLON|TEST_EXPR
38 |TILDE|MUL_ASSIGN|DIVIDE_ASSIGN|MOD_ASSIGN|PLUS_ASSIGN|MINUS_ASSIGN
39 - |TIME_POSIX|LSHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN
40 + |LSHIFT_ASSIGN|RSHIFT_ASSIGN|AND_ASSIGN|XOR_ASSIGN
41 |OR_ASSIGN|CARET|POUND|POUNDPOUND|COMMA|EXPORT|LOCAL;
42
43 //Generic strings/filenames.
44 @@ -689,9 +689,6 @@ ESC_LPAREN
45 : ESC LPAREN;
46 ESC_LT : ESC'<';
47 ESC_GT : ESC'>';
48 -//For pipeline
49 -TIME_POSIX
50 - : '-p';
51 //Handle ANSI C escaped characters: escaped octal, escaped hex, escaped ctrl+ chars, then all others
52 ESC : '\\';
53 UNDERSCORE : '_';
54
55 diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit
56 index c12449b..799570d 100644
57 --- a/bashast/gunit/fname.gunit
58 +++ b/bashast/gunit/fname.gunit
59 @@ -66,7 +66,7 @@ fname:
60 "ab[[.backslash.]]" -> (STRING ab (MATCH_ANY (COLLATING_SYMBOL backslash)))
61 "ab[12[:alpha:]]" -> (STRING ab (MATCH_ANY 12 (CHARACTER_CLASS alpha)))
62 "\"'foo'\"" -> (STRING (DOUBLE_QUOTED_STRING ' foo '))
63 -"--preserve=timestamps,mode" -> (STRING - -p reserve = timestamps , mode)
64 +"--preserve=timestamps,mode" -> (STRING - - preserve = timestamps , mode)
65
66 dqstr:
67 "\"\\\"\"" -> (DOUBLE_QUOTED_STRING \ ")
68
69 diff --git a/bashast/gunit/param_main.gunit b/bashast/gunit/param_main.gunit
70 index fcd7d6d..67b26cf 100644
71 --- a/bashast/gunit/param_main.gunit
72 +++ b/bashast/gunit/param_main.gunit
73 @@ -22,6 +22,7 @@ var_ref:
74 "$asdf" -> (VAR_REF asdf)
75 "${asdf}" -> (VAR_REF asdf)
76 "${asdf:-foo}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL asdf (STRING foo)))
77 +"${asdf:-public_html}" -> (VAR_REF (USE_DEFAULT_WHEN_UNSET_OR_NULL asdf (STRING public_html)))
78 "${asdf='foo'}" -> (VAR_REF (ASSIGN_DEFAULT_WHEN_UNSET asdf (STRING (SINGLE_QUOTED_STRING foo))))
79 "${asdf:=}" -> (VAR_REF (ASSIGN_DEFAULT_WHEN_UNSET_OR_NULL asdf STRING))
80 "${bar:7}" -> (VAR_REF (OFFSET bar 7))
81
82 diff --git a/bashast/gunit/pipeline.gunit b/bashast/gunit/pipeline.gunit
83 index f2c0cb0..9b52c0a 100644
84 --- a/bashast/gunit/pipeline.gunit
85 +++ b/bashast/gunit/pipeline.gunit
86 @@ -22,10 +22,10 @@ pipeline:
87 "cat asdf" -> (COMMAND (STRING cat) (STRING asdf))
88 "export VAR=bar LAA=laa foo" -> (VARIABLE_DEFINITIONS (= VAR (STRING bar)) (= LAA (STRING laa)))
89 "LOCAL1=a LOCAL2=b export GLOBAL1=2 GLOBAL2 GLOBAL3" -> (COMMAND (STRING export) (STRING GLOBAL1 = 2) (STRING GLOBAL2) (STRING GLOBAL3) (= LOCAL1 (STRING a)) (= LOCAL2 (STRING b)))
90 -"time -p cat file" -> (COMMAND (STRING cat) (STRING file) (time -p))
91 +"time -p cat file" -> (COMMAND (STRING cat) (STRING file) (time p))
92 "time cat file | grep search" -> (| (COMMAND (STRING cat) (STRING file) time) (COMMAND (STRING grep) (STRING search)))
93 -"time -p cat | grep asdf | a.out" -> (| (| (COMMAND (STRING cat) (time -p)) (COMMAND (STRING grep) (STRING asdf))) (COMMAND (STRING a . out)))
94 -"time -p cat file |grep search >> log" -> (| (COMMAND (STRING cat) (STRING file) (time -p)) (COMMAND (STRING grep) (STRING search) (REDIR >> (STRING log))))
95 +"time -p cat | grep asdf | a.out" -> (| (| (COMMAND (STRING cat) (time p)) (COMMAND (STRING grep) (STRING asdf))) (COMMAND (STRING a . out)))
96 +"time -p cat file |grep search >> log" -> (| (COMMAND (STRING cat) (STRING file) (time p)) (COMMAND (STRING grep) (STRING search) (REDIR >> (STRING log))))
97 "if time cat; then
98 echo \"three\"
99 fi" -> (IF_STATEMENT (if (LIST (COMMAND (STRING cat) time)) (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING three))))))
100
101 diff --git a/bashast/gunit/simp_command.gunit b/bashast/gunit/simp_command.gunit
102 index 235819c..6fb2946 100644
103 --- a/bashast/gunit/simp_command.gunit
104 +++ b/bashast/gunit/simp_command.gunit
105 @@ -24,7 +24,7 @@ simple_command:
106 "asdf=5 cat out.log > result" -> (COMMAND (STRING cat) (STRING out . log) (= asdf (STRING 5)) (REDIR > (STRING result)))
107 "cat results.log > asdf 2> /dev/null" -> (COMMAND (STRING cat) (STRING results . log) (REDIR > (STRING asdf)) (REDIR 2 > (STRING / dev / null)))
108 "i=3 g=4 h=18 grep asdf" -> (COMMAND (STRING grep) (STRING asdf) (= i (STRING 3)) (= g (STRING 4)) (= h (STRING 18)))
109 -"./configure --prefix=/usr/local" -> (COMMAND (STRING . / configure) (STRING - -p refix = / usr / local))
110 +"./configure --prefix=/usr/local" -> (COMMAND (STRING . / configure) (STRING - - prefix = / usr / local))
111 "[[while" -> (COMMAND (STRING [ [ while))
112 "./foobär" -> (COMMAND (STRING . / foob ä r))
113 "cat ~/Documents/todo.txt" -> (COMMAND (STRING cat) (STRING ~ / Documents / todo . txt))