xref: /illumos-gate/usr/src/cmd/rpcgen/rpc_scan.h (revision 598f4ceed9327d2d6c2325dd67cae3aa06f7fea6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29  * University Copyright- Copyright (c) 1982, 1986, 1988
30  * The Regents of the University of California
31  * All Rights Reserved
32  *
33  * University Acknowledgment- Portions of this document are derived from
34  * software developed by the University of California, Berkeley, and its
35  * contributors.
36  */
37 
38 #ifndef _RPC_SCAN_H
39 #define	_RPC_SCAN_H
40 
41 /*
42  * rpc_scan.h, Definitions for the RPCL scanner
43  */
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /*
50  * kinds of tokens
51  */
52 enum tok_kind {
53 	TOK_IDENT,
54 	TOK_CHARCONST,
55 	TOK_STRCONST,
56 	TOK_LPAREN,
57 	TOK_RPAREN,
58 	TOK_LBRACE,
59 	TOK_RBRACE,
60 	TOK_LBRACKET,
61 	TOK_RBRACKET,
62 	TOK_LANGLE,
63 	TOK_RANGLE,
64 	TOK_STAR,
65 	TOK_COMMA,
66 	TOK_EQUAL,
67 	TOK_COLON,
68 	TOK_SEMICOLON,
69 	TOK_CONST,
70 	TOK_STRUCT,
71 	TOK_UNION,
72 	TOK_SWITCH,
73 	TOK_CASE,
74 	TOK_DEFAULT,
75 	TOK_ENUM,
76 	TOK_TYPEDEF,
77 	TOK_INT,
78 	TOK_SHORT,
79 	TOK_LONG,
80 	TOK_HYPER,
81 	TOK_UNSIGNED,
82 	TOK_FLOAT,
83 	TOK_DOUBLE,
84 	TOK_QUAD,
85 	TOK_OPAQUE,
86 	TOK_CHAR,
87 	TOK_STRING,
88 	TOK_BOOL,
89 	TOK_VOID,
90 	TOK_ONEWAY,
91 	TOK_PROGRAM,
92 	TOK_VERSION,
93 	TOK_EOF
94 };
95 typedef enum tok_kind tok_kind;
96 
97 /*
98  * a token
99  */
100 struct token {
101 	tok_kind kind;
102 	char *str;
103 };
104 typedef struct token token;
105 
106 /*
107  * routine interface
108  */
109 extern void scan(tok_kind, token *);
110 extern void scan2(tok_kind, tok_kind, token *);
111 extern void scan3(tok_kind, tok_kind, tok_kind, token *);
112 extern void scan_num(token *);
113 extern void peek(token *);
114 extern int peekscan(tok_kind, token *);
115 extern void get_token(token *);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif /* _RPC_SCAN_H */
122