Gyoji Compiler
Loading...
Searching...
No Matches
forward.hpp
1/* Copyright 2025 Jonathan S. Arney
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * https://github.com/jarney/gyoji/blob/master/LICENSE
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef _GYOJI_INTERNAL
16#error "This header is intended to be used internally as a part of the Gyoji front-end. Please include frontend.hpp instead."
17#endif
18#pragma once
19
20#include <memory>
21
22// This is the set of forward declarations for
23// the classes that make up the strongly-typed
24// syntax tree. These are roughly organized in
25// heirarchal order with the things that depend
26// on other things indented and appearing below them.
27// The heirarchy is imperfect because some
28// nodes may appear in multiple contexts and
29// some nodes are recursive, so this is only
30// a rough guide for how the classes relate
31// to one another. For a more full picture
32// of their relationships, see the Doxygen
33// documents.
34//
35// When maintaining these declarations, please
36// make sure to maintain both the class forward-declarations
37// as well as the pointer typedefs associated with
38// them so that users of these classes can refer
39// to them without having a dependency on the
40// classes themselves. This is important because
41// there is some recursiveness in the definitions
42// and it's important that these forward declarations
43// resolve that circularity.
45
46//----------------------------
47// Class forward declarations.
48//----------------------------
49 class Terminal;
50
51 class AccessQualifier;
52 class AccessModifier;
53 class UnsafeModifier;
54 class TypeSpecifier;
55 class TypeName;
62 class TypeSpecifierArray;
63
65
68
69 class ClassDeclStart;
70 class ClassArgumentList;
71 class ClassMemberDeclarationList;
72 class ClassMemberDeclaration;
73 class ClassMemberDeclarationVariable;
74 class ClassMemberDeclarationMethod;
75 class ClassMemberDeclarationMethodStatic;
76 class ClassMemberDeclarationDestructor;
77 class ClassDefinition;
78 class ClassDeclaration;
79
80 class TypeDefinition;
81
82 class EnumDefinition;
83 class EnumDefinitionValueList;
84 class EnumDefinitionValue;
85
86 class Expression;
87 class ExpressionPrimary;
88 class ExpressionPrimaryIdentifier;
89 class ExpressionPrimaryNested;
90 class ExpressionPrimaryLiteralChar;
91 class ExpressionPrimaryLiteralString;
92 class ExpressionPrimaryLiteralInt;
93 class ExpressionPrimaryLiteralFloat;
94 class ExpressionPrimaryLiteralBool;
95 class ExpressionPrimaryLiteralNull;
96
97 class ExpressionPostfixArrayIndex;
98 class ExpressionPostfixFunctionCall;
99 class ArgumentExpressionList;
100 class ExpressionPostfixDot;
101 class ExpressionPostfixArrow;
102 class ExpressionPostfixIncDec;
103 class ExpressionUnaryPrefix;
104 class ExpressionUnarySizeofType;
105 class ExpressionCast;
106 class ExpressionBinary;
107 class ExpressionTrinary;
108
109 class StatementList;
110 class Statement;
111 class InitializerExpression;
112 class StructInitializerExpression;
113 class StructInitializerFieldList;
114 class StructInitializerFieldExpression;
116 class StatementBlock;
118 class StatementIfElse;
119 class StatementWhile;
120 class StatementFor;
121 class StatementSwitch;
122 class StatementSwitchContent;
123 class StatementSwitchBlock;
124 class StatementLabel;
125 class StatementGoto;
126 class StatementContinue;
127 class StatementBreak;
128 class StatementReturn;
129
130 class TranslationUnit;
131 class FileStatementList;
132 class FileStatement;
133 class FileStatementFunctionDeclStart;
134 class FileStatementFunctionDefinition;
135 class ScopeBody;
137 class ArrayLength;
138 class FileStatementGlobalDefinition;
139 class GlobalInitializer;
140 class GlobalInitializerExpressionPrimary;
141 class GlobalInitializerAddressofExpressionPrimary;
142 class GlobalInitializerStructInitializerList;
143 class StructInitializerList;
144 class StructInitializer;
145
146 class FileStatementNamespace;
147 class NamespaceDeclaration;
148 class FileStatementUsing;
149 class UsingAs;
150//----------------------------
151// Collection of classes to
152// include in the 'SyntaxNode'
153// variant type.
154//----------------------------
155#define GYOJI_SYNTAX_NODE_VARIANT_LIST \
156 Gyoji::frontend::tree::Terminal*, \
157 Gyoji::frontend::tree::AccessQualifier*, \
158 Gyoji::frontend::tree::AccessModifier*, \
159 Gyoji::frontend::tree::UnsafeModifier*, \
160 Gyoji::frontend::tree::TypeSpecifier*, \
161 Gyoji::frontend::tree:: TypeName*, \
162 Gyoji::frontend::tree:: TypeSpecifierCallArgs*, \
163 Gyoji::frontend::tree:: TypeSpecifierSimple*, \
164 Gyoji::frontend::tree:: TypeSpecifierTemplate*, \
165 Gyoji::frontend::tree:: TypeSpecifierFunctionPointer*, \
166 Gyoji::frontend::tree:: TypeSpecifierPointerTo*, \
167 Gyoji::frontend::tree:: TypeSpecifierReferenceTo*, \
168 Gyoji::frontend::tree:: TypeSpecifierArray*, \
169 Gyoji::frontend::tree::TypeSpecifierList*, \
170 Gyoji::frontend::tree::FunctionDefinitionArgList*, \
171 Gyoji::frontend::tree:: FunctionDefinitionArg*, \
172 Gyoji::frontend::tree:: ClassDeclStart*, \
173 Gyoji::frontend::tree:: ClassArgumentList*, \
174 Gyoji::frontend::tree:: ClassMemberDeclarationVariable*, \
175 Gyoji::frontend::tree:: ClassMemberDeclarationMethod*, \
176 Gyoji::frontend::tree:: ClassMemberDeclarationMethodStatic*, \
177 Gyoji::frontend::tree:: ClassMemberDeclarationDestructor*, \
178 Gyoji::frontend::tree:: ClassMemberDeclaration*, \
179 Gyoji::frontend::tree:: ClassMemberDeclarationList*, \
180 Gyoji::frontend::tree::ClassDefinition*, \
181 Gyoji::frontend::tree::ClassDeclaration*, \
182 Gyoji::frontend::tree::TypeDefinition*, \
183 Gyoji::frontend::tree:: EnumDefinitionValue*, \
184 Gyoji::frontend::tree:: EnumDefinitionValueList*, \
185 Gyoji::frontend::tree::EnumDefinition*, \
186 Gyoji::frontend::tree::Expression*, \
187 Gyoji::frontend::tree:: ExpressionPrimary*, \
188 Gyoji::frontend::tree:: ExpressionPrimaryIdentifier*, \
189 Gyoji::frontend::tree:: ExpressionPrimaryNested*, \
190 Gyoji::frontend::tree:: ExpressionPrimaryLiteralChar*, \
191 Gyoji::frontend::tree:: ExpressionPrimaryLiteralString*, \
192 Gyoji::frontend::tree:: ExpressionPrimaryLiteralInt*, \
193 Gyoji::frontend::tree:: ExpressionPrimaryLiteralFloat*, \
194 Gyoji::frontend::tree:: ExpressionPrimaryLiteralBool*, \
195 Gyoji::frontend::tree:: ExpressionPrimaryLiteralNull*, \
196 Gyoji::frontend::tree:: ExpressionPostfixArrayIndex*, \
197 Gyoji::frontend::tree:: ExpressionPostfixFunctionCall*, \
198 Gyoji::frontend::tree:: ArgumentExpressionList*, \
199 Gyoji::frontend::tree:: ExpressionPostfixDot*, \
200 Gyoji::frontend::tree:: ExpressionPostfixArrow*, \
201 Gyoji::frontend::tree:: ExpressionPostfixIncDec*, \
202 Gyoji::frontend::tree:: ExpressionUnaryPrefix*, \
203 Gyoji::frontend::tree:: ExpressionUnarySizeofType*, \
204 Gyoji::frontend::tree:: ExpressionCast*, \
205 Gyoji::frontend::tree:: ExpressionBinary*, \
206 Gyoji::frontend::tree:: ExpressionTrinary*, \
207 Gyoji::frontend::tree::StatementList*, \
208 Gyoji::frontend::tree:: Statement*, \
209 Gyoji::frontend::tree:: InitializerExpression*, \
210 Gyoji::frontend::tree:: StructInitializerExpression*, \
211 Gyoji::frontend::tree:: StructInitializerFieldList*, \
212 Gyoji::frontend::tree:: StructInitializerFieldExpression*, \
213 Gyoji::frontend::tree:: StatementVariableDeclaration*, \
214 Gyoji::frontend::tree:: StatementBlock*, \
215 Gyoji::frontend::tree:: StatementExpression*, \
216 Gyoji::frontend::tree:: StatementGoto*, \
217 Gyoji::frontend::tree:: StatementIfElse*, \
218 Gyoji::frontend::tree:: StatementWhile*, \
219 Gyoji::frontend::tree:: StatementFor*, \
220 Gyoji::frontend::tree:: StatementSwitch*, \
221 Gyoji::frontend::tree:: StatementSwitchContent*, \
222 Gyoji::frontend::tree:: StatementSwitchBlock*, \
223 Gyoji::frontend::tree:: StatementReturn*, \
224 Gyoji::frontend::tree:: StatementContinue*, \
225 Gyoji::frontend::tree:: StatementBreak*, \
226 Gyoji::frontend::tree:: StatementLabel*, \
227 Gyoji::frontend::tree::TranslationUnit*, \
228 Gyoji::frontend::tree:: FileStatementList*, \
229 Gyoji::frontend::tree:: FileStatement*, \
230 Gyoji::frontend::tree:: FileStatementFunctionDeclStart*, \
231 Gyoji::frontend::tree:: FileStatementFunctionDefinition*, \
232 Gyoji::frontend::tree:: ScopeBody *, \
233 Gyoji::frontend::tree:: FileStatementFunctionDeclaration*, \
234 Gyoji::frontend::tree:: ArrayLength*, \
235 Gyoji::frontend::tree:: GlobalInitializer*, \
236 Gyoji::frontend::tree:: GlobalInitializerExpressionPrimary*, \
237 Gyoji::frontend::tree:: GlobalInitializerAddressofExpressionPrimary*, \
238 Gyoji::frontend::tree:: GlobalInitializerStructInitializerList*, \
239 Gyoji::frontend::tree:: StructInitializerList*, \
240 Gyoji::frontend::tree:: StructInitializer*, \
241 Gyoji::frontend::tree:: FileStatementGlobalDefinition*, \
242 Gyoji::frontend::tree:: FileStatementNamespace*, \
243 Gyoji::frontend::tree:: NamespaceDeclaration*, \
244 Gyoji::frontend::tree:: FileStatementUsing*, \
245 Gyoji::frontend::tree:: UsingAs*
246};
Declares PUBLIC, PROTECTED, or PRIVATE access to functions and members.
Definition tree.hpp:321
This indicates the type of access that may be permitted as UNSPECIFIED, CONST, or VOLATILE.
Definition tree.hpp:262
Represents the declaration of a function.
Definition tree.hpp:982
Represents the list of arguments to a function definition.
Definition tree.hpp:913
Represents an argument in a function definition.
Definition tree.hpp:886
Represents a block of statements in a particular scope.
Definition tree.hpp:1177
This represents a statement in a function or scope that computes an expression.
Definition tree.hpp:1221
This represents an if condition in one of several forms.
Definition tree.hpp:1292
Represents the declaration of a variable inside the scope of a function or block.
Definition tree.hpp:1115
Represents a 'while' statement in a function or scope.
Definition tree.hpp:1395
Represents tokens from the lexer used to represent keywords and identifiers found in the source.
Definition tree.hpp:103
Represents the top-level syntax unit for a source file.
Definition tree.hpp:2889
Represents the name of a type.
Definition tree.hpp:431
Represents arguments to a template type.
Definition tree.hpp:507
Represents a pointer to a function.
Definition tree.hpp:631
Represents the list of arguments to a function pointer (comma-separated list of types)
Definition tree.hpp:945
Represents an unsafe poniter to a specific type.
Definition tree.hpp:701
Represents a safe reference to a specific type.
Definition tree.hpp:792
Represents a simple type.
Definition tree.hpp:545
Represents a type with type-arguments modifying the type's definition.
Definition tree.hpp:595
Represents a type being specified.
Definition tree.hpp:855
Represents the safety/borrow check semantics for a function or block.
Definition tree.hpp:376
Strongly-typed syntax tree.
Definition forward.hpp:44