Debian Codegraph @

gcc/m2/gm2-compiler/M2Lex.def

raw
1 (* M2Lex.def provides a non tokenised lexical analyser.
2
3 Copyright (C) 2001-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
5
6 This file is part of GNU Modula-2.
7
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)
11 any later version.
12
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.
17
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/>. *)
21 DEFINITION MODULE M2Lex ;
22
23 (*
24 Title : M2Lex
25 Author : Gaius Mulley
26 Date : Date: Sat 16-09-1989 Time: 17:54:22.58
27 LastEdit : Date: Sat 16-09-1989 Time: 17:54:22.58
28 System : UNIX (GNU Modula-2)
29 Description: Provides a non tokenised version of M2Lexical.
30 Symbols are distinct MODULA-2 symbols.
31 *)
32
33 EXPORT QUALIFIED MaxLine,
34 GetSymbol,
35 PutSymbol,
36 CurrentSymbol,
37 LastSymbol,
38 OpenSource,
39 CloseSource,
40 SymIs,
41 IsSym,
42 WriteError ;
43
44 CONST
45 MaxLine = 1024 ;
46
47 VAR
48 LastSymbol,
49 CurrentSymbol : ARRAY [0..MaxLine] OF CHAR ;
50
51
52 (*
53 OpenSource - Attempts to open the source file, a.
54 The success of the operation is returned.
55 *)
56
57 PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
58
59
60 (*
61 CloseSource - Closes the current open file.
62 *)
63
64 PROCEDURE CloseSource ;
65
66
67 (*
68 SymIs - if Name is equal to the CurrentSymbol the next Symbol is read
69 and true is returned, otherwise false is returned.
70 *)
71
72 PROCEDURE SymIs (Name: ARRAY OF CHAR) : BOOLEAN ;
73
74
75 (*
76 IsSym - returns the result of the comparison between CurrentSymbol
77 and Name.
78 *)
79
80 PROCEDURE IsSym (Name: ARRAY OF CHAR) : BOOLEAN ;
81
82
83 (*
84 GetSymbol - gets the next Symbol into CurrentSymbol.
85 *)
86
87 PROCEDURE GetSymbol ;
88
89
90 (*
91 PutSymbol - pushes a symbol, Name, back onto the input.
92 GetSymbol will set CurrentSymbol to, Name.
93 *)
94
95 PROCEDURE PutSymbol (Name: ARRAY OF CHAR) ;
96
97
98 (*
99 WriteError - displays the source line and points to the symbol in error.
100 The message, a, is displayed.
101 *)
102
103 PROCEDURE WriteError (a: ARRAY OF CHAR) ;
104
105
106 END M2Lex.