xref: /illumos-gate/usr/src/cmd/fm/eversholt/common/esclex.h (revision 2aeafac3612e19716bf8164f89c3c9196342979c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  *
26  * esclex.h -- public definitions for esclex module
27  *
28  * this module provides lexical analysis (i.e. tokenizing the
29  * input files) and the lex-level error routines expected by
30  * yacc like yyerror().  yylex() and yyerror() are called only
31  * by yacc-generated code.  the lex_X() routines are called
32  * only by main().
33  *
34  * the tokstr struct is the communication mechanism between the lexer
35  * and the parser.
36  */
37 
38 #ifndef	_ESC_COMMON_ESCLEX_H
39 #define	_ESC_COMMON_ESCLEX_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /* information returned by lexer for tokens with string table entries */
48 struct tokstr {
49 	const char *s;		/* the string (in the string table) */
50 	const char *file;	/* file where this token appeared */
51 	int line;		/* line where this token appeared */
52 };
53 
54 void lex_init(char **av, const char *cppargs, int lexecho);
55 int lex_fini(void);
56 void lex_free(void);
57 const unsigned long long *lex_s2ullp_lut_lookup(struct lut *root,
58     const char *s);
59 
60 /* lut containing "ident" strings */
61 struct lut *Ident;
62 
63 /* lut containing "dictionary" strings */
64 struct lut *Dicts;
65 
66 /* lut containing valid timeval suffixes */
67 struct lut *Timesuffixlut;
68 
69 /* flags set by #pragmas */
70 int Pragma_new_errors_only;
71 int Pragma_trust_ereports;
72 int Pragma_allow_cycles;
73 
74 /* exported by esclex.c but names are mandated by the way yacc works... */
75 int yylex();
76 void yyerror(const char *s);
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _ESC_COMMON_ESCLEX_H */
83