]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-compiler/bnflex.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / bnflex.def
CommitLineData
1eee94d3
GM
1(* bnflex.def provides a simple lexical package for pg.
2
a945c346 3Copyright (C) 2001-2024 Free Software Foundation, Inc.
1eee94d3
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 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
33FROM NameKey IMPORT Name ;
34EXPORT QUALIFIED IsSym, SymIs, TokenType, GetCurrentTokenType, GetCurrentToken,
35 GetChar, PutChar, OpenSource, CloseSource,
36 SkipUntilWhite, SkipWhite, SkipUntilEoln, AdvanceToken, IsReserved, PushBackToken,
37 SetDebugging ;
38
39TYPE
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
52PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
53
54
55(*
56 CloseSource - Closes the current open file.
57*)
58
59PROCEDURE CloseSource ;
60
61
62(*
63 GetChar - returns the current character on the input stream.
64*)
65
66PROCEDURE 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
74PROCEDURE 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
82PROCEDURE 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
90PROCEDURE IsSym (t: TokenType) : BOOLEAN ;
91
92
93(*
94 GetCurrentTokenType - returns the type of current token.
95*)
96
97PROCEDURE GetCurrentTokenType () : TokenType ;
98
99
100(*
101 GetCurrentToken - returns the NameKey of the current token.
102*)
103
104PROCEDURE GetCurrentToken () : Name ;
105
106
107(*
108 SkipUntilWhite - skips all characters until white space is seen.
109*)
110
111PROCEDURE SkipUntilWhite ;
112
113
114(*
115 SkipWhite - skips all white space.
116*)
117
118PROCEDURE SkipWhite ;
119
120
121(*
122 SkipUntilEoln - skips until a lf is seen. It consumes the lf.
123*)
124
125PROCEDURE SkipUntilEoln ;
126
127
128(*
129 AdvanceToken - advances to the next token.
130*)
131
132PROCEDURE AdvanceToken ;
133
134
135(*
136 IsReserved - returns TRUE if the name is a reserved word.
137*)
138
139PROCEDURE IsReserved (name: Name) : BOOLEAN ;
140
141
142(*
143 PushBackToken - pushes a token back onto input.
144*)
145
146PROCEDURE PushBackToken (t: Name) ;
147
148
149(*
150 SetDebugging - sets the debugging flag.
151*)
152
153PROCEDURE SetDebugging (flag: BOOLEAN) ;
154
155
156END bnflex.