xref: /csrg-svn/bin/sh/parser.h (revision 47140)
1*47140Sbostic /*-
2*47140Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*47140Sbostic  * All rights reserved.
4*47140Sbostic  *
5*47140Sbostic  * This code is derived from software contributed to Berkeley by
6*47140Sbostic  * Kenneth Almquist.
7*47140Sbostic  *
8*47140Sbostic  * %sccs.include.redist.c%
9*47140Sbostic  *
10*47140Sbostic  *	@(#)parser.h	5.1 (Berkeley) 03/07/91
11*47140Sbostic  */
12*47140Sbostic 
13*47140Sbostic /* control characters in argument strings */
14*47140Sbostic #define CTLESC '\201'
15*47140Sbostic #define CTLVAR '\202'
16*47140Sbostic #define CTLENDVAR '\203'
17*47140Sbostic #define CTLBACKQ '\204'
18*47140Sbostic #define CTLQUOTE 01		/* ored with CTLBACKQ code if in quotes */
19*47140Sbostic 
20*47140Sbostic /* variable substitution byte (follows CTLVAR) */
21*47140Sbostic #define VSTYPE 07		/* type of variable substitution */
22*47140Sbostic #define VSNUL 040		/* colon--treat the empty string as unset */
23*47140Sbostic #define VSQUOTE 0100		/* inside double quotes--suppress splitting */
24*47140Sbostic 
25*47140Sbostic /* values of VSTYPE field */
26*47140Sbostic #define VSNORMAL 1		/* normal variable:  $var or ${var} */
27*47140Sbostic #define VSMINUS 2		/* ${var-text} */
28*47140Sbostic #define VSPLUS 3		/* ${var+text} */
29*47140Sbostic #define VSQUESTION 4		/* ${var?message} */
30*47140Sbostic #define VSASSIGN 5		/* ${var=text} */
31*47140Sbostic 
32*47140Sbostic 
33*47140Sbostic /*
34*47140Sbostic  * NEOF is returned by parsecmd when it encounters an end of file.  It
35*47140Sbostic  * must be distinct from NULL, so we use the address of a variable that
36*47140Sbostic  * happens to be handy.
37*47140Sbostic  */
38*47140Sbostic extern int tokpushback;
39*47140Sbostic #define NEOF ((union node *)&tokpushback)
40*47140Sbostic 
41*47140Sbostic 
42*47140Sbostic #ifdef __STDC__
43*47140Sbostic union node *parsecmd(int);
44*47140Sbostic int goodname(char *);
45*47140Sbostic #else
46*47140Sbostic union node *parsecmd();
47*47140Sbostic int goodname();
48*47140Sbostic #endif
49