Annotation of src/usr.bin/rpcgen/rpc_scan.h, Revision 1.5
1.5 ! millert 1: /* $OpenBSD: rpc_scan.h,v 1.4 2002/07/05 05:39:42 deraadt 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: /*
38: * rpc_scan.h, Definitions for the RPCL scanner
39: */
40:
41: /*
42: * kinds of tokens
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,
72: TOK_UNSIGNED,
73: TOK_FLOAT,
74: TOK_DOUBLE,
75: TOK_OPAQUE,
76: TOK_CHAR,
77: TOK_STRING,
78: TOK_BOOL,
79: TOK_VOID,
80: TOK_PROGRAM,
81: TOK_VERSION,
82: TOK_EOF
83: };
84: typedef enum tok_kind tok_kind;
85:
86: /*
87: * a token
88: */
89: struct token {
90: tok_kind kind;
91: char *str;
92: };
93: typedef struct token token;
94:
95:
96: /*
97: * routine interface
98: */
1.3 millert 99: void scan(tok_kind, token *);
100: void scan2(tok_kind, tok_kind, token *);
101: void scan3(tok_kind, tok_kind, tok_kind, token *);
102: void scan_num(token *);
103: void peek(token *);
104: int peekscan(tok_kind, token *);
105: void get_token(token *);
1.4 deraadt 106: void reinitialize(void);
1.3 millert 107:
108: void expected1(tok_kind);
109: void expected2(tok_kind, tok_kind);
110: void expected3(tok_kind, tok_kind, tok_kind);