1233294Sstas/*	$OpenBSD: rpc_scan.h,v 1.7 2017/01/21 08:33:07 krw Exp $	*/
2233294Sstas/*	$NetBSD: rpc_scan.h,v 1.3 1995/06/11 21:50:04 pk Exp $	*/
3233294Sstas
490926Snectar/*
5233294Sstas * Copyright (c) 2010, Oracle America, Inc.
6233294Sstas *
7233294Sstas * Redistribution and use in source and binary forms, with or without
8120945Snectar * modification, are permitted provided that the following conditions are
9233294Sstas * met:
10233294Sstas *
11120945Snectar *     * Redistributions of source code must retain the above copyright
12233294Sstas *       notice, this list of conditions and the following disclaimer.
13233294Sstas *     * Redistributions in binary form must reproduce the above
14233294Sstas *       copyright notice, this list of conditions and the following
15120945Snectar *       disclaimer in the documentation and/or other materials
16233294Sstas *       provided with the distribution.
17233294Sstas *     * Neither the name of the "Oracle America, Inc." nor the names of its
18233294Sstas *       contributors may be used to endorse or promote products derived
19120945Snectar *       from this software without specific prior written permission.
20233294Sstas *
21233294Sstas *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22233294Sstas *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23233294Sstas *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24233294Sstas *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25233294Sstas *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26233294Sstas *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27233294Sstas *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28233294Sstas *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29233294Sstas *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30233294Sstas *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31120945Snectar *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32233294Sstas *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33233294Sstas */
34178825Sdfr
3590926Snectar/*      @(#)rpc_scan.h  1.3  90/08/29  (C) 1987 SMI   */
3690926Snectar
3790926Snectar/*
3890926Snectar * rpc_scan.h, Definitions for the RPCL scanner
39233294Sstas */
4090926Snectar
4190926Snectar/*
4290926Snectar * kinds of tokens
43102644Snectar */
4490926Snectarenum tok_kind {
4590926Snectar	TOK_IDENT,
46103423Snectar	TOK_CHARCONST,
4790926Snectar	TOK_STRCONST,
4890926Snectar	TOK_LPAREN,
4990926Snectar	TOK_RPAREN,
50102644Snectar	TOK_LBRACE,
51102644Snectar	TOK_RBRACE,
5290926Snectar	TOK_LBRACKET,
5390926Snectar	TOK_RBRACKET,
54102644Snectar	TOK_LANGLE,
5590926Snectar	TOK_RANGLE,
5690926Snectar	TOK_STAR,
5790926Snectar	TOK_COMMA,
5890926Snectar	TOK_EQUAL,
5990926Snectar	TOK_COLON,
6090926Snectar	TOK_SEMICOLON,
6190926Snectar	TOK_CONST,
6290926Snectar	TOK_STRUCT,
6390926Snectar	TOK_UNION,
64102644Snectar	TOK_SWITCH,
65233294Sstas	TOK_CASE,
6690926Snectar	TOK_DEFAULT,
67102644Snectar	TOK_ENUM,
68102644Snectar	TOK_TYPEDEF,
6990926Snectar	TOK_INT,
7090926Snectar	TOK_SHORT,
7190926Snectar	TOK_LONG,
7290926Snectar	TOK_HYPER,
73102644Snectar	TOK_UNSIGNED,
74233294Sstas	TOK_FLOAT,
7590926Snectar	TOK_DOUBLE,
76102644Snectar	TOK_QUAD,
7790926Snectar	TOK_OPAQUE,
78102644Snectar	TOK_CHAR,
7990926Snectar	TOK_STRING,
8090926Snectar	TOK_BOOL,
8190926Snectar	TOK_VOID,
82102644Snectar	TOK_PROGRAM,
83233294Sstas	TOK_VERSION,
8490926Snectar	TOK_EOF
85102644Snectar};
8690926Snectartypedef enum tok_kind tok_kind;
87178825Sdfr
88178825Sdfr/*
89178825Sdfr * a token
9090926Snectar */
91102644Snectarstruct token {
92233294Sstas	tok_kind kind;
9390926Snectar	char *str;
94102644Snectar};
9590926Snectartypedef struct token token;
96102644Snectar
9790926Snectar
9890926Snectar/*
9990926Snectar * routine interface
10090926Snectar */
101178825Sdfrvoid scan(tok_kind, token *);
102178825Sdfrvoid scan2(tok_kind, tok_kind, token *);
103178825Sdfrvoid scan3(tok_kind, tok_kind, tok_kind, token *);
104178825Sdfrvoid scan_num(token *);
10590926Snectarvoid peek(token *);
106102644Snectarint peekscan(tok_kind, token *);
107233294Sstasvoid get_token(token *);
10890926Snectarvoid reinitialize(void);
10990926Snectar
11090926Snectarvoid expected1(tok_kind);
11190926Snectarvoid expected2(tok_kind, tok_kind);
112102644Snectarvoid expected3(tok_kind, tok_kind, tok_kind);
113233294Sstas