]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-compiler/bnflex.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / bnflex.def
1 (* bnflex.def provides a simple lexical package for pg.
2
3 Copyright (C) 2001-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
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
22 DEFINITION MODULE bnflex ;
23
24 (*
25 Title : bnflex
26 Author : Gaius Mulley
27 System : UNIX (gm2)
28 Date : Mon Sep 13 08:53:02 1999
29 Last edit : Mon Sep 13 08:53:02 1999
30 Description: provides a simple lexical package for pg.
31 *)
32
33 FROM NameKey IMPORT Name ;
34 EXPORT QUALIFIED IsSym, SymIs, TokenType, GetCurrentTokenType, GetCurrentToken,
35 GetChar, PutChar, OpenSource, CloseSource,
36 SkipUntilWhite, SkipWhite, SkipUntilEoln, AdvanceToken, IsReserved, PushBackToken,
37 SetDebugging ;
38
39 TYPE
40 TokenType = (identtok, literaltok, codetok, lbecomestok, rbecomestok, bartok, lsparatok, rsparatok,
41 lcparatok, rcparatok, lparatok, rparatok, errortok, tfunctok, symfunctok,
42 squotetok, dquotetok, moduletok, begintok, rulestok, endtok, lesstok, gretok,
43 tokentok, specialtok, firsttok, followtok, BNFtok, FNBtok, declarationtok,
44 epsilontok, eoftok) ;
45
46
47 (*
48 OpenSource - Attempts to open the source file, a.
49 The success of the operation is returned.
50 *)
51
52 PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
53
54
55 (*
56 CloseSource - Closes the current open file.
57 *)
58
59 PROCEDURE CloseSource ;
60
61
62 (*
63 GetChar - returns the current character on the input stream.
64 *)
65
66 PROCEDURE GetChar () : CHAR ;
67
68
69 (*
70 PutChar - pushes a character onto the push back stack, it also
71 returns the character which has been pushed.
72 *)
73
74 PROCEDURE PutChar (ch: CHAR) : CHAR ;
75
76
77 (*
78 SymIs - if t is equal to the current token the next token is read
79 and true is returned, otherwise false is returned.
80 *)
81
82 PROCEDURE SymIs (t: TokenType) : BOOLEAN ;
83
84
85 (*
86 IsSym - returns the result of the comparison between the current token
87 type and t.
88 *)
89
90 PROCEDURE IsSym (t: TokenType) : BOOLEAN ;
91
92
93 (*
94 GetCurrentTokenType - returns the type of current token.
95 *)
96
97 PROCEDURE GetCurrentTokenType () : TokenType ;
98
99
100 (*
101 GetCurrentToken - returns the NameKey of the current token.
102 *)
103
104 PROCEDURE GetCurrentToken () : Name ;
105
106
107 (*
108 SkipUntilWhite - skips all characters until white space is seen.
109 *)
110
111 PROCEDURE SkipUntilWhite ;
112
113
114 (*
115 SkipWhite - skips all white space.
116 *)
117
118 PROCEDURE SkipWhite ;
119
120
121 (*
122 SkipUntilEoln - skips until a lf is seen. It consumes the lf.
123 *)
124
125 PROCEDURE SkipUntilEoln ;
126
127
128 (*
129 AdvanceToken - advances to the next token.
130 *)
131
132 PROCEDURE AdvanceToken ;
133
134
135 (*
136 IsReserved - returns TRUE if the name is a reserved word.
137 *)
138
139 PROCEDURE IsReserved (name: Name) : BOOLEAN ;
140
141
142 (*
143 PushBackToken - pushes a token back onto input.
144 *)
145
146 PROCEDURE PushBackToken (t: Name) ;
147
148
149 (*
150 SetDebugging - sets the debugging flag.
151 *)
152
153 PROCEDURE SetDebugging (flag: BOOLEAN) ;
154
155
156 END bnflex.