xref: /illumos-gate/usr/src/cmd/fm/eversholt/common/esclex.h (revision 0245b61fd282e95735b173b8d95be0d6688163b4)
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 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /* information returned by lexer for tokens with string table entries */
46 struct tokstr {
47 	const char *s;		/* the string (in the string table) */
48 	const char *file;	/* file where this token appeared */
49 	int line;		/* line where this token appeared */
50 };
51 
52 void lex_init(char **av, const char *cppargs, int lexecho);
53 int lex_fini(void);
54 void lex_free(void);
55 const unsigned long long *lex_s2ullp_lut_lookup(struct lut *root,
56     const char *s);
57 
58 /* lut containing "ident" strings */
59 extern struct lut *Ident;
60 
61 /* lut containing "dictionary" strings */
62 extern struct lut *Dicts;
63 
64 /* lut containing valid timeval suffixes */
65 extern struct lut *Timesuffixlut;
66 
67 /* flags set by #pragmas */
68 extern int Pragma_new_errors_only;
69 extern int Pragma_trust_ereports;
70 extern int Pragma_allow_cycles;
71 
72 /* exported by esclex.c but names are mandated by the way yacc works... */
73 int yylex();
74 void yyerror(const char *s);
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _ESC_COMMON_ESCLEX_H */
81