xref: /illumos-gate/usr/src/cmd/rpcgen/rpc_scan.h (revision a2f144d1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*a2f144d1SJordan Brown  * Common Development and Distribution License (the "License").
6*a2f144d1SJordan Brown  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
2061961e0fSrobinson  */
2161961e0fSrobinson 
2261961e0fSrobinson /*
23*a2f144d1SJordan Brown  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
277c478bd9Sstevel@tonic-gate /* All Rights Reserved */
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
307c478bd9Sstevel@tonic-gate  * The Regents of the University of California
317c478bd9Sstevel@tonic-gate  * All Rights Reserved
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
347c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
357c478bd9Sstevel@tonic-gate  * contributors.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
3861961e0fSrobinson #ifndef _RPC_SCAN_H
3961961e0fSrobinson #define	_RPC_SCAN_H
4061961e0fSrobinson 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * rpc_scan.h, Definitions for the RPCL scanner
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate 
4561961e0fSrobinson #ifdef __cplusplus
4661961e0fSrobinson extern "C" {
4761961e0fSrobinson #endif
4861961e0fSrobinson 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * kinds of tokens
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate enum tok_kind {
537c478bd9Sstevel@tonic-gate 	TOK_IDENT,
547c478bd9Sstevel@tonic-gate 	TOK_CHARCONST,
557c478bd9Sstevel@tonic-gate 	TOK_STRCONST,
567c478bd9Sstevel@tonic-gate 	TOK_LPAREN,
577c478bd9Sstevel@tonic-gate 	TOK_RPAREN,
587c478bd9Sstevel@tonic-gate 	TOK_LBRACE,
597c478bd9Sstevel@tonic-gate 	TOK_RBRACE,
607c478bd9Sstevel@tonic-gate 	TOK_LBRACKET,
617c478bd9Sstevel@tonic-gate 	TOK_RBRACKET,
627c478bd9Sstevel@tonic-gate 	TOK_LANGLE,
637c478bd9Sstevel@tonic-gate 	TOK_RANGLE,
647c478bd9Sstevel@tonic-gate 	TOK_STAR,
657c478bd9Sstevel@tonic-gate 	TOK_COMMA,
667c478bd9Sstevel@tonic-gate 	TOK_EQUAL,
677c478bd9Sstevel@tonic-gate 	TOK_COLON,
687c478bd9Sstevel@tonic-gate 	TOK_SEMICOLON,
697c478bd9Sstevel@tonic-gate 	TOK_CONST,
707c478bd9Sstevel@tonic-gate 	TOK_STRUCT,
717c478bd9Sstevel@tonic-gate 	TOK_UNION,
727c478bd9Sstevel@tonic-gate 	TOK_SWITCH,
737c478bd9Sstevel@tonic-gate 	TOK_CASE,
747c478bd9Sstevel@tonic-gate 	TOK_DEFAULT,
757c478bd9Sstevel@tonic-gate 	TOK_ENUM,
767c478bd9Sstevel@tonic-gate 	TOK_TYPEDEF,
777c478bd9Sstevel@tonic-gate 	TOK_INT,
787c478bd9Sstevel@tonic-gate 	TOK_SHORT,
797c478bd9Sstevel@tonic-gate 	TOK_LONG,
807c478bd9Sstevel@tonic-gate 	TOK_HYPER,
817c478bd9Sstevel@tonic-gate 	TOK_UNSIGNED,
827c478bd9Sstevel@tonic-gate 	TOK_FLOAT,
837c478bd9Sstevel@tonic-gate 	TOK_DOUBLE,
847c478bd9Sstevel@tonic-gate 	TOK_QUAD,
857c478bd9Sstevel@tonic-gate 	TOK_OPAQUE,
867c478bd9Sstevel@tonic-gate 	TOK_CHAR,
877c478bd9Sstevel@tonic-gate 	TOK_STRING,
887c478bd9Sstevel@tonic-gate 	TOK_BOOL,
897c478bd9Sstevel@tonic-gate 	TOK_VOID,
907c478bd9Sstevel@tonic-gate 	TOK_ONEWAY,
917c478bd9Sstevel@tonic-gate 	TOK_PROGRAM,
927c478bd9Sstevel@tonic-gate 	TOK_VERSION,
937c478bd9Sstevel@tonic-gate 	TOK_EOF
947c478bd9Sstevel@tonic-gate };
957c478bd9Sstevel@tonic-gate typedef enum tok_kind tok_kind;
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate /*
9861961e0fSrobinson  * a token
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate struct token {
1017c478bd9Sstevel@tonic-gate 	tok_kind kind;
1027c478bd9Sstevel@tonic-gate 	char *str;
1037c478bd9Sstevel@tonic-gate };
1047c478bd9Sstevel@tonic-gate typedef struct token token;
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
10761961e0fSrobinson  * routine interface
1087c478bd9Sstevel@tonic-gate  */
10961961e0fSrobinson extern void scan(tok_kind, token *);
11061961e0fSrobinson extern void scan2(tok_kind, tok_kind, token *);
11161961e0fSrobinson extern void scan3(tok_kind, tok_kind, tok_kind, token *);
11261961e0fSrobinson extern void scan_num(token *);
11361961e0fSrobinson extern void peek(token *);
11461961e0fSrobinson extern int peekscan(tok_kind, token *);
11561961e0fSrobinson extern void get_token(token *);
11661961e0fSrobinson 
11761961e0fSrobinson #ifdef __cplusplus
11861961e0fSrobinson }
11961961e0fSrobinson #endif
12061961e0fSrobinson 
12161961e0fSrobinson #endif /* _RPC_SCAN_H */
122