xref: /onnv-gate/usr/src/lib/libshell/common/data/lexstates.c (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                  David Korn <dgk@research.att.com>                   *
184887Schin *                                                                      *
194887Schin ***********************************************************************/
204887Schin #pragma prototyped
214887Schin 
224887Schin #include	<ast.h>
234887Schin 
244887Schin #include	"FEATURE/options"
254887Schin #include	"lexstates.h"
264887Schin 
274887Schin 
284887Schin /*
294887Schin  * This is the initial state for tokens
304887Schin  */
314887Schin static const char sh_lexstate0[256] =
324887Schin {
334887Schin 	S_EOF,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
344887Schin #if SHOPT_CRNL
354887Schin 	S_REG,	0,	S_NLTOK,S_REG,	S_REG,	0,	S_REG,	S_REG,
364887Schin #else
374887Schin 	S_REG,	0,	S_NLTOK,S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
384887Schin #endif /* SHOPT_CRNL */
394887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
404887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
414887Schin 
424887Schin 	0,	S_REG,	S_REG,	S_COM,	S_REG,	S_REG,	S_OP,	S_REG,
434887Schin 	S_OP,	S_OP,	S_REG,	S_REG,	S_REG,	S_REG,	S_NAME,	S_REG,
444887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
454887Schin 	S_REG,	S_REG,	S_REG,	S_OP,	S_OP,	S_REG,	S_OP,	S_REG,
464887Schin 
474887Schin 	S_REG,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
484887Schin 	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
494887Schin 	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
504887Schin 	S_NAME,	S_NAME,	S_NAME,	S_REG,	S_REG,	S_REG,	S_REG,	S_NAME,
514887Schin 
524887Schin 	S_REG,	S_NAME,	S_NAME,	S_RES,	S_RES,	S_RES,	S_RES,	S_NAME,
534887Schin #if SHOPT_NAMESPACE
544887Schin 	S_NAME,	S_RES,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_RES,	S_NAME,
554887Schin #else
564887Schin 	S_NAME,	S_RES,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,	S_NAME,
574887Schin #endif /* SHOPT_NAMESPACE */
584887Schin 	S_NAME,	S_NAME,	S_NAME,	S_RES,	S_RES,	S_RES,	S_NAME,	S_RES,
598462SApril.Chin@Sun.COM 	S_NAME,	S_NAME,	S_NAME,	S_BRACE,S_OP,	S_BRACE,S_TILDE,S_REG,
604887Schin 
614887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
624887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
634887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
644887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
654887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
664887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
674887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
684887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
694887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
704887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
714887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
724887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
734887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
744887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
754887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
764887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
774887Schin };
784887Schin 
794887Schin /*
804887Schin  * This state is for identifiers
814887Schin  */
824887Schin static const char sh_lexstate1[256] =
834887Schin {
844887Schin 	S_EOF,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
854887Schin #if SHOPT_CRNL
864887Schin 	S_REG,	S_BREAK,S_BREAK,S_REG,	S_REG,	S_BREAK,S_REG,	S_REG,
874887Schin #else
884887Schin 	S_REG,	S_BREAK,S_BREAK,S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
894887Schin #endif /* SHOPT_CRNL */
904887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
914887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
924887Schin 
934887Schin 	S_BREAK,S_EPAT,	S_QUOTE,S_REG,	S_DOL,	S_EPAT,	S_BREAK,S_LIT,
944887Schin 	S_BREAK,S_BREAK,S_PAT,	S_EPAT,	S_REG,	S_EPAT,	S_DOT,	S_REG,
954887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
964887Schin 	0,	0,	S_LABEL,S_BREAK,S_BREAK,S_EQ,	S_BREAK,S_PAT,
974887Schin 
984887Schin 	S_EPAT,	0,	0,	0,	0,	0,	0,	0,
994887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1004887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1014887Schin 	0,	0,	0,	S_BRACT,S_ESC,	S_REG,	S_REG,	0,
1024887Schin 
1034887Schin 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
1044887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1054887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1064887Schin 	0,	0,	0,	S_BRACE,S_BREAK,S_BRACE,S_EPAT,	S_REG,
1074887Schin 
1084887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1094887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1104887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1114887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1124887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1134887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1144887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1154887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1164887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1174887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1184887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1194887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1204887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1214887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1224887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1234887Schin 	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,	S_REG,
1244887Schin };
1254887Schin 
1264887Schin static const char sh_lexstate2[256] =
1274887Schin {
1284887Schin 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
1294887Schin #if SHOPT_CRNL
1304887Schin 	0,	S_BREAK,S_BREAK,0,	0,	S_BREAK,0,	0,
1314887Schin #else
1324887Schin 	0,	S_BREAK,S_BREAK,0,	0,	0,	0,	0,
1334887Schin #endif /* SHOPT_CRNL */
1344887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1354887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1364887Schin 
1374887Schin 	S_BREAK,S_EPAT,	S_QUOTE,0,	S_DOL,	S_EPAT,	S_BREAK,S_LIT,
1384887Schin 	S_BREAK,S_BREAK,S_PAT,	S_EPAT,	0,	S_EPAT,	0,	0,
1394887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1404887Schin 	0,	0,	S_COLON,S_BREAK,S_BREAK,0,	S_BREAK,S_PAT,
1414887Schin 
1424887Schin 	S_EPAT,	0,	0,	0,	0,	0,	0,	0,
1434887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1444887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1454887Schin 	0,	0,	0,	S_PAT,	S_ESC,	0,	0,	0,
1464887Schin 
1474887Schin 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
1484887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1494887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1504887Schin 	0,	0,	0,	S_BRACE,S_BREAK,S_BRACE,S_EPAT,	0,
1514887Schin };
1524887Schin 
1534887Schin /*
1544887Schin  * for skipping over  '...'
1554887Schin  */
1564887Schin static const char sh_lexstate3[256] =
1574887Schin {
1584887Schin 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
1594887Schin 	0,	0,	S_NL,	0,	0,	0,	0,	0,
1604887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1614887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1624887Schin 
1634887Schin 	0,	0,	0,	0,	0,	0,	0,	S_LIT,
1644887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1654887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1664887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1674887Schin 
1684887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1694887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1704887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1714887Schin 	0,	0,	0,	0,	S_ESC2,	0,	0,	0
1724887Schin };
1734887Schin 
1744887Schin /*
1754887Schin  * for skipping over  "..." and `...`
1764887Schin  */
1774887Schin static const char sh_lexstate4[256] =
1784887Schin {
1794887Schin 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
1804887Schin 	0,	0,	S_NL,	0,	0,	0,	0,	0,
1814887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1824887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1834887Schin 	0,	0,	S_QUOTE,0,	S_DOL,	0,	0,	0,
1844887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1854887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1864887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1874887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1884887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1894887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1904887Schin 	0,	0,	0,	0,	S_ESC,	0,	0,	0,
1914887Schin 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
1924887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1934887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
1944887Schin 	0,	0,	0,	0,	0,	S_RBRA,	0,	0
1954887Schin };
1964887Schin 
1974887Schin /*
1984887Schin  * for skipping over ?(...), [...]
1994887Schin  */
2004887Schin static const char sh_lexstate5[256] =
2014887Schin {
2024887Schin 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
2034887Schin 	0,	S_BLNK,	S_NL,	0,	0,	0,	0,	0,
2044887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2054887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2064887Schin 	S_BLNK,	0,	S_QUOTE,0,	S_DOL,	0,	S_META,	S_LIT,
2074887Schin 	S_PUSH,	S_POP,	0,	0,	0,	0,	0,	0,
2084887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2094887Schin 	0,	0,	0,	S_POP,	S_META,	0,	S_META,	0,
2104887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2114887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2124887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2134887Schin 	0,	0,	0,	S_BRACT,S_ESC,	S_POP,	0,	0,
2144887Schin 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
2154887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2164887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2174887Schin 	0,	0,	0,	S_BRACE,S_META,	S_POP,	0,	0
2184887Schin };
2194887Schin 
2204887Schin /*
2214887Schin  * Defines valid expansion characters
2224887Schin  */
2234887Schin static const char sh_lexstate6[256] =
2244887Schin {
2254887Schin 	S_EOF,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2264887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2274887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2284887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2294887Schin 
2304887Schin 	S_ERR,	S_SPC1,	S_ERR,	S_SPC1,	S_SPC2,	S_ERR,	S_ERR,	S_LIT,
2314887Schin 	S_PAR,	S_ERR,	S_SPC2,	S_ERR,	S_ERR,	S_SPC2,	S_ALP,	S_ERR,
2324887Schin 	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,
2334887Schin 	S_DIG,	S_DIG,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_SPC2,
2344887Schin 
2354887Schin #if SHOPT_TYPEDEF
2364887Schin 	S_SPC1,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
2374887Schin #else
2384887Schin 	S_SPC2,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
2394887Schin #endif
2404887Schin 	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
2414887Schin 	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
2424887Schin 	S_ALP,	S_ALP,	S_ALP,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ALP,
2434887Schin 
2444887Schin 	S_ERR,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,	S_ALP,
2454887Schin 	S_ALP,	S_ALP,	S_ALP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ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2634887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2644887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2654887Schin };
2664887Schin 
2674887Schin /*
2684887Schin  * for skipping over ${...} until modifier
2694887Schin  */
2704887Schin static const char sh_lexstate7[256] =
2714887Schin {
2724887Schin 	S_EOF,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2734887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2744887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2754887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2764887Schin 
2774887Schin 	S_ERR,	S_ERR,	S_ERR,	S_MOD2,	S_ERR,	S_MOD2,	S_ERR,	S_ERR,
2784887Schin 	S_ERR,	S_ERR,	S_MOD1,	S_MOD1,	S_ERR,	S_MOD1,	S_DOT,	S_MOD2,
2794887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2804887Schin 	0,	0,	S_MOD1,	S_ERR,	S_ERR,	S_MOD1,	S_ERR,	S_MOD1,
2814887Schin 
2824887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2834887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2844887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2854887Schin 	0,	0,	0,	S_BRACT,S_ESC,	S_ERR,	S_ERR,	0,
2864887Schin 
2874887Schin 	S_ERR,	0,	0,	0,	0,	0,	0,	0,
2884887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2894887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
2904887Schin 	0,	0,	0,	S_ERR,	S_ERR,	S_POP,	S_ERR,	S_ERR,
2914887Schin 
2924887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2934887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2944887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2954887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2964887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2974887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2984887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
2994887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3004887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3014887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3024887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3034887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3044887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3054887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3064887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3074887Schin 	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,	S_ERR,
3084887Schin };
3094887Schin 
3104887Schin /*
3114887Schin  * This state is for $name
3124887Schin  */
3134887Schin static const char sh_lexstate8[256] =
3144887Schin {
3154887Schin 	S_EOF,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3164887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3174887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3184887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3194887Schin 
3204887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3214887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3224887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3234887Schin 	0,	0,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3244887Schin 
3254887Schin 	S_EDOL,	0,	0,	0,	0,	0,	0,	0,
3264887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3274887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3284887Schin 	0,	0,	0,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	0,
3294887Schin 
3304887Schin 	S_EDOL,0,	0,	0,	0,	0,	0,	0,
3314887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3324887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3334887Schin 	0,	0,	0,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3344887Schin 
3354887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S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_EDOL,	S_EDOL,	S_EDOL,
3504887Schin 	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,	S_EDOL,
3514887Schin };
3524887Schin 
3534887Schin /*
3544887Schin  * This is used for macro expansion
3554887Schin  */
3564887Schin static const char sh_lexstate9[256] =
3574887Schin {
3584887Schin 	S_EOF,	0,	0,	0,	0,	0,	0,	0,
3594887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3604887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3614887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3624887Schin 	0,	0,	S_QUOTE,0,	S_DOL,	0,	S_PAT,	S_LIT,
3638462SApril.Chin@Sun.COM 	S_PAT,	S_PAT,	S_PAT,	0,	S_COM,	0,	S_DOT,	S_SLASH,
3648462SApril.Chin@Sun.COM 	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,	S_DIG,
3654887Schin 	S_DIG,	S_DIG,	S_COLON,0,	0,	S_EQ,	0,	S_PAT,
3664887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3674887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3684887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3694887Schin 	0,	0,	0,	S_BRACT,S_ESC,	S_ENDCH,0,	0,
3704887Schin 	S_GRAVE,0,	0,	0,	0,	0,	0,	0,
3714887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3724887Schin 	0,	0,	0,	0,	0,	0,	0,	0,
3734887Schin #if SHOPT_BRACEPAT
3744887Schin 	0,	0,	0,	S_BRACE,S_PAT,	S_ENDCH,0,	0
3754887Schin #else
3764887Schin 	0,	0,	0,	0,	S_PAT,	S_ENDCH,0,	0
3774887Schin #endif /* SHOPT_BRACEPAT */
3784887Schin };
3794887Schin 
3804887Schin const char *sh_lexrstates[ST_NONE] =
3814887Schin {
3824887Schin 	sh_lexstate0, sh_lexstate1, sh_lexstate2, sh_lexstate3,
3834887Schin 	sh_lexstate4, sh_lexstate5, sh_lexstate6, sh_lexstate7,
3844887Schin 	sh_lexstate8, sh_lexstate9, sh_lexstate5
3854887Schin };
3864887Schin 
3874887Schin 
3884887Schin const char e_lexversion[]	= "%d: invalid binary script version";
3894887Schin const char e_lexspace[]		= "line %d: use space or tab to separate operators %c and %c";
390*12068SRoger.Faulkner@Oracle.COM const char e_lexslash[]		= "line %d: $ not preceded by \\";
3914887Schin const char e_lexsyntax1[]	= "syntax error at line %d: `%s' %s";
3924887Schin const char e_lexsyntax2[]	= "syntax error: `%s' %s";
3934887Schin const char e_lexsyntax3[]	= "syntax error at line %d: duplicate label %s";
3944887Schin const char e_lexlabignore[]	= "line %d: label %s ignored";
3954887Schin const char e_lexlabunknown[]	= "line %d: %s unknown label";
3964887Schin const char e_lexobsolete1[]	= "line %d: `...` obsolete, use $(...)";
3974887Schin const char e_lexobsolete2[]	= "line %d: -a obsolete, use -e";
3984887Schin const char e_lexobsolete3[]	= "line %d: '=' obsolete, use '=='";
3994887Schin const char e_lexobsolete4[]	= "line %d: %s within [[...]] obsolete, use ((...))";
4004887Schin const char e_lexobsolete5[]	= "line %d: set %s obsolete";
4014887Schin const char e_lexobsolete6[]	= "line %d: `{' instead of `in' is obsolete";
40210898Sroland.mainz@nrubsig.org const char e_lexnonstandard[]	= "line %d: `&>file' is nonstandard -- interpreted as `>file 2>&1' for profile input only";
4034887Schin const char e_lexusebrace[]	= "line %d: use braces to avoid ambiguities with $id[...]";
4044887Schin const char e_lexusequote[]	= "line %d: %c within ${} should be quoted";
4054887Schin const char e_lexescape[]	= "line %d: escape %c to avoid ambiguities";
4064887Schin const char e_lexquote[]		= "line %d: quote %c to avoid ambiguities";
4074887Schin const char e_lexnested[]	= "line %d: spaces required for nested subshell";
4084887Schin const char e_lexbadchar[]	= "%c: invalid character in expression - %s";
4094887Schin const char e_lexfuture[]	= "line %d: \\ in front of %c reserved for future use";
4104887Schin const char e_lexlongquote[]	= "line %d: %c quote may be missing";
4114887Schin const char e_lexzerobyte[]	= "zero byte";
4124887Schin const char e_lexemptyfor[]	= "line %d: empty for list";
4138462SApril.Chin@Sun.COM const char e_lextypeset[]	= "line %d: %s invalid typeset option order";
414