]> gcc.gnu.org Git - gcc.git/blame - gcc/m2/mc/mcLexBuf.def
Year date changes for Modula-2 source tree.
[gcc.git] / gcc / m2 / mc / mcLexBuf.def
CommitLineData
7401123f
GM
1(* mcLexBuf.def provides a buffer for the all the tokens created by m2.lex.
2
3d864fce 3Copyright (C) 2015-2022 Free Software Foundation, Inc.
7401123f
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Modula-2; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. *)
21
22DEFINITION MODULE mcLexBuf ;
23
24
25FROM SYSTEM IMPORT ADDRESS ;
26FROM mcReserved IMPORT toktype ;
27FROM DynamicStrings IMPORT String ;
28FROM mcComment IMPORT commentDesc ;
29
30
31VAR
32 currenttoken : toktype ;
33 currentstring : ADDRESS ;
34 currentcolumn : CARDINAL ;
35 currentinteger: INTEGER ;
36 lastcomment,
37 currentcomment: commentDesc ;
38
39
40(*
41 getProcedureComment - returns the procedure comment if it exists,
42 or NIL otherwise.
43*)
44
45PROCEDURE getProcedureComment () : commentDesc ;
46
47
48(*
49 getBodyComment - returns the body comment if it exists,
50 or NIL otherwise.
51*)
52
53PROCEDURE getBodyComment () : commentDesc ;
54
55
56(*
57 getAfterComment - returns the after comment if it exists,
58 or NIL otherwise.
59*)
60
61PROCEDURE getAfterComment () : commentDesc ;
62
63
64(*
65 openSource - Attempts to open the source file, s.
66 The success of the operation is returned.
67*)
68
69PROCEDURE openSource (s: String) : BOOLEAN ;
70
71
72(*
73 closeSource - closes the current open file.
74*)
75
76PROCEDURE closeSource ;
77
78
79(*
80 reInitialize - re-initialize the all the data structures.
81*)
82
83PROCEDURE reInitialize ;
84
85
86(*
87 resetForNewPass - reset the buffer pointers to the beginning ready for
88 a new pass
89*)
90
91PROCEDURE resetForNewPass ;
92
93
94(*
95 getToken - gets the next token into currenttoken.
96*)
97
98PROCEDURE getToken ;
99
100
101(*
102 insertToken - inserts a symbol, token, infront of the current token
103 ready for the next pass.
104*)
105
106PROCEDURE insertToken (token: toktype) ;
107
108
109(*
110 insertTokenAndRewind - inserts a symbol, token, infront of the current token
111 and then moves the token stream back onto the inserted token.
112*)
113
114PROCEDURE insertTokenAndRewind (token: toktype) ;
115
116
117(*
118 getPreviousTokenLineNo - returns the line number of the previous token.
119*)
120
121PROCEDURE getPreviousTokenLineNo () : CARDINAL ;
122
123
124(*
125 getLineNo - returns the current line number where the symbol occurs in
126 the source file.
127*)
128
129PROCEDURE getLineNo () : CARDINAL ;
130
131
132(*
133 getTokenNo - returns the current token number.
134*)
135
136PROCEDURE getTokenNo () : CARDINAL ;
137
138
139(*
140 tokenToLineNo - returns the line number of the current file for the
141 TokenNo. The depth refers to the include depth.
142 A depth of 0 is the current file, depth of 1 is the file
143 which included the current file. Zero is returned if the
144 depth exceeds the file nesting level.
145*)
146
147PROCEDURE tokenToLineNo (tokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
148
149
150(*
151 getColumnNo - returns the current column where the symbol occurs in
152 the source file.
153*)
154
155PROCEDURE getColumnNo () : CARDINAL ;
156
157
158(*
159 tokenToColumnNo - returns the column number of the current file for the
160 TokenNo. The depth refers to the include depth.
161 A depth of 0 is the current file, depth of 1 is the file
162 which included the current file. Zero is returned if the
163 depth exceeds the file nesting level.
164*)
165
166PROCEDURE tokenToColumnNo (tokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
167
168
169(*
170 findFileNameFromToken - returns the complete FileName for the appropriate
171 source file yields the token number, TokenNo.
172 The, Depth, indicates the include level: 0..n
173 Level 0 is the current. NIL is returned if n+1
174 is requested.
175*)
176
177PROCEDURE findFileNameFromToken (tokenNo: CARDINAL; depth: CARDINAL) : String ;
178
179
180(*
181 getFileName - returns a String defining the current file.
182*)
183
184PROCEDURE getFileName () : String ;
185
186
187(* ***********************************************************************
188 *
189 * These functions allow m2.lex to deliver tokens into the buffer
190 *
191 ************************************************************************* *)
192
193(*
194 addTok - adds a token to the buffer.
195*)
196
197PROCEDURE addTok (t: toktype) ;
198
199
200(*
201 addTokCharStar - adds a token to the buffer and an additional string, s.
202 A copy of string, s, is made.
203*)
204
205PROCEDURE addTokCharStar (t: toktype; s: ADDRESS) ;
206
207
208(*
209 addTokInteger - adds a token and an integer to the buffer.
210*)
211
212PROCEDURE addTokInteger (t: toktype; i: INTEGER) ;
213
214
215(*
216 addTokComment - adds a token to the buffer and a comment descriptor, com.
217*)
218
219PROCEDURE addTokComment (t: toktype; com: commentDesc) ;
220
221
222(*
223 setFile - sets the current filename to, filename.
224*)
225
226PROCEDURE setFile (filename: ADDRESS) ;
227
228
229(*
230 pushFile - indicates that, filename, has just been included.
231*)
232
233PROCEDURE pushFile (filename: ADDRESS) ;
234
235
236(*
237 popFile - indicates that we are returning to, filename, having finished
238 an include.
239*)
240
241PROCEDURE popFile (filename: ADDRESS) ;
242
243
244END mcLexBuf.
This page took 0.075025 seconds and 5 git commands to generate.