shlex.h revision 3e14f97f673e8a630f076077de35afdd43dc1587
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2010 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
#ifndef NOTSYM
/*
* UNIX shell
* Written by David Korn
* These are the definitions for the lexical analyzer
*/
#include <cdt.h>
#include "shnodes.h"
#include "shtable.h"
#include "lexstates.h"
typedef struct _shlex_
{
int token; /* current token number */
int lastline; /* last line number */
int lasttok; /* previous token number */
int digits; /* numerical value with word token */
int nonstandard; /* nonstandard construct in profile */
char aliasok; /* on when alias is legal */
char assignok; /* on when name=value is legal */
char inexec; /* on when processing exec */
char intypeset; /* on when processing typeset */
char comp_assign; /* in compound assignment */
char comsub; /* parsing command substitution */
int inlineno; /* saved value of sh.inlineno */
#if SHOPT_KIA
unsigned long script; /* script entity number */
unsigned long fscript; /* script file entity number */
unsigned long current; /* current entity number */
unsigned long unknown; /* <unknown> entity number */
char *scriptname; /* name of script file */
#endif /* SHOPT_KIA */
#ifdef _SHLEX_PRIVATE
#endif
} Lex_t;
/* symbols for parsing */
#define NL '\n'
#define NOTSYM '!'
#define SYMMASK 0170000
#define TESTUNOP 04001
#define TESTBINOP 04002
#define LABLSYM 04003
#define IOVNAME 04004
/* additional parser flag, others in <shell.h> */
#define SH_EMPTY 04
#define SH_NOIO 010
#define SH_ASSIGN 020
#define SH_FUNDEF 040
#define SH_ARRAY 0100
#if 0
typedef struct _shlex_
{
#ifdef _SHLEX_PRIVATE
#endif
} Lex_t;
#endif
extern const char e_unexpected[];
extern const char e_unmatched[];
extern const char e_endoffile[];
extern const char e_newline[];
/* odd chars */
#define LBRACE '{'
#define RBRACE '}'
#define LPAREN '('
#define RPAREN ')'
#define LBRACT '['
#define RBRACT ']'
extern void sh_lexskip(Lex_t*,int,int,int);
#if SHOPT_KIA
extern unsigned long kiaentity(Lex_t*, const char*,int,int,int,int,unsigned long,int,int,const char*);
#endif /* SHOPT_KIA */
#endif /* !NOTSYM */