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