1 (* cflex.def provides a Modula-2 definition module for C lexical analysis.
3 Copyright (C) 2003-2022 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
22 DEFINITION MODULE cflex ;
28 Date : Thu Jan 23 12:39:36 2003
30 Description: provides a Modula-2 definition module for C lexical analysis.
33 FROM SYSTEM IMPORT ADDRESS ;
34 EXPORT QUALIFIED GetToken, AdvanceToken, CError, OpenSource, CloseSource, GetLineNo,
35 ParsingOn, SetSearchPath, AddTypeDef ;
39 CloseSource - provided for semantic sugar
42 PROCEDURE CloseSource ;
46 OpenSource - returns TRUE if file, s, can be opened and
47 all tokens are taken from this file.
50 PROCEDURE OpenSource (s: ADDRESS) : BOOLEAN ;
54 GetToken - returns the ADDRESS of the next token.
57 PROCEDURE GetToken () : ADDRESS ;
61 AdvanceToken - move onto the next token.
64 PROCEDURE AdvanceToken ;
68 GetLineNo - returns the current line number.
71 PROCEDURE GetLineNo () : CARDINAL ;
75 CError - displays the error message, s, after the code line and pointer
76 to the erroneous token.
79 PROCEDURE CError (s: ADDRESS) ;
83 ParsingOn - if t is FALSE then the lexical analysis will
84 consume all lines except when a line is one of
85 '#endif' or '#else' or '#if' or '#ifdef'
88 PROCEDURE ParsingOn (t: BOOLEAN) ;
92 SetSearchPath - reassigns the search path to newPath.
95 PROCEDURE SetSearchPath (newPath: ADDRESS) ;
99 AddTypeDef - adds the string, a, to the list of typedefs.
102 PROCEDURE AddTypeDef (a: ADDRESS) ;