Debian Codegraph @

gcc/m2/gm2-compiler/M2StateCheck.def

raw
1 (* M2StateCheck.def provide state check tracking for declarations.
2
3 Copyright (C) 2024-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 M2StateCheck ;
23
24 (* This module provides state tracking for VAR, TYPE and CONST
25 declarations. It should be used by any pass creating
26 symbols in these blocks and it will detect a constant
27 being created from a variable, type from a variable,
28 variable from a constant (instead of type) etc. *)
29
30 TYPE
31 StateCheck ;
32
33
34 (*
35 InitState - returns a new initialized StateCheck.
36 *)
37
38 PROCEDURE InitState () : StateCheck ;
39
40
41 (*
42 KillState - destructor for StateCheck.
43 *)
44
45 PROCEDURE KillState (VAR s: StateCheck) ;
46
47
48 (*
49 PushState - duplicates the StateCheck s and chains the new copy to s.
50 Return the copy.
51 *)
52
53 PROCEDURE PushState (VAR s: StateCheck) ;
54
55
56 (*
57 PopState - pops the current state.
58 *)
59
60 PROCEDURE PopState (VAR s: StateCheck) ;
61
62
63 (*
64 InclVar - s := s + {var}.
65 *)
66
67 PROCEDURE InclVar (s: StateCheck) ;
68
69
70 (*
71 InclConst - s := s + {const}.
72 *)
73
74 PROCEDURE InclConst (s: StateCheck) ;
75
76
77 (*
78 InclType - s := s + {type}.
79 *)
80
81 PROCEDURE InclType (s: StateCheck) ;
82
83
84 (*
85 InclConstFunc - s := s + {constfunc}.
86 *)
87
88 PROCEDURE InclConstFunc (s: StateCheck) ;
89
90
91 (*
92 InclVarParam - s := s + {varparam}.
93 *)
94
95 PROCEDURE InclVarParam (s: StateCheck) ;
96
97
98 (*
99 InclConstructor - s := s + {constructor}.
100 *)
101
102 PROCEDURE InclConstructor (s: StateCheck) ;
103
104
105 (*
106 ExclVar - s := s + {var}.
107 *)
108
109 PROCEDURE ExclVar (s: StateCheck) ;
110
111
112 (*
113 ExclConst - s := s + {const}.
114 *)
115
116 PROCEDURE ExclConst (s: StateCheck) ;
117
118
119 (*
120 ExclType - s := s + {type}.
121 *)
122
123 PROCEDURE ExclType (s: StateCheck) ;
124
125
126 (*
127 ExclConstFunc - s := s + {constfunc}.
128 *)
129
130 PROCEDURE ExclConstFunc (s: StateCheck) ;
131
132
133 (*
134 ExclVarParam - s := s + {varparam}.
135 *)
136
137 PROCEDURE ExclVarParam (s: StateCheck) ;
138
139
140 (*
141 ExclConstructor - s := s - {varparam}.
142 *)
143
144 PROCEDURE ExclConstructor (s: StateCheck) ;
145
146
147 (*
148 CheckQualident - checks to see that qualident sym is allowed in the state s.
149 *)
150
151 PROCEDURE CheckQualident (tok: CARDINAL; s: StateCheck; sym: CARDINAL) ;
152
153
154 END M2StateCheck.