]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot/GmcLexBuf.h
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc-boot / GmcLexBuf.h
1 /* do not edit automatically generated by mc from mcLexBuf. */
2 /* mcLexBuf.def provides a buffer for the all the tokens created by m2.lex.
3
4 Copyright (C) 2015-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6
7 This file is part of GNU Modula-2.
8
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Modula-2; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23
24 #if !defined (_mcLexBuf_H)
25 # define _mcLexBuf_H
26
27 #include "config.h"
28 #include "system.h"
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 #include <stdbool.h>
33 # if !defined (PROC_D)
34 # define PROC_D
35 typedef void (*PROC_t) (void);
36 typedef struct { PROC_t proc; } PROC;
37 # endif
38
39 # include "GSYSTEM.h"
40 # include "GmcReserved.h"
41 # include "GDynamicStrings.h"
42 # include "GmcComment.h"
43
44 # if defined (_mcLexBuf_C)
45 # define EXTERN
46 # else
47 # define EXTERN extern
48 # endif
49
50 EXTERN mcReserved_toktype mcLexBuf_currenttoken;
51 EXTERN void * mcLexBuf_currentstring;
52 EXTERN unsigned int mcLexBuf_currentcolumn;
53 EXTERN int mcLexBuf_currentinteger;
54 EXTERN mcComment_commentDesc mcLexBuf_lastcomment;
55 EXTERN mcComment_commentDesc mcLexBuf_currentcomment;
56
57 /*
58 getProcedureComment - returns the procedure comment if it exists,
59 or NIL otherwise.
60 */
61
62 EXTERN mcComment_commentDesc mcLexBuf_getProcedureComment (void);
63
64 /*
65 getBodyComment - returns the body comment if it exists,
66 or NIL otherwise.
67 */
68
69 EXTERN mcComment_commentDesc mcLexBuf_getBodyComment (void);
70
71 /*
72 getAfterComment - returns the after comment if it exists,
73 or NIL otherwise.
74 */
75
76 EXTERN mcComment_commentDesc mcLexBuf_getAfterComment (void);
77
78 /*
79 openSource - Attempts to open the source file, s.
80 The success of the operation is returned.
81 */
82
83 EXTERN bool mcLexBuf_openSource (DynamicStrings_String s);
84
85 /*
86 closeSource - closes the current open file.
87 */
88
89 EXTERN void mcLexBuf_closeSource (void);
90
91 /*
92 reInitialize - re-initialize the all the data structures.
93 */
94
95 EXTERN void mcLexBuf_reInitialize (void);
96
97 /*
98 resetForNewPass - reset the buffer pointers to the beginning ready for
99 a new pass
100 */
101
102 EXTERN void mcLexBuf_resetForNewPass (void);
103
104 /*
105 getToken - gets the next token into currenttoken.
106 */
107
108 EXTERN void mcLexBuf_getToken (void);
109
110 /*
111 insertToken - inserts a symbol, token, infront of the current token
112 ready for the next pass.
113 */
114
115 EXTERN void mcLexBuf_insertToken (mcReserved_toktype token);
116
117 /*
118 insertTokenAndRewind - inserts a symbol, token, infront of the current token
119 and then moves the token stream back onto the inserted token.
120 */
121
122 EXTERN void mcLexBuf_insertTokenAndRewind (mcReserved_toktype token);
123
124 /*
125 getPreviousTokenLineNo - returns the line number of the previous token.
126 */
127
128 EXTERN unsigned int mcLexBuf_getPreviousTokenLineNo (void);
129
130 /*
131 getLineNo - returns the current line number where the symbol occurs in
132 the source file.
133 */
134
135 EXTERN unsigned int mcLexBuf_getLineNo (void);
136
137 /*
138 getTokenNo - returns the current token number.
139 */
140
141 EXTERN unsigned int mcLexBuf_getTokenNo (void);
142
143 /*
144 tokenToLineNo - returns the line number of the current file for the
145 TokenNo. The depth refers to the include depth.
146 A depth of 0 is the current file, depth of 1 is the file
147 which included the current file. Zero is returned if the
148 depth exceeds the file nesting level.
149 */
150
151 EXTERN unsigned int mcLexBuf_tokenToLineNo (unsigned int tokenNo, unsigned int depth);
152
153 /*
154 getColumnNo - returns the current column where the symbol occurs in
155 the source file.
156 */
157
158 EXTERN unsigned int mcLexBuf_getColumnNo (void);
159
160 /*
161 tokenToColumnNo - returns the column number of the current file for the
162 TokenNo. The depth refers to the include depth.
163 A depth of 0 is the current file, depth of 1 is the file
164 which included the current file. Zero is returned if the
165 depth exceeds the file nesting level.
166 */
167
168 EXTERN unsigned int mcLexBuf_tokenToColumnNo (unsigned int tokenNo, unsigned int depth);
169
170 /*
171 findFileNameFromToken - returns the complete FileName for the appropriate
172 source file yields the token number, TokenNo.
173 The, Depth, indicates the include level: 0..n
174 Level 0 is the current. NIL is returned if n+1
175 is requested.
176 */
177
178 EXTERN DynamicStrings_String mcLexBuf_findFileNameFromToken (unsigned int tokenNo, unsigned int depth);
179
180 /*
181 getFileName - returns a String defining the current file.
182 */
183
184 EXTERN DynamicStrings_String mcLexBuf_getFileName (void);
185
186 /*
187 addTok - adds a token to the buffer.
188 */
189
190 EXTERN void mcLexBuf_addTok (mcReserved_toktype t);
191
192 /*
193 addTokCharStar - adds a token to the buffer and an additional string, s.
194 A copy of string, s, is made.
195 */
196
197 EXTERN void mcLexBuf_addTokCharStar (mcReserved_toktype t, void * s);
198
199 /*
200 addTokInteger - adds a token and an integer to the buffer.
201 */
202
203 EXTERN void mcLexBuf_addTokInteger (mcReserved_toktype t, int i);
204
205 /*
206 addTokComment - adds a token to the buffer and a comment descriptor, com.
207 */
208
209 EXTERN void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentDesc com);
210
211 /*
212 setFile - sets the current filename to, filename.
213 */
214
215 EXTERN void mcLexBuf_setFile (void * filename);
216
217 /*
218 pushFile - indicates that, filename, has just been included.
219 */
220
221 EXTERN void mcLexBuf_pushFile (void * filename);
222
223 /*
224 popFile - indicates that we are returning to, filename, having finished
225 an include.
226 */
227
228 EXTERN void mcLexBuf_popFile (void * filename);
229 # ifdef __cplusplus
230 }
231 # endif
232
233 # undef EXTERN
234 #endif