xref: /freebsd/usr.bin/rpcgen/rpc_scan.h (revision edf8578117e8844e02c0121147f45e4609b30680)
1 /*
2  */
3 /*
4  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5  * unrestricted use provided that this legend is included on all tape
6  * media and as a part of the software program in whole or part.  Users
7  * may copy or modify Sun RPC without charge, but are not authorized
8  * to license or distribute it to anyone else except as part of a product or
9  * program developed by the user.
10  *
11  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14  *
15  * Sun RPC is provided with no support and without any obligation on the
16  * part of Sun Microsystems, Inc. to assist in its use, correction,
17  * modification or enhancement.
18  *
19  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21  * OR ANY PART THEREOF.
22  *
23  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24  * or profits or other special, indirect and consequential damages, even if
25  * Sun has been advised of the possibility of such damages.
26  *
27  * Sun Microsystems, Inc.
28  * 2550 Garcia Avenue
29  * Mountain View, California  94043
30  */
31 /* #pragma ident   "@(#)rpc_scan.h 1.11     94/05/15 SMI" */
32 
33 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
34 /*	  All Rights Reserved  	*/
35 
36 /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
37 /*	The copyright notice above does not evidence any   	*/
38 /*	actual or intended publication of such source code.	*/
39 
40 
41 
42 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43 *	PROPRIETARY NOTICE (Combined)
44 *
45 * This source code is unpublished proprietary information
46 * constituting, or derived under license from AT&T's UNIX(r) System V.
47 * In addition, portions of such source code were derived from Berkeley
48 * 4.3 BSD under license from the Regents of the University of
49 * California.
50 *
51 *
52 *
53 *	Copyright Notice
54 *
55 * Notice of copyright on this source code product does not indicate
56 *  publication.
57 *
58 *	(c) 1986,1987,1988.1989  Sun Microsystems, Inc
59 *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
60 *          All rights reserved.
61 */
62 
63 /*      @(#)rpc_scan.h  1.3  90/08/29  (C) 1987 SMI   */
64 
65 /*
66  * rpc_scan.h, Definitions for the RPCL scanner
67  */
68 
69 /*
70  * kinds of tokens
71  */
72 enum tok_kind {
73 	TOK_IDENT,
74 	TOK_CHARCONST,
75 	TOK_STRCONST,
76 	TOK_LPAREN,
77 	TOK_RPAREN,
78 	TOK_LBRACE,
79 	TOK_RBRACE,
80 	TOK_LBRACKET,
81 	TOK_RBRACKET,
82 	TOK_LANGLE,
83 	TOK_RANGLE,
84 	TOK_STAR,
85 	TOK_COMMA,
86 	TOK_EQUAL,
87 	TOK_COLON,
88 	TOK_SEMICOLON,
89 	TOK_CONST,
90 	TOK_STRUCT,
91 	TOK_UNION,
92 	TOK_SWITCH,
93 	TOK_CASE,
94 	TOK_DEFAULT,
95 	TOK_ENUM,
96 	TOK_TYPEDEF,
97 	TOK_INT,
98 	TOK_SHORT,
99 	TOK_LONG,
100 	TOK_HYPER,
101 	TOK_UNSIGNED,
102 	TOK_FLOAT,
103 	TOK_DOUBLE,
104 	TOK_QUAD,
105 	TOK_OPAQUE,
106 	TOK_CHAR,
107 	TOK_STRING,
108 	TOK_BOOL,
109 	TOK_VOID,
110 	TOK_PROGRAM,
111 	TOK_VERSION,
112 	TOK_EOF
113 };
114 typedef enum tok_kind tok_kind;
115 
116 /*
117  * a token
118  */
119 struct token {
120 	tok_kind kind;
121 	const char *str;
122 };
123 typedef struct token token;
124 
125 
126 /*
127  * routine interface
128  */
129 void scan(tok_kind expect, token *tokp);
130 void scan2(tok_kind expect1, tok_kind expect2, token *tokp);
131 void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3, token *tokp);
132 void scan_num(token *tokp);
133 void peek(token *tokp);
134 int peekscan(tok_kind expect, token *tokp);
135 void get_token(token *tokp);
136