lexstates.c revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include <ast.h>
#include "lexstates.h"
/*
* This is the initial state for tokens
*/
static const char sh_lexstate0[256] =
{
#if SHOPT_CRNL
#else
#endif /* SHOPT_CRNL */
#if SHOPT_NAMESPACE
#else
#endif /* SHOPT_NAMESPACE */
};
/*
* This state is for identifiers
*/
static const char sh_lexstate1[256] =
{
#if SHOPT_CRNL
#else
#endif /* SHOPT_CRNL */
0, 0, 0, 0, 0, 0, 0, 0,
S_EPAT, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_GRAVE,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
static const char sh_lexstate2[256] =
{
S_EOF, 0, 0, 0, 0, 0, 0, 0,
#if SHOPT_CRNL
#else
#endif /* SHOPT_CRNL */
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_EPAT, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_GRAVE,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
/*
* for skipping over '...'
*/
static const char sh_lexstate3[256] =
{
S_EOF, 0, 0, 0, 0, 0, 0, 0,
0, 0, S_NL, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, S_LIT,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, S_ESC2, 0, 0, 0
};
/*
* for skipping over "..." and `...`
*/
static const char sh_lexstate4[256] =
{
S_EOF, 0, 0, 0, 0, 0, 0, 0,
0, 0, S_NL, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, S_ESC, 0, 0, 0,
S_GRAVE,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, S_RBRA, 0, 0
};
/*
* for skipping over ?(...), [...]
*/
static const char sh_lexstate5[256] =
{
S_EOF, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_GRAVE,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
/*
* Defines valid expansion characters
*/
static const char sh_lexstate6[256] =
{
#if SHOPT_TYPEDEF
#else
#endif
};
/*
* for skipping over ${...} until modifier
*/
static const char sh_lexstate7[256] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_ERR, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
/*
* This state is for $name
*/
static const char sh_lexstate8[256] =
{
0, 0, 0, 0, 0, 0, 0, 0,
S_EDOL, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_EDOL,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
/*
* This is used for macro expansion
*/
static const char sh_lexstate9[256] =
{
S_EOF, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
S_GRAVE,0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
#if SHOPT_BRACEPAT
#else
#endif /* SHOPT_BRACEPAT */
};
const char *sh_lexrstates[ST_NONE] =
{
};
const char e_lexversion[] = "%d: invalid binary script version";
const char e_lexspace[] = "line %d: use space or tab to separate operators %c and %c";
const char e_lexslash[] = "line %d: $ not preceeded by \\";
const char e_lexsyntax1[] = "syntax error at line %d: `%s' %s";
const char e_lexsyntax2[] = "syntax error: `%s' %s";
const char e_lexsyntax3[] = "syntax error at line %d: duplicate label %s";
const char e_lexlabignore[] = "line %d: label %s ignored";
const char e_lexlabunknown[] = "line %d: %s unknown label";
const char e_lexobsolete1[] = "line %d: `...` obsolete, use $(...)";
const char e_lexobsolete2[] = "line %d: -a obsolete, use -e";
const char e_lexobsolete3[] = "line %d: '=' obsolete, use '=='";
const char e_lexobsolete4[] = "line %d: %s within [[...]] obsolete, use ((...))";
const char e_lexobsolete5[] = "line %d: set %s obsolete";
const char e_lexobsolete6[] = "line %d: `{' instead of `in' is obsolete";
const char e_lexnonstandard[] = "line %d: `&>file' is nonstandard -- interpreted as `>file 2>&1' for profile input only";
const char e_lexusebrace[] = "line %d: use braces to avoid ambiguities with $id[...]";
const char e_lexusequote[] = "line %d: %c within ${} should be quoted";
const char e_lexescape[] = "line %d: escape %c to avoid ambiguities";
const char e_lexquote[] = "line %d: quote %c to avoid ambiguities";
const char e_lexnested[] = "line %d: spaces required for nested subshell";
const char e_lexbadchar[] = "%c: invalid character in expression - %s";
const char e_lexfuture[] = "line %d: \\ in front of %c reserved for future use";
const char e_lexlongquote[] = "line %d: %c quote may be missing";
const char e_lexzerobyte[] = "zero byte";
const char e_lexemptyfor[] = "line %d: empty for list";
const char e_lextypeset[] = "line %d: %s invalid typeset option order";