1 /******************************** -*- C -*- ****************************
2  *
3  *	External definitions for the Lexer module.
4  *
5  *
6  ***********************************************************************/
7 
8 /***********************************************************************
9  *
10  * Copyright 1988,89,90,91,92,94,95,99,2000,2001,2002,2006,2007,2008
11  * Free Software Foundation, Inc.
12  * Written by Steve Byrne.
13  *
14  * This file is part of GNU Smalltalk.
15  *
16  * GNU Smalltalk is free software; you can redistribute it and/or modify it
17  * under the terms of the GNU General Public License as published by the Free
18  * Software Foundation; either version 2, or (at your option) any later
19  * version.
20  *
21  * Linking GNU Smalltalk statically or dynamically with other modules is
22  * making a combined work based on GNU Smalltalk.  Thus, the terms and
23  * conditions of the GNU General Public License cover the whole
24  * combination.
25  *
26  * In addition, as a special exception, the Free Software Foundation
27  * give you permission to combine GNU Smalltalk with free software
28  * programs or libraries that are released under the GNU LGPL and with
29  * independent programs running under the GNU Smalltalk virtual machine.
30  *
31  * You may copy and distribute such a system following the terms of the
32  * GNU GPL for GNU Smalltalk and the licenses of the other code
33  * concerned, provided that you include the source code of that other
34  * code when and as the GNU GPL requires distribution of source code.
35  *
36  * Note that people who make modified versions of GNU Smalltalk are not
37  * obligated to grant this special exception for their modified
38  * versions; it is their choice whether to do so.  The GNU General
39  * Public License gives permission to release a modified version without
40  * this exception; this exception also makes it possible to release a
41  * modified version which carries forward this exception.
42  *
43  * GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
44  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
45  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
46  * more details.
47  *
48  * You should have received a copy of the GNU General Public License along with
49  * GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
50  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
51  *
52  ***********************************************************************/
53 
54 
55 #ifndef GST_LEX_H
56 #define GST_LEX_H
57 
58 /* True if errors must be reported to the standard error, false if
59    errors should instead stored so that they are passed to Smalltalk
60    code.  */
61 extern mst_Boolean _gst_report_errors
62   ATTRIBUTE_HIDDEN;
63 
64 /* This is set to true by the parser or the compiler if an error
65    (respectively, a parse error or a semantic error) is found, and
66    avoids that _gst_execute_statements tries to execute the result of
67    the compilation.  */
68 extern mst_Boolean _gst_had_error
69   ATTRIBUTE_HIDDEN;
70 
71 /* This is set to true by the parser if error recovery is going on.
72    In this case ERROR_RECOVERY tokens are generated.  */
73 extern mst_Boolean _gst_error_recovery
74   ATTRIBUTE_HIDDEN;
75 
76 /* The location of the first error reported, stored here so that
77    compilation primitives can pass them to Smalltalk code.  */
78 extern char *_gst_first_error_str
79   ATTRIBUTE_HIDDEN, *_gst_first_error_file
80   ATTRIBUTE_HIDDEN;
81 extern int _gst_first_error_line
82   ATTRIBUTE_HIDDEN;
83 
84 /* The obstack containing parse tree nodes.  */
85 extern struct obstack *_gst_compilation_obstack
86   ATTRIBUTE_HIDDEN;
87 
88 /* Parse the topmost stream in the stack.  */
89 extern void _gst_parse_stream (mst_Boolean method)
90   ATTRIBUTE_HIDDEN;
91 
92 /* Lexer interface to the lexer.  */
93 extern int _gst_yylex (PTR lvalp, YYLTYPE *llocp)
94   ATTRIBUTE_HIDDEN;
95 
96 /* Print on file FILE a description of TOKEN, with auxiliary data
97    stored in LVAL.  */
98 extern void _gst_yyprint (FILE * file,
99 			  int token,
100 			  PTR lval)
101   ATTRIBUTE_HIDDEN;
102 
103 /* Negate the semantic value YYLVAL, which must be a numeric token
104    of type TOKEN.  Returns true if YYLVAL is positive, false if it
105    is negative.  */
106 extern mst_Boolean _gst_negate_yylval (int token,
107 				       YYSTYPE *yylval);
108 
109 #endif /* GST_LEX_H */
110