c++: add fixed test [PR94100]
[official-gcc.git] / gcc / m2 / mc-boot / GmcLexBuf.h
blobca22526c0a43055b739ca6321a319fb2572fb42a
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.
4 Copyright (C) 2015-2025 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
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.
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.
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/>. */
24 #if !defined (_mcLexBuf_H)
25 # define _mcLexBuf_H
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
39 # include "GSYSTEM.h"
40 # include "GmcReserved.h"
41 # include "GDynamicStrings.h"
42 # include "GmcComment.h"
44 # if defined (_mcLexBuf_C)
45 # define EXTERN
46 # else
47 # define EXTERN extern
48 # endif
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;
58 getProcedureComment - returns the procedure comment if it exists,
59 or NIL otherwise.
62 EXTERN mcComment_commentDesc mcLexBuf_getProcedureComment (void);
65 getBodyComment - returns the body comment if it exists,
66 or NIL otherwise.
69 EXTERN mcComment_commentDesc mcLexBuf_getBodyComment (void);
72 getAfterComment - returns the after comment if it exists,
73 or NIL otherwise.
76 EXTERN mcComment_commentDesc mcLexBuf_getAfterComment (void);
79 openSource - Attempts to open the source file, s.
80 The success of the operation is returned.
83 EXTERN bool mcLexBuf_openSource (DynamicStrings_String s);
86 closeSource - closes the current open file.
89 EXTERN void mcLexBuf_closeSource (void);
92 reInitialize - re-initialize the all the data structures.
95 EXTERN void mcLexBuf_reInitialize (void);
98 resetForNewPass - reset the buffer pointers to the beginning ready for
99 a new pass
102 EXTERN void mcLexBuf_resetForNewPass (void);
105 getToken - gets the next token into currenttoken.
108 EXTERN void mcLexBuf_getToken (void);
111 insertToken - inserts a symbol, token, infront of the current token
112 ready for the next pass.
115 EXTERN void mcLexBuf_insertToken (mcReserved_toktype token);
118 insertTokenAndRewind - inserts a symbol, token, infront of the current token
119 and then moves the token stream back onto the inserted token.
122 EXTERN void mcLexBuf_insertTokenAndRewind (mcReserved_toktype token);
125 getPreviousTokenLineNo - returns the line number of the previous token.
128 EXTERN unsigned int mcLexBuf_getPreviousTokenLineNo (void);
131 getLineNo - returns the current line number where the symbol occurs in
132 the source file.
135 EXTERN unsigned int mcLexBuf_getLineNo (void);
138 getTokenNo - returns the current token number.
141 EXTERN unsigned int mcLexBuf_getTokenNo (void);
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.
151 EXTERN unsigned int mcLexBuf_tokenToLineNo (unsigned int tokenNo, unsigned int depth);
154 getColumnNo - returns the current column where the symbol occurs in
155 the source file.
158 EXTERN unsigned int mcLexBuf_getColumnNo (void);
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.
168 EXTERN unsigned int mcLexBuf_tokenToColumnNo (unsigned int tokenNo, unsigned int depth);
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.
178 EXTERN DynamicStrings_String mcLexBuf_findFileNameFromToken (unsigned int tokenNo, unsigned int depth);
181 getFileName - returns a String defining the current file.
184 EXTERN DynamicStrings_String mcLexBuf_getFileName (void);
187 addTok - adds a token to the buffer.
190 EXTERN void mcLexBuf_addTok (mcReserved_toktype t);
193 addTokCharStar - adds a token to the buffer and an additional string, s.
194 A copy of string, s, is made.
197 EXTERN void mcLexBuf_addTokCharStar (mcReserved_toktype t, void * s);
200 addTokInteger - adds a token and an integer to the buffer.
203 EXTERN void mcLexBuf_addTokInteger (mcReserved_toktype t, int i);
206 addTokComment - adds a token to the buffer and a comment descriptor, com.
209 EXTERN void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentDesc com);
212 setFile - sets the current filename to, filename.
215 EXTERN void mcLexBuf_setFile (void * filename);
218 pushFile - indicates that, filename, has just been included.
221 EXTERN void mcLexBuf_pushFile (void * filename);
224 popFile - indicates that we are returning to, filename, having finished
225 an include.
228 EXTERN void mcLexBuf_popFile (void * filename);
229 # ifdef __cplusplus
231 # endif
233 # undef EXTERN
234 #endif