xref: /titanic_51/usr/src/lib/libshell/common/data/lexstates.c (revision b3697b90e692e3e5d859fb77d285d4c056d99eda)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                  David Korn <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 #include	<ast.h>
23 
24 #include	"FEATURE/options"
25 #include	"lexstates.h"
26 
27 
28 /*
29  * This is the initial state for tokens
30  */
31 static const char sh_lexstate0[256] =
32 {
33 	S_EOF,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
34 #if SHOPT_CRNL
35 	S_REG,	0,	S_NLTOK,S_REG,	S_REG,	0,	S_REG,	S_REG,
36 #else
37 	S_REG,	0,	S_NLTOK,S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
38 #endif /* SHOPT_CRNL */
39 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
40 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
41 
42 	0,	S_REG,	S_REG,	S_COM,	S_REG,	S_REG,	S_OP,	S_REG,
43 	S_OP,	S_OP,	S_REG,	S_REG,	S_REG,	S_REG,	S_NAME,	S_REG,
44 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
45 	S_REG,	S_REG,	S_REG,	S_OP,	S_OP,	S_REG,	S_OP,	S_REG,
46 
47 	S_REG,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
48 	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
49 	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
50 	S_NAME,	S_NAME,	S_NAME,	S_REG,	S_REG,	S_REG,	S_REG,	S_NAME,
51 
52 	S_REG,	S_NAME,	S_NAME,	S_RES,	S_RES,	S_RES,	S_RES,	S_NAME,
53 #if SHOPT_NAMESPACE
54 	S_NAME,	S_RES,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_RES,	S_NAME,
55 #else
56 	S_NAME,	S_RES,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
57 #endif /* SHOPT_NAMESPACE */
58 	S_NAME,	S_NAME,	S_NAME,	S_RES,	S_RES,	S_RES,	S_NAME,	S_RES,
59 	S_NAME,	S_NAME,	S_NAME,	S_BRACE,S_OP,	S_BRACE,S_TILDE,S_REG,
60 
61 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
62 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
63 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
64 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
65 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
66 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
67 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
68 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
69 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
70 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
71 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
72 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
73 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
74 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
75 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
76 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
77 };
78 
79 /*
80  * This state is for identifiers
81  */
82 static const char sh_lexstate1[256] =
83 {
84 	S_EOF,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
85 #if SHOPT_CRNL
86 	S_REG,	S_BREAK,S_BREAK,S_REG,	S_REG,	S_BREAK,S_REG,	S_REG,
87 #else
88 	S_REG,	S_BREAK,S_BREAK,S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
89 #endif /* SHOPT_CRNL */
90 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
91 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
92 
93 	S_BREAK,S_EPAT,	S_QUOTE,S_REG,	S_DOL,	S_EPAT,	S_BREAK,S_LIT,
94 	S_BREAK,S_BREAK,S_PAT,	S_EPAT,	S_REG,	S_EPAT,	S_DOT,	S_REG,
95 	0,	0,	0,	0,	0,	0,	0,	0,
96 	0,	0,	S_LABEL,S_BREAK,S_BREAK,S_EQ,	S_BREAK,S_PAT,
97 
98 	S_EPAT,	0,	0,	0,	0,	0,	0,	0,
99 	0,	0,	0,	0,	0,	0,	0,	0,
100 	0,	0,	0,	0,	0,	0,	0,	0,
101 	0,	0,	0,	S_BRACT,S_ESC,	S_REG,	S_REG,	0,
102 
103 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
104 	0,	0,	0,	0,	0,	0,	0,	0,
105 	0,	0,	0,	0,	0,	0,	0,	0,
106 	0,	0,	0,	S_BRACE,S_BREAK,S_BRACE,S_EPAT,	S_REG,
107 
108 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
109 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
110 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
111 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
112 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
113 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
114 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
115 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
116 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
117 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
118 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
119 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
120 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
121 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
122 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
123 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
124 };
125 
126 static const char sh_lexstate2[256] =
127 {
128 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
129 #if SHOPT_CRNL
130 	0,	S_BREAK,S_BREAK,0,	0,	S_BREAK,0,	0,
131 #else
132 	0,	S_BREAK,S_BREAK,0,	0,	0,	0,	0,
133 #endif /* SHOPT_CRNL */
134 	0,	0,	0,	0,	0,	0,	0,	0,
135 	0,	0,	0,	0,	0,	0,	0,	0,
136 
137 	S_BREAK,S_EPAT,	S_QUOTE,0,	S_DOL,	S_EPAT,	S_BREAK,S_LIT,
138 	S_BREAK,S_BREAK,S_PAT,	S_EPAT,	0,	S_EPAT,	0,	0,
139 	0,	0,	0,	0,	0,	0,	0,	0,
140 	0,	0,	S_COLON,S_BREAK,S_BREAK,0,	S_BREAK,S_PAT,
141 
142 	S_EPAT,	0,	0,	0,	0,	0,	0,	0,
143 	0,	0,	0,	0,	0,	0,	0,	0,
144 	0,	0,	0,	0,	0,	0,	0,	0,
145 	0,	0,	0,	S_PAT,	S_ESC,	0,	0,	0,
146 
147 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
148 	0,	0,	0,	0,	0,	0,	0,	0,
149 	0,	0,	0,	0,	0,	0,	0,	0,
150 	0,	0,	0,	S_BRACE,S_BREAK,S_BRACE,S_EPAT,	0,
151 };
152 
153 /*
154  * for skipping over  '...'
155  */
156 static const char sh_lexstate3[256] =
157 {
158 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
159 	0,	0,	S_NL,	0,	0,	0,	0,	0,
160 	0,	0,	0,	0,	0,	0,	0,	0,
161 	0,	0,	0,	0,	0,	0,	0,	0,
162 
163 	0,	0,	0,	0,	0,	0,	0,	S_LIT,
164 	0,	0,	0,	0,	0,	0,	0,	0,
165 	0,	0,	0,	0,	0,	0,	0,	0,
166 	0,	0,	0,	0,	0,	0,	0,	0,
167 
168 	0,	0,	0,	0,	0,	0,	0,	0,
169 	0,	0,	0,	0,	0,	0,	0,	0,
170 	0,	0,	0,	0,	0,	0,	0,	0,
171 	0,	0,	0,	0,	S_ESC2,	0,	0,	0
172 };
173 
174 /*
175  * for skipping over  "..." and `...`
176  */
177 static const char sh_lexstate4[256] =
178 {
179 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
180 	0,	0,	S_NL,	0,	0,	0,	0,	0,
181 	0,	0,	0,	0,	0,	0,	0,	0,
182 	0,	0,	0,	0,	0,	0,	0,	0,
183 	0,	0,	S_QUOTE,0,	S_DOL,	0,	0,	0,
184 	0,	0,	0,	0,	0,	0,	0,	0,
185 	0,	0,	0,	0,	0,	0,	0,	0,
186 	0,	0,	0,	0,	0,	0,	0,	0,
187 	0,	0,	0,	0,	0,	0,	0,	0,
188 	0,	0,	0,	0,	0,	0,	0,	0,
189 	0,	0,	0,	0,	0,	0,	0,	0,
190 	0,	0,	0,	0,	S_ESC,	0,	0,	0,
191 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
192 	0,	0,	0,	0,	0,	0,	0,	0,
193 	0,	0,	0,	0,	0,	0,	0,	0,
194 	0,	0,	0,	0,	0,	S_RBRA,	0,	0
195 };
196 
197 /*
198  * for skipping over ?(...), [...]
199  */
200 static const char sh_lexstate5[256] =
201 {
202 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
203 	0,	S_BLNK,	S_NL,	0,	0,	0,	0,	0,
204 	0,	0,	0,	0,	0,	0,	0,	0,
205 	0,	0,	0,	0,	0,	0,	0,	0,
206 	S_BLNK,	0,	S_QUOTE,0,	S_DOL,	0,	S_META,	S_LIT,
207 	S_PUSH,	S_POP,	0,	0,	0,	0,	0,	0,
208 	0,	0,	0,	0,	0,	0,	0,	0,
209 	0,	0,	0,	S_POP,	S_META,	0,	S_META,	0,
210 	0,	0,	0,	0,	0,	0,	0,	0,
211 	0,	0,	0,	0,	0,	0,	0,	0,
212 	0,	0,	0,	0,	0,	0,	0,	0,
213 	0,	0,	0,	S_BRACT,S_ESC,	S_POP,	0,	0,
214 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
215 	0,	0,	0,	0,	0,	0,	0,	0,
216 	0,	0,	0,	0,	0,	0,	0,	0,
217 	0,	0,	0,	S_BRACE,S_META,	S_POP,	0,	0
218 };
219 
220 /*
221  * Defines valid expansion characters
222  */
223 static const char sh_lexstate6[256] =
224 {
225 	S_EOF,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
226 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
227 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
228 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
229 
230 	S_ERR,	S_SPC1,	S_ERR,	S_SPC1,	S_SPC2,	S_ERR,	S_ERR,	S_LIT,
231 	S_PAR,	S_ERR,	S_SPC2,	S_ERR,	S_ERR,	S_SPC2,	S_ALP,	S_ERR,
232 	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,
233 	S_DIG,	S_DIG,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_SPC2,
234 
235 #if SHOPT_TYPEDEF
236 	S_SPC1,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
237 #else
238 	S_SPC2,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
239 #endif
240 	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
241 	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
242 	S_ALP,	S_ALP,	S_ALP,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ALP,
243 
244 	S_ERR,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
245 	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
246 	S_ALP,	S_ALP,	S_ALP,	S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ERR,	S_ERR,	S_ERR,
265 };
266 
267 /*
268  * for skipping over ${...} until modifier
269  */
270 static const char sh_lexstate7[256] =
271 {
272 	S_EOF,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
273 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
274 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
275 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
276 
277 	S_ERR,	S_ERR,	S_ERR,	S_MOD2,	S_ERR,	S_MOD2,	S_ERR,	S_ERR,
278 	S_ERR,	S_ERR,	S_MOD1,	S_MOD1,	S_ERR,	S_MOD1,	S_DOT,	S_MOD2,
279 	0,	0,	0,	0,	0,	0,	0,	0,
280 	0,	0,	S_MOD1,	S_ERR,	S_ERR,	S_MOD1,	S_ERR,	S_MOD1,
281 
282 	0,	0,	0,	0,	0,	0,	0,	0,
283 	0,	0,	0,	0,	0,	0,	0,	0,
284 	0,	0,	0,	0,	0,	0,	0,	0,
285 	0,	0,	0,	S_BRACT,S_ESC,	S_ERR,	S_ERR,	0,
286 
287 	S_ERR,	0,	0,	0,	0,	0,	0,	0,
288 	0,	0,	0,	0,	0,	0,	0,	0,
289 	0,	0,	0,	0,	0,	0,	0,	0,
290 	0,	0,	0,	S_ERR,	S_ERR,	S_POP,	S_ERR,	S_ERR,
291 
292 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
293 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
294 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
295 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
296 	S_ER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OL,
343 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
344 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
345 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
346 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
347 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
348 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
349 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
350 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
351 };
352 
353 /*
354  * This is used for macro expansion
355  */
356 static const char sh_lexstate9[256] =
357 {
358 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
359 	0,	0,	0,	0,	0,	0,	0,	0,
360 	0,	0,	0,	0,	0,	0,	0,	0,
361 	0,	0,	0,	0,	0,	0,	0,	0,
362 	0,	0,	S_QUOTE,0,	S_DOL,	0,	S_PAT,	S_LIT,
363 	S_PAT,	S_PAT,	S_PAT,	0,	S_COM,	0,	S_DOT,	S_SLASH,
364 	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,
365 	S_DIG,	S_DIG,	S_COLON,0,	0,	S_EQ,	0,	S_PAT,
366 	0,	0,	0,	0,	0,	0,	0,	0,
367 	0,	0,	0,	0,	0,	0,	0,	0,
368 	0,	0,	0,	0,	0,	0,	0,	0,
369 	0,	0,	0,	S_BRACT,S_ESC,	S_ENDCH,0,	0,
370 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
371 	0,	0,	0,	0,	0,	0,	0,	0,
372 	0,	0,	0,	0,	0,	0,	0,	0,
373 #if SHOPT_BRACEPAT
374 	0,	0,	0,	S_BRACE,S_PAT,	S_ENDCH,0,	0
375 #else
376 	0,	0,	0,	0,	S_PAT,	S_ENDCH,0,	0
377 #endif /* SHOPT_BRACEPAT */
378 };
379 
380 const char *sh_lexrstates[ST_NONE] =
381 {
382 	sh_lexstate0, sh_lexstate1, sh_lexstate2, sh_lexstate3,
383 	sh_lexstate4, sh_lexstate5, sh_lexstate6, sh_lexstate7,
384 	sh_lexstate8, sh_lexstate9, sh_lexstate5
385 };
386 
387 
388 const char e_lexversion[]	= "%d: invalid binary script version";
389 const char e_lexspace[]		= "line %d: use space or tab to separate operators %c and %c";
390 const char e_lexslash[]		= "line %d: $ not preceded by \\";
391 const char e_lexsyntax1[]	= "syntax error at line %d: `%s' %s";
392 const char e_lexsyntax2[]	= "syntax error: `%s' %s";
393 const char e_lexsyntax3[]	= "syntax error at line %d: duplicate label %s";
394 const char e_lexlabignore[]	= "line %d: label %s ignored";
395 const char e_lexlabunknown[]	= "line %d: %s unknown label";
396 const char e_lexobsolete1[]	= "line %d: `...` obsolete, use $(...)";
397 const char e_lexobsolete2[]	= "line %d: -a obsolete, use -e";
398 const char e_lexobsolete3[]	= "line %d: '=' obsolete, use '=='";
399 const char e_lexobsolete4[]	= "line %d: %s within [[...]] obsolete, use ((...))";
400 const char e_lexobsolete5[]	= "line %d: set %s obsolete";
401 const char e_lexobsolete6[]	= "line %d: `{' instead of `in' is obsolete";
402 const char e_lexnonstandard[]	= "line %d: `&>file' is nonstandard -- interpreted as `>file 2>&1' for profile input only";
403 const char e_lexusebrace[]	= "line %d: use braces to avoid ambiguities with $id[...]";
404 const char e_lexusequote[]	= "line %d: %c within ${} should be quoted";
405 const char e_lexescape[]	= "line %d: escape %c to avoid ambiguities";
406 const char e_lexquote[]		= "line %d: quote %c to avoid ambiguities";
407 const char e_lexnested[]	= "line %d: spaces required for nested subshell";
408 const char e_lexbadchar[]	= "%c: invalid character in expression - %s";
409 const char e_lexfuture[]	= "line %d: \\ in front of %c reserved for future use";
410 const char e_lexlongquote[]	= "line %d: %c quote may be missing";
411 const char e_lexzerobyte[]	= "zero byte";
412 const char e_lexemptyfor[]	= "line %d: empty for list";
413 const char e_lextypeset[]	= "line %d: %s invalid typeset option order";
414