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