xref: /freebsd/usr.bin/rpcgen/rpc_scan.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
14e115012SGarrett Wollman /*
240ad8885SAlfred Perlstein  */
340ad8885SAlfred Perlstein /*
44e115012SGarrett Wollman  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
54e115012SGarrett Wollman  * unrestricted use provided that this legend is included on all tape
64e115012SGarrett Wollman  * media and as a part of the software program in whole or part.  Users
74e115012SGarrett Wollman  * may copy or modify Sun RPC without charge, but are not authorized
84e115012SGarrett Wollman  * to license or distribute it to anyone else except as part of a product or
94e115012SGarrett Wollman  * program developed by the user.
104e115012SGarrett Wollman  *
114e115012SGarrett Wollman  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
124e115012SGarrett Wollman  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
134e115012SGarrett Wollman  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
144e115012SGarrett Wollman  *
154e115012SGarrett Wollman  * Sun RPC is provided with no support and without any obligation on the
164e115012SGarrett Wollman  * part of Sun Microsystems, Inc. to assist in its use, correction,
174e115012SGarrett Wollman  * modification or enhancement.
184e115012SGarrett Wollman  *
194e115012SGarrett Wollman  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
204e115012SGarrett Wollman  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
214e115012SGarrett Wollman  * OR ANY PART THEREOF.
224e115012SGarrett Wollman  *
234e115012SGarrett Wollman  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
244e115012SGarrett Wollman  * or profits or other special, indirect and consequential damages, even if
254e115012SGarrett Wollman  * Sun has been advised of the possibility of such damages.
264e115012SGarrett Wollman  *
274e115012SGarrett Wollman  * Sun Microsystems, Inc.
284e115012SGarrett Wollman  * 2550 Garcia Avenue
294e115012SGarrett Wollman  * Mountain View, California  94043
304e115012SGarrett Wollman  */
31ff49530fSBill Paul /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
32ff49530fSBill Paul /*	  All Rights Reserved  	*/
33ff49530fSBill Paul 
34ff49530fSBill Paul /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
35ff49530fSBill Paul /*	The copyright notice above does not evidence any   	*/
36ff49530fSBill Paul /*	actual or intended publication of such source code.	*/
37ff49530fSBill Paul 
38ff49530fSBill Paul 
39ff49530fSBill Paul 
40ff49530fSBill Paul /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41ff49530fSBill Paul *	PROPRIETARY NOTICE (Combined)
42ff49530fSBill Paul *
43ff49530fSBill Paul * This source code is unpublished proprietary information
44ff49530fSBill Paul * constituting, or derived under license from AT&T's UNIX(r) System V.
45ff49530fSBill Paul * In addition, portions of such source code were derived from Berkeley
46ff49530fSBill Paul * 4.3 BSD under license from the Regents of the University of
47ff49530fSBill Paul * California.
48ff49530fSBill Paul *
49ff49530fSBill Paul *
50ff49530fSBill Paul *
51ff49530fSBill Paul *	Copyright Notice
52ff49530fSBill Paul *
53ff49530fSBill Paul * Notice of copyright on this source code product does not indicate
54ff49530fSBill Paul *  publication.
55ff49530fSBill Paul *
56ff49530fSBill Paul *	(c) 1986,1987,1988.1989  Sun Microsystems, Inc
57ff49530fSBill Paul *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
58ff49530fSBill Paul *          All rights reserved.
59ff49530fSBill Paul */
60ff49530fSBill Paul 
614e115012SGarrett Wollman /*
624e115012SGarrett Wollman  * rpc_scan.h, Definitions for the RPCL scanner
634e115012SGarrett Wollman  */
644e115012SGarrett Wollman 
654e115012SGarrett Wollman /*
664e115012SGarrett Wollman  * kinds of tokens
674e115012SGarrett Wollman  */
684e115012SGarrett Wollman enum tok_kind {
694e115012SGarrett Wollman 	TOK_IDENT,
70ff49530fSBill Paul 	TOK_CHARCONST,
714e115012SGarrett Wollman 	TOK_STRCONST,
724e115012SGarrett Wollman 	TOK_LPAREN,
734e115012SGarrett Wollman 	TOK_RPAREN,
744e115012SGarrett Wollman 	TOK_LBRACE,
754e115012SGarrett Wollman 	TOK_RBRACE,
764e115012SGarrett Wollman 	TOK_LBRACKET,
774e115012SGarrett Wollman 	TOK_RBRACKET,
784e115012SGarrett Wollman 	TOK_LANGLE,
794e115012SGarrett Wollman 	TOK_RANGLE,
804e115012SGarrett Wollman 	TOK_STAR,
814e115012SGarrett Wollman 	TOK_COMMA,
824e115012SGarrett Wollman 	TOK_EQUAL,
834e115012SGarrett Wollman 	TOK_COLON,
844e115012SGarrett Wollman 	TOK_SEMICOLON,
854e115012SGarrett Wollman 	TOK_CONST,
864e115012SGarrett Wollman 	TOK_STRUCT,
874e115012SGarrett Wollman 	TOK_UNION,
884e115012SGarrett Wollman 	TOK_SWITCH,
894e115012SGarrett Wollman 	TOK_CASE,
904e115012SGarrett Wollman 	TOK_DEFAULT,
914e115012SGarrett Wollman 	TOK_ENUM,
924e115012SGarrett Wollman 	TOK_TYPEDEF,
934e115012SGarrett Wollman 	TOK_INT,
944e115012SGarrett Wollman 	TOK_SHORT,
954e115012SGarrett Wollman 	TOK_LONG,
96ff49530fSBill Paul 	TOK_HYPER,
974e115012SGarrett Wollman 	TOK_UNSIGNED,
984e115012SGarrett Wollman 	TOK_FLOAT,
994e115012SGarrett Wollman 	TOK_DOUBLE,
100ff49530fSBill Paul 	TOK_QUAD,
1014e115012SGarrett Wollman 	TOK_OPAQUE,
1024e115012SGarrett Wollman 	TOK_CHAR,
1034e115012SGarrett Wollman 	TOK_STRING,
1044e115012SGarrett Wollman 	TOK_BOOL,
1054e115012SGarrett Wollman 	TOK_VOID,
1064e115012SGarrett Wollman 	TOK_PROGRAM,
1074e115012SGarrett Wollman 	TOK_VERSION,
1084e115012SGarrett Wollman 	TOK_EOF
1094e115012SGarrett Wollman };
1104e115012SGarrett Wollman typedef enum tok_kind tok_kind;
1114e115012SGarrett Wollman 
1124e115012SGarrett Wollman /*
1134e115012SGarrett Wollman  * a token
1144e115012SGarrett Wollman  */
1154e115012SGarrett Wollman struct token {
1164e115012SGarrett Wollman 	tok_kind kind;
117e390e3afSDavid Malone 	const char *str;
1184e115012SGarrett Wollman };
1194e115012SGarrett Wollman typedef struct token token;
1204e115012SGarrett Wollman 
1214e115012SGarrett Wollman 
1224e115012SGarrett Wollman /*
1234e115012SGarrett Wollman  * routine interface
1244e115012SGarrett Wollman  */
125d0cc804bSStefan Farfeleder void scan(tok_kind expect, token *tokp);
126d0cc804bSStefan Farfeleder void scan2(tok_kind expect1, tok_kind expect2, token *tokp);
127d0cc804bSStefan Farfeleder void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp);
128d0cc804bSStefan Farfeleder void scan_num(token *tokp);
129d0cc804bSStefan Farfeleder void peek(token *tokp);
130d0cc804bSStefan Farfeleder int peekscan(tok_kind expect, token *tokp);
131d0cc804bSStefan Farfeleder void get_token(token *tokp);
132