Debian Codegraph @

gcc/m2/gm2-compiler/M2Reserved.def

raw
1 (* M2Reserved.def determines is a token is a reserved word.
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
22 DEFINITION MODULE M2Reserved ;
23
24 (*
25 Author : Gaius Mulley
26 Title : M2Reserved
27 Date : 15/5/87
28 Description: implements a procedure to determine if a symbol is a
29 Modula-2 reserved word and provides conversion between
30 toktype and the equivalent stringed, Name.
31 *)
32
33 FROM NameKey IMPORT Name ;
34
35 EXPORT QUALIFIED IsReserved, tokToTok,
36
37 NulTok, PlusTok, MinusTok, TimesTok, DivideTok, BecomesTok,
38 AmbersandTok, PeriodTok, CommaTok, SemiColonTok, LParaTok,
39 LSBraTok, LCBraTok, UpArrowTok, SingleQuoteTok, EqualTok,
40 HashTok, LessTok, GreaterTok, LessGreaterTok, LessEqualTok,
41 GreaterEqualTok, PeriodPeriodTok, ColonTok, RParaTok,
42 RSBraTok, RCBraTok, BarTok, DoubleQuotesTok,
43
44 AndTok, ArrayTok, BeginTok, ByTok, CaseTok, ConstTok,
45 DefinitionTok, DivTok, DoTok, ElseTok, ElsifTok, EndTok,
46 ExceptTok,
47 ExitTok, ExportTok, FinallyTok, ForTok, ForwardTok,
48 FromTok, IfTok,
49 ImplementationTok, ImportTok, InTok, LoopTok, ModTok,
50 ModuleTok, NotTok, OfTok, OrTok,
51 PackedSetTok, PointerTok, ProcedureTok,
52 QualifiedTok, UnQualifiedTok, RecordTok, RetryTok,
53 RemTok, RepeatTok,
54 ReturnTok, SetTok, ThenTok, ToTok, TypeTok, UntilTok, VarTok,
55 WhileTok, WithTok,
56
57 (* additional tokens which extend PIM Modula-2 slightly *)
58 EofTok, AsmTok, VolatileTok, DateTok, LineTok, FileTok,
59 AttributeTok, BuiltinTok, InlineTok,
60 toktype ;
61
62 TYPE
63 toktype = (eoftok, plustok, minustok, timestok, dividetok,
64 becomestok, ambersandtok, periodtok, commatok,
65 semicolontok, lparatok, rparatok, lsbratok, rsbratok,
66 lcbratok, rcbratok, uparrowtok, singlequotetok,
67 equaltok, hashtok, lesstok, greatertok, lessgreatertok,
68 lessequaltok, greaterequaltok,
69 ldirectivetok, rdirectivetok,
70 periodperiodtok,
71 colontok, doublequotestok, bartok, andtok,
72 arraytok, begintok, bytok, casetok, consttok,
73 definitiontok, divtok, dotok, elsetok, elsiftok,
74 endtok, excepttok, exittok, exporttok, finallytok,
75 fortok, forwardtok, fromtok, iftok, implementationtok,
76 importtok, intok, looptok, modtok,
77 moduletok, nottok, oftok, ortok,
78 packedsettok, pointertok, proceduretok,
79 qualifiedtok, unqualifiedtok,
80 recordtok, remtok, repeattok, retrytok, returntok,
81 settok, thentok,
82 totok, typetok, untiltok, vartok, whiletok, withtok,
83 asmtok, volatiletok, periodperiodperiodtok,
84 datetok, linetok, filetok,
85 attributetok, builtintok, inlinetok,
86 integertok, identtok, realtok, stringtok,
87 virtualrangetok) ;
88
89 VAR
90 NulTok, PlusTok, MinusTok, TimesTok, DivideTok, BecomesTok,
91 AmbersandTok, PeriodTok, CommaTok, SemiColonTok, LParaTok,
92 LSBraTok, LCBraTok, UpArrowTok, SingleQuoteTok, EqualTok,
93 HashTok, LessTok, GreaterTok, LessGreaterTok, LessEqualTok,
94 GreaterEqualTok, LDirectiveTok, RDirectiveTok,
95 PeriodPeriodTok, ColonTok, RParaTok,
96 RSBraTok, RCBraTok, BarTok, DoubleQuotesTok,
97
98 AndTok, ArrayTok, BeginTok, ByTok, CaseTok, ConstTok,
99 DefinitionTok, DivTok, DoTok, ElseTok, ElsifTok, EndTok,
100 ExceptTok, ExitTok, ExportTok, FinallyTok, ForTok,
101 ForwardTok, FromTok,
102 IfTok, ImplementationTok, ImportTok, InTok, LoopTok, ModTok,
103 ModuleTok, NotTok, OfTok, OrTok,
104 PackedSetTok, PointerTok, ProcedureTok,
105 QualifiedTok, UnQualifiedTok, RecordTok, RemTok, RepeatTok,
106 RetryTok, ReturnTok, SetTok, ThenTok, ToTok, TypeTok,
107 UntilTok, VarTok, WhileTok, WithTok,
108
109 EofTok, AsmTok, VolatileTok,
110 DateTok, LineTok, FileTok,
111 AttributeTok, BuiltinTok, InlineTok: Name ;
112
113
114 (*
115 IsReserved - returns TRUE if the symbol, Name, is a reserved word.
116 If TRUE it also sets tok to the appropriate enumerated
117 value.
118 *)
119
120 PROCEDURE IsReserved (n: Name; VAR tok: toktype) : BOOLEAN ;
121
122
123 (*
124 tokToTok - returns a Tok given the enumerated variable, t.
125 *)
126
127 PROCEDURE tokToTok (t: toktype) : Name ;
128
129
130 END M2Reserved.