xref: /csrg-svn/bin/sh/parser.h (revision 53303)
147140Sbostic /*-
247140Sbostic  * Copyright (c) 1991 The Regents of the University of California.
347140Sbostic  * All rights reserved.
447140Sbostic  *
547140Sbostic  * This code is derived from software contributed to Berkeley by
647140Sbostic  * Kenneth Almquist.
747140Sbostic  *
847140Sbostic  * %sccs.include.redist.c%
947140Sbostic  *
10*53303Smarc  *	@(#)parser.h	5.2 (Berkeley) 04/30/92
1147140Sbostic  */
1247140Sbostic 
1347140Sbostic /* control characters in argument strings */
1447140Sbostic #define CTLESC '\201'
1547140Sbostic #define CTLVAR '\202'
1647140Sbostic #define CTLENDVAR '\203'
1747140Sbostic #define CTLBACKQ '\204'
1847140Sbostic #define CTLQUOTE 01		/* ored with CTLBACKQ code if in quotes */
19*53303Smarc /*	CTLBACKQ | CTLQUOTE == '\205' */
20*53303Smarc #define	CTLARI	'\206'
21*53303Smarc #define	CTLENDARI '\207'
2247140Sbostic 
2347140Sbostic /* variable substitution byte (follows CTLVAR) */
2447140Sbostic #define VSTYPE 07		/* type of variable substitution */
2547140Sbostic #define VSNUL 040		/* colon--treat the empty string as unset */
2647140Sbostic #define VSQUOTE 0100		/* inside double quotes--suppress splitting */
2747140Sbostic 
2847140Sbostic /* values of VSTYPE field */
2947140Sbostic #define VSNORMAL 1		/* normal variable:  $var or ${var} */
3047140Sbostic #define VSMINUS 2		/* ${var-text} */
3147140Sbostic #define VSPLUS 3		/* ${var+text} */
3247140Sbostic #define VSQUESTION 4		/* ${var?message} */
3347140Sbostic #define VSASSIGN 5		/* ${var=text} */
3447140Sbostic 
3547140Sbostic 
3647140Sbostic /*
3747140Sbostic  * NEOF is returned by parsecmd when it encounters an end of file.  It
3847140Sbostic  * must be distinct from NULL, so we use the address of a variable that
3947140Sbostic  * happens to be handy.
4047140Sbostic  */
4147140Sbostic extern int tokpushback;
4247140Sbostic #define NEOF ((union node *)&tokpushback)
4347140Sbostic 
4447140Sbostic 
4547140Sbostic #ifdef __STDC__
4647140Sbostic union node *parsecmd(int);
4747140Sbostic int goodname(char *);
4847140Sbostic #else
4947140Sbostic union node *parsecmd();
5047140Sbostic int goodname();
5147140Sbostic #endif
52