Annotation of src/usr.bin/rpcgen/rpc_scan.h, Revision 1.7
1.7 ! krw 1: /* $OpenBSD: rpc_scan.h,v 1.6 2016/01/15 10:14:32 jasper Exp $ */
1.1 deraadt 2: /* $NetBSD: rpc_scan.h,v 1.3 1995/06/11 21:50:04 pk Exp $ */
1.5 millert 3:
1.1 deraadt 4: /*
1.5 millert 5: * Copyright (c) 2010, Oracle America, Inc.
1.1 deraadt 6: *
1.5 millert 7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions are
9: * met:
1.1 deraadt 10: *
1.5 millert 11: * * Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * * Redistributions in binary form must reproduce the above
14: * copyright notice, this list of conditions and the following
15: * disclaimer in the documentation and/or other materials
16: * provided with the distribution.
17: * * Neither the name of the "Oracle America, Inc." nor the names of its
18: * contributors may be used to endorse or promote products derived
19: * from this software without specific prior written permission.
1.1 deraadt 20: *
1.5 millert 21: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24: * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25: * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28: * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.1 deraadt 33: */
34:
35: /* @(#)rpc_scan.h 1.3 90/08/29 (C) 1987 SMI */
36:
37: /*
1.7 ! krw 38: * rpc_scan.h, Definitions for the RPCL scanner
1.1 deraadt 39: */
40:
41: /*
1.7 ! krw 42: * kinds of tokens
1.1 deraadt 43: */
44: enum tok_kind {
45: TOK_IDENT,
46: TOK_CHARCONST,
47: TOK_STRCONST,
48: TOK_LPAREN,
49: TOK_RPAREN,
50: TOK_LBRACE,
51: TOK_RBRACE,
52: TOK_LBRACKET,
53: TOK_RBRACKET,
54: TOK_LANGLE,
55: TOK_RANGLE,
56: TOK_STAR,
57: TOK_COMMA,
58: TOK_EQUAL,
59: TOK_COLON,
60: TOK_SEMICOLON,
61: TOK_CONST,
62: TOK_STRUCT,
63: TOK_UNION,
64: TOK_SWITCH,
65: TOK_CASE,
66: TOK_DEFAULT,
67: TOK_ENUM,
68: TOK_TYPEDEF,
69: TOK_INT,
70: TOK_SHORT,
71: TOK_LONG,
1.6 jasper 72: TOK_HYPER,
1.1 deraadt 73: TOK_UNSIGNED,
74: TOK_FLOAT,
75: TOK_DOUBLE,
1.6 jasper 76: TOK_QUAD,
1.1 deraadt 77: TOK_OPAQUE,
78: TOK_CHAR,
79: TOK_STRING,
80: TOK_BOOL,
81: TOK_VOID,
82: TOK_PROGRAM,
83: TOK_VERSION,
84: TOK_EOF
85: };
86: typedef enum tok_kind tok_kind;
87:
88: /*
1.7 ! krw 89: * a token
1.1 deraadt 90: */
91: struct token {
92: tok_kind kind;
93: char *str;
94: };
95: typedef struct token token;
96:
97:
98: /*
1.7 ! krw 99: * routine interface
1.1 deraadt 100: */
1.3 millert 101: void scan(tok_kind, token *);
102: void scan2(tok_kind, tok_kind, token *);
103: void scan3(tok_kind, tok_kind, tok_kind, token *);
104: void scan_num(token *);
105: void peek(token *);
106: int peekscan(tok_kind, token *);
107: void get_token(token *);
1.4 deraadt 108: void reinitialize(void);
1.3 millert 109:
110: void expected1(tok_kind);
111: void expected2(tok_kind, tok_kind);
112: void expected3(tok_kind, tok_kind, tok_kind);