@galacean/engine-shaderlab 0.0.0-experimental-1.4-small-language.4 → 0.0.0-experimental-backup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/package.json +4 -4
  2. package/dist/browser.js +0 -6608
  3. package/dist/browser.js.map +0 -1
  4. package/dist/browser.min.js +0 -2
  5. package/dist/browser.min.js.map +0 -1
  6. package/dist/browser.verbose.js +0 -7866
  7. package/dist/browser.verbose.js.map +0 -1
  8. package/dist/browser.verbose.min.js +0 -2
  9. package/dist/browser.verbose.min.js.map +0 -1
  10. package/dist/main.js +0 -6604
  11. package/dist/main.js.map +0 -1
  12. package/dist/main.verbose.js +0 -7862
  13. package/dist/main.verbose.js.map +0 -1
  14. package/dist/module.js +0 -6599
  15. package/dist/module.js.map +0 -1
  16. package/dist/module.verbose.js +0 -7854
  17. package/dist/module.verbose.js.map +0 -1
  18. package/types/GSError.d.ts +0 -15
  19. package/types/ParserUtils.d.ts +0 -12
  20. package/types/ShaderLab.d.ts +0 -1
  21. package/types/ShaderLabUtils.d.ts +0 -10
  22. package/types/TempArray.d.ts +0 -5
  23. package/types/codeGen/CodeGenVisitor.d.ts +0 -2
  24. package/types/codeGen/GLES100.d.ts +0 -16
  25. package/types/codeGen/GLES300.d.ts +0 -17
  26. package/types/codeGen/GLESVisitor.d.ts +0 -1
  27. package/types/codeGen/VisitorContext.d.ts +0 -1
  28. package/types/codeGen/index.d.ts +0 -3
  29. package/types/codeGen/types.d.ts +0 -12
  30. package/types/common/BaseScanner.d.ts +0 -2
  31. package/types/common/BaseSymbolTable.d.ts +0 -18
  32. package/types/common/BaseToken.d.ts +0 -12
  33. package/types/common/Enums.d.ts +0 -5
  34. package/types/common/Keywords.d.ts +0 -99
  35. package/types/common/ShaderPosition.d.ts +0 -8
  36. package/types/common/ShaderRange.d.ts +0 -8
  37. package/types/common/index.d.ts +0 -5
  38. package/types/common/types.d.ts +0 -102
  39. package/types/contentParser/ContentSymbolTable.d.ts +0 -10
  40. package/types/contentParser/KeywordMap.d.ts +0 -2
  41. package/types/contentParser/Scanner.d.ts +0 -10
  42. package/types/contentParser/ShaderContentParser.d.ts +0 -1
  43. package/types/contentParser/index.d.ts +0 -1
  44. package/types/index.d.ts +0 -4
  45. package/types/lalr/CFG.d.ts +0 -5
  46. package/types/lalr/LALR1.d.ts +0 -26
  47. package/types/lalr/Production.d.ts +0 -9
  48. package/types/lalr/State.d.ts +0 -20
  49. package/types/lalr/StateItem.d.ts +0 -20
  50. package/types/lalr/Utils.d.ts +0 -22
  51. package/types/lalr/index.d.ts +0 -2
  52. package/types/lalr/types.d.ts +0 -14
  53. package/types/lexer/Lexer.d.ts +0 -18
  54. package/types/lexer/Utils.d.ts +0 -7
  55. package/types/lexer/index.d.ts +0 -1
  56. package/types/parser/AST.d.ts +0 -347
  57. package/types/parser/Grammar.d.ts +0 -11
  58. package/types/parser/GrammarSymbol.d.ts +0 -107
  59. package/types/parser/SemanticAnalyzer.d.ts +0 -2
  60. package/types/parser/ShaderInfo.d.ts +0 -8
  61. package/types/parser/ShaderTargetParser.d.ts +0 -23
  62. package/types/parser/builtin/functions.d.ts +0 -34
  63. package/types/parser/builtin/index.d.ts +0 -2
  64. package/types/parser/builtin/variables.d.ts +0 -11
  65. package/types/parser/index.d.ts +0 -2
  66. package/types/parser/symbolTable/FnSymbol.d.ts +0 -6
  67. package/types/parser/symbolTable/StructSymbol.d.ts +0 -6
  68. package/types/parser/symbolTable/SymbolDataType.d.ts +0 -8
  69. package/types/parser/symbolTable/SymbolInfo.d.ts +0 -18
  70. package/types/parser/symbolTable/TargetSymbolTable.d.ts +0 -13
  71. package/types/parser/symbolTable/VarSymbol.d.ts +0 -8
  72. package/types/parser/symbolTable/index.d.ts +0 -6
  73. package/types/parser/types.d.ts +0 -23
  74. package/types/preprocessor/MacroDefine.d.ts +0 -13
  75. package/types/preprocessor/PpParser.d.ts +0 -7
  76. package/types/preprocessor/PpScanner.d.ts +0 -51
  77. package/types/preprocessor/Preprocessor.d.ts +0 -1
  78. package/types/preprocessor/Utils.d.ts +0 -10
  79. package/types/preprocessor/constants.d.ts +0 -56
  80. package/types/preprocessor/index.d.ts +0 -1
  81. package/types/preprocessor/sourceMap/index.d.ts +0 -37
@@ -1,347 +0,0 @@
1
- import { BuiltinVariable } from "./builtin";
2
- import { ClearableObjectPool, IPoolElement } from "@galacean/engine";
3
- import { CodeGenVisitor } from "../codeGen";
4
- import { EKeyword, GalaceanDataType, ShaderRange, TokenType } from "../common";
5
- import { BaseToken, BaseToken as Token } from "../common/BaseToken";
6
- import { NoneTerminal } from "./GrammarSymbol";
7
- import SemanticAnalyzer from "./SemanticAnalyzer";
8
- import { ShaderData } from "./ShaderInfo";
9
- import { FnSymbol, StructSymbol, VarSymbol } from "./symbolTable";
10
- import { IParamInfo, NodeChild, StructProp, SymbolType } from "./types";
11
- export declare abstract class TreeNode implements IPoolElement {
12
- static pool: ClearableObjectPool<TreeNode & {
13
- set: (loc: ShaderRange, children: NodeChild[]) => void;
14
- }>;
15
- /** The non-terminal in grammar. */
16
- nt: NoneTerminal;
17
- private _children;
18
- private _location;
19
- get children(): NodeChild[];
20
- get location(): ShaderRange;
21
- set(loc: ShaderRange, children: NodeChild[]): void;
22
- init(): void;
23
- dispose(): void;
24
- codeGen(visitor: CodeGenVisitor): string;
25
- /**
26
- * Do semantic analyze right after the ast node is generated.
27
- */
28
- semanticAnalyze(sa: SemanticAnalyzer): void;
29
- }
30
- export declare namespace ASTNode {
31
- export type ASTNodePool = ClearableObjectPool<{
32
- set: (loc: ShaderRange, children: NodeChild[]) => void;
33
- } & IPoolElement & TreeNode>;
34
- export function _unwrapToken(node: NodeChild): BaseToken<number>;
35
- export function get(pool: ASTNodePool, sa: SemanticAnalyzer, loc: ShaderRange, children: NodeChild[]): void;
36
- export class TrivialNode extends TreeNode {
37
- }
38
- export class ScopeBrace extends TreeNode {
39
- semanticAnalyze(sa: SemanticAnalyzer): void;
40
- }
41
- export class ScopeEndBrace extends TreeNode {
42
- semanticAnalyze(sa: SemanticAnalyzer): void;
43
- }
44
- export class JumpStatement extends TreeNode {
45
- isFragReturnStatement: boolean;
46
- init(): void;
47
- semanticAnalyze(sa: SemanticAnalyzer): void;
48
- codeGen(visitor: CodeGenVisitor): string;
49
- }
50
- export class ConditionOpt extends TreeNode {
51
- }
52
- export class ForRestStatement extends TreeNode {
53
- }
54
- export class Condition extends TreeNode {
55
- }
56
- export class ForInitStatement extends TreeNode {
57
- }
58
- export class IterationStatement extends TreeNode {
59
- }
60
- export class SelectionStatement extends TreeNode {
61
- }
62
- export class ExpressionStatement extends TreeNode {
63
- }
64
- export abstract class ExpressionAstNode extends TreeNode {
65
- protected _type?: GalaceanDataType;
66
- set type(t: GalaceanDataType | undefined);
67
- get type(): GalaceanDataType | undefined;
68
- init(): void;
69
- }
70
- export class InitializerList extends ExpressionAstNode {
71
- semanticAnalyze(sa: SemanticAnalyzer): void;
72
- }
73
- export class Initializer extends ExpressionAstNode {
74
- semanticAnalyze(sa: SemanticAnalyzer): void;
75
- }
76
- export class SingleDeclaration extends TreeNode {
77
- typeSpecifier: TypeSpecifier;
78
- arraySpecifier?: ArraySpecifier;
79
- init(): void;
80
- semanticAnalyze(sa: SemanticAnalyzer): void;
81
- codeGen(visitor: CodeGenVisitor): string;
82
- }
83
- export class FullySpecifiedType extends TreeNode {
84
- typeSpecifier: TypeSpecifier;
85
- type: GalaceanDataType;
86
- semanticAnalyze(_: SemanticAnalyzer): void;
87
- }
88
- export class TypeQualifier extends TreeNode {
89
- }
90
- export class SingleTypeQualifier extends TreeNode {
91
- qualifier: EKeyword;
92
- lexeme: string;
93
- semanticAnalyze(sa: SemanticAnalyzer): void;
94
- }
95
- abstract class BasicTypeQualifier extends TreeNode {
96
- qualifier: EKeyword;
97
- lexeme: string;
98
- semanticAnalyze(sa: SemanticAnalyzer): void;
99
- }
100
- export class StorageQualifier extends BasicTypeQualifier {
101
- }
102
- export class PrecisionQualifier extends BasicTypeQualifier {
103
- }
104
- export class InterpolationQualifier extends BasicTypeQualifier {
105
- }
106
- export class InvariantQualifier extends BasicTypeQualifier {
107
- }
108
- export class TypeSpecifier extends TreeNode {
109
- type: GalaceanDataType;
110
- lexeme: string;
111
- arraySize?: number;
112
- isCustom: boolean;
113
- init(): void;
114
- get arraySpecifier(): ArraySpecifier;
115
- semanticAnalyze(sa: SemanticAnalyzer): void;
116
- }
117
- export class ArraySpecifier extends TreeNode {
118
- size: number | undefined;
119
- semanticAnalyze(sa: SemanticAnalyzer): void;
120
- }
121
- export class IntegerConstantExpressionOperator extends TreeNode {
122
- compute: (a: number, b: number) => number;
123
- lexeme: string;
124
- semanticAnalyze(sa: SemanticAnalyzer): void;
125
- }
126
- export class IntegerConstantExpression extends TreeNode {
127
- value?: number;
128
- init(): void;
129
- semanticAnalyze(sa: SemanticAnalyzer): void;
130
- }
131
- export class TypeSpecifierNonArray extends TreeNode {
132
- type: GalaceanDataType;
133
- lexeme: string;
134
- init(): void;
135
- }
136
- export class ExtBuiltinTypeSpecifierNonArray extends TreeNode {
137
- type: TokenType;
138
- lexeme: string;
139
- init(): void;
140
- }
141
- export class InitDeclaratorList extends TreeNode {
142
- typeInfo: SymbolType;
143
- semanticAnalyze(sa: SemanticAnalyzer): void;
144
- }
145
- export class IdentifierList extends TreeNode {
146
- idList: Token[];
147
- init(): void;
148
- semanticAnalyze(sa: SemanticAnalyzer): void;
149
- }
150
- export class Declaration extends TreeNode {
151
- codeGen(visitor: CodeGenVisitor): string;
152
- }
153
- export class FunctionProtoType extends TreeNode {
154
- ident: Token;
155
- returnType: FullySpecifiedType;
156
- parameterList: IParamInfo[];
157
- paramSig: GalaceanDataType[];
158
- semanticAnalyze(sa: SemanticAnalyzer): void;
159
- codeGen(visitor: CodeGenVisitor): string;
160
- }
161
- export class FunctionDeclarator extends TreeNode {
162
- ident: Token;
163
- returnType: FullySpecifiedType;
164
- parameterInfoList: IParamInfo[] | undefined;
165
- paramSig: GalaceanDataType[] | undefined;
166
- semanticAnalyze(sa: SemanticAnalyzer): void;
167
- }
168
- export class FunctionHeader extends TreeNode {
169
- ident: Token;
170
- returnType: FullySpecifiedType;
171
- semanticAnalyze(sa: SemanticAnalyzer): void;
172
- codeGen(visitor: CodeGenVisitor): string;
173
- }
174
- export class FunctionParameterList extends TreeNode {
175
- parameterInfoList: IParamInfo[];
176
- paramSig: GalaceanDataType[];
177
- init(): void;
178
- semanticAnalyze(sa: SemanticAnalyzer): void;
179
- codeGen(visitor: CodeGenVisitor): string;
180
- }
181
- export class ParameterDeclaration extends TreeNode {
182
- typeQualifier: TypeQualifier | undefined;
183
- typeInfo: SymbolType;
184
- ident: Token;
185
- init(): void;
186
- semanticAnalyze(sa: SemanticAnalyzer): void;
187
- }
188
- export class ParameterDeclarator extends TreeNode {
189
- ident: Token;
190
- typeInfo: SymbolType;
191
- semanticAnalyze(sa: SemanticAnalyzer): void;
192
- }
193
- export class SimpleStatement extends TreeNode {
194
- }
195
- export class CompoundStatement extends TreeNode {
196
- }
197
- export class CompoundStatementNoScope extends TreeNode {
198
- }
199
- export class Statement extends TreeNode {
200
- }
201
- export class StatementList extends TreeNode {
202
- codeGen(visitor: CodeGenVisitor): string;
203
- }
204
- export class FunctionDefinition extends TreeNode {
205
- returnStatement?: ASTNode.JumpStatement;
206
- protoType: FunctionProtoType;
207
- statements: CompoundStatementNoScope;
208
- init(): void;
209
- semanticAnalyze(sa: SemanticAnalyzer): void;
210
- codeGen(visitor: CodeGenVisitor): string;
211
- }
212
- export class FunctionCall extends ExpressionAstNode {
213
- semanticAnalyze(sa: SemanticAnalyzer): void;
214
- codeGen(visitor: CodeGenVisitor): string;
215
- }
216
- export class FunctionCallGeneric extends ExpressionAstNode {
217
- fnSymbol: FnSymbol | StructSymbol | undefined;
218
- init(): void;
219
- semanticAnalyze(sa: SemanticAnalyzer): void;
220
- }
221
- export class FunctionCallParameterList extends TreeNode {
222
- paramSig: GalaceanDataType[];
223
- paramNodes: AssignmentExpression[];
224
- init(): void;
225
- semanticAnalyze(sa: SemanticAnalyzer): void;
226
- }
227
- export class PrecisionSpecifier extends TreeNode {
228
- semanticAnalyze(sa: SemanticAnalyzer): void;
229
- }
230
- export class FunctionIdentifier extends TreeNode {
231
- ident: GalaceanDataType;
232
- lexeme: string;
233
- isBuiltin: boolean;
234
- semanticAnalyze(sa: SemanticAnalyzer): void;
235
- codeGen(visitor: CodeGenVisitor): string;
236
- }
237
- export class AssignmentExpression extends ExpressionAstNode {
238
- semanticAnalyze(sa: SemanticAnalyzer): void;
239
- }
240
- export class AssignmentOperator extends TreeNode {
241
- }
242
- export class Expression extends ExpressionAstNode {
243
- semanticAnalyze(sa: SemanticAnalyzer): void;
244
- }
245
- export class PrimaryExpression extends ExpressionAstNode {
246
- semanticAnalyze(sa: SemanticAnalyzer): void;
247
- }
248
- export class PostfixExpression extends ExpressionAstNode {
249
- init(): void;
250
- codeGen(visitor: CodeGenVisitor): string;
251
- }
252
- export class UnaryOperator extends TreeNode {
253
- }
254
- export class UnaryExpression extends ExpressionAstNode {
255
- init(): void;
256
- }
257
- export class MultiplicativeExpression extends ExpressionAstNode {
258
- init(): void;
259
- }
260
- export class AdditiveExpression extends ExpressionAstNode {
261
- init(): void;
262
- }
263
- export class ShiftExpression extends ExpressionAstNode {
264
- semanticAnalyze(sa: SemanticAnalyzer): void;
265
- }
266
- export class RelationalExpression extends ExpressionAstNode {
267
- semanticAnalyze(sa: SemanticAnalyzer): void;
268
- }
269
- export class EqualityExpression extends ExpressionAstNode {
270
- semanticAnalyze(sa: SemanticAnalyzer): void;
271
- }
272
- export class AndExpression extends ExpressionAstNode {
273
- semanticAnalyze(sa: SemanticAnalyzer): void;
274
- }
275
- export class ExclusiveOrExpression extends ExpressionAstNode {
276
- semanticAnalyze(sa: SemanticAnalyzer): void;
277
- }
278
- export class InclusiveOrExpression extends ExpressionAstNode {
279
- semanticAnalyze(sa: SemanticAnalyzer): void;
280
- }
281
- export class LogicalAndExpression extends ExpressionAstNode {
282
- semanticAnalyze(sa: SemanticAnalyzer): void;
283
- }
284
- export class LogicalXorExpression extends ExpressionAstNode {
285
- semanticAnalyze(sa: SemanticAnalyzer): void;
286
- }
287
- export class LogicalOrExpression extends ExpressionAstNode {
288
- semanticAnalyze(sa: SemanticAnalyzer): void;
289
- }
290
- export class ConditionalExpression extends ExpressionAstNode {
291
- semanticAnalyze(sa: SemanticAnalyzer): void;
292
- }
293
- export class StructSpecifier extends TreeNode {
294
- ident?: Token;
295
- propList: StructProp[];
296
- init(): void;
297
- semanticAnalyze(sa: SemanticAnalyzer): void;
298
- }
299
- export class StructDeclarationList extends TreeNode {
300
- propList: StructProp[];
301
- init(): void;
302
- semanticAnalyze(sa: SemanticAnalyzer): void;
303
- }
304
- export class StructDeclaration extends TreeNode {
305
- typeSpecifier: TypeSpecifier;
306
- declaratorList: StructDeclaratorList;
307
- props: StructProp[];
308
- init(): void;
309
- semanticAnalyze(sa: SemanticAnalyzer): void;
310
- }
311
- export class LayoutQualifier extends TreeNode {
312
- index: number;
313
- semanticAnalyze(sa: SemanticAnalyzer): void;
314
- }
315
- export class StructDeclaratorList extends TreeNode {
316
- declaratorList: StructDeclarator[];
317
- init(): void;
318
- semanticAnalyze(sa: SemanticAnalyzer): void;
319
- }
320
- export class StructDeclarator extends TreeNode {
321
- ident: Token;
322
- arraySpecifier: ArraySpecifier | undefined;
323
- init(): void;
324
- semanticAnalyze(sa: SemanticAnalyzer): void;
325
- }
326
- export class VariableDeclaration extends TreeNode {
327
- type: FullySpecifiedType;
328
- semanticAnalyze(sa: SemanticAnalyzer): void;
329
- codeGen(visitor: CodeGenVisitor): string;
330
- }
331
- export class VariableDeclarationList extends TreeNode {
332
- type: FullySpecifiedType;
333
- semanticAnalyze(sa: SemanticAnalyzer): void;
334
- }
335
- export class VariableIdentifier extends TreeNode {
336
- symbolInfo: VarSymbol | BuiltinVariable | null;
337
- lexeme: string;
338
- typeInfo: GalaceanDataType;
339
- semanticAnalyze(sa: SemanticAnalyzer): void;
340
- codeGen(visitor: CodeGenVisitor): string;
341
- }
342
- export class GLShaderProgram extends TreeNode {
343
- shaderData: ShaderData;
344
- semanticAnalyze(sa: SemanticAnalyzer): void;
345
- }
346
- export {};
347
- }
@@ -1,11 +0,0 @@
1
- import { NoneTerminal, GrammarSymbol } from "./GrammarSymbol";
2
- import Production from "../lalr/Production";
3
- export declare class Grammar {
4
- readonly productions: Production[];
5
- readonly startSymbol: NoneTerminal;
6
- static create(start: NoneTerminal, productions: GrammarSymbol[][]): Grammar;
7
- constructor(start: NoneTerminal, productions: Production[]);
8
- getProductionList(nonTerminal: NoneTerminal): Production[];
9
- isNullableNT(NT: NoneTerminal): Production;
10
- getProductionByID(pid: number): Production;
11
- }
@@ -1,107 +0,0 @@
1
- import { TokenType } from "../common";
2
- export type Terminal = TokenType;
3
- export declare enum NoneTerminal {
4
- START = 2000,
5
- gs_shader_program = 2001,
6
- global_declaration = 2002,
7
- variable_declaration = 2003,
8
- variable_declaration_list = 2004,
9
- variable_declaration_statement = 2005,
10
- array_specifier_list = 2006,
11
- array_specifier = 2007,
12
- ext_builtin_type_specifier_nonarray = 2008,
13
- precision_specifier = 2009,
14
- variable_identifier = 2010,
15
- variable_identifier_node = 2011,
16
- primary_expression = 2012,
17
- postfix_expression = 2013,
18
- integer_expression = 2014,
19
- function_call = 2015,
20
- function_call_generic = 2016,
21
- function_call_header_no_parameters = 2017,
22
- function_call_header_with_parameters = 2018,
23
- function_call_parameter_list = 2019,
24
- function_call_header = 2020,
25
- function_identifier = 2021,
26
- constructor_identifier = 2022,
27
- unary_expression = 2023,
28
- unary_operator = 2024,
29
- multiplicative_expression = 2025,
30
- additive_expression = 2026,
31
- shift_expression = 2027,
32
- relational_expression = 2028,
33
- equality_expression = 2029,
34
- and_expression = 2030,
35
- inclusive_or_expression = 2031,
36
- exclusive_or_expression = 2032,
37
- logical_and_expression = 2033,
38
- logical_xor_expression = 2034,
39
- logical_or_expression = 2035,
40
- conditional_expression = 2036,
41
- assignment_expression = 2037,
42
- assignment_operator = 2038,
43
- expression = 2039,
44
- integer_constant_expression = 2040,
45
- integer_constant_expression_operator = 2041,
46
- declaration = 2042,
47
- function_prototype = 2043,
48
- function_declarator = 2044,
49
- function_header_with_parameters = 2045,
50
- function_header = 2046,
51
- function_parameter_list = 2047,
52
- parameter_declarator = 2048,
53
- parameter_declaration = 2049,
54
- parameter_qualifier = 2050,
55
- parameter_type_specifier = 2051,
56
- init_declarator_list = 2052,
57
- single_declaration = 2053,
58
- fully_specified_type = 2054,
59
- type_qualifier = 2055,
60
- single_type_qualifier = 2056,
61
- storage_qualifier = 2057,
62
- precision_qualifier = 2058,
63
- interpolation_qualifier = 2059,
64
- invariant_qualifier = 2060,
65
- type_specifier = 2061,
66
- type_specifier_nonarray = 2062,
67
- type_specifier_no_prec = 2063,
68
- basic_type = 2064,
69
- struct_specifier = 2065,
70
- struct_declaration_list = 2066,
71
- struct_declaration = 2067,
72
- layout_qualifier = 2068,
73
- struct_declarator_list = 2069,
74
- struct_declarator = 2070,
75
- identifier_list = 2071,
76
- decl_identifier = 2072,
77
- initializer = 2073,
78
- initializer_list = 2074,
79
- declaration_statement = 2075,
80
- simple_statement = 2076,
81
- compound_statement_no_scope = 2077,
82
- statement_with_scope = 2078,
83
- compound_statement = 2079,
84
- statement = 2080,
85
- statement_list = 2081,
86
- iteration_statement_no_new_scope = 2082,
87
- expression_statement = 2083,
88
- selection_statement = 2084,
89
- selection_rest_statement = 2085,
90
- condition = 2086,
91
- conditionopt = 2087,
92
- iteration_statement = 2088,
93
- for_init_statement = 2089,
94
- for_rest_statement = 2090,
95
- jump_statement = 2091,
96
- external_declaration = 2092,
97
- function_definition = 2093,
98
- field_selection = 2094,
99
- bool_constant = 2095,
100
- function_identifier_node = 2096,
101
- typename_identifier_node = 2097,
102
- scope_brace = 2098,
103
- scope_end_brace = 2099,
104
- _ignore = 2100
105
- }
106
- export type GrammarSymbol = Terminal | NoneTerminal;
107
- export type Derivation = GrammarSymbol[];
@@ -1,2 +0,0 @@
1
- import { NodeChild } from "./types";
2
- export type TranslationRule<T = any> = (sa: SemanticAnalyzer, ...tokens: NodeChild[]) => T;
@@ -1,8 +0,0 @@
1
- import { ASTNode } from "./AST";
2
- import { TargetSymbolTable } from "../parser/symbolTable";
3
- export declare class ShaderData {
4
- symbolTable: TargetSymbolTable;
5
- vertexMain: ASTNode.FunctionDefinition;
6
- fragmentMain: ASTNode.FunctionDefinition;
7
- globalPrecisions: ASTNode.PrecisionSpecifier[];
8
- }
@@ -1,23 +0,0 @@
1
- import { Grammar } from "./Grammar";
2
- import { BaseToken } from "../common/BaseToken";
3
- import { StateActionTable, StateGotoTable } from "../lalr/types";
4
- import { ASTNode } from "./AST";
5
- import SematicAnalyzer from "./SemanticAnalyzer";
6
- /**
7
- * The syntax parser and sematic analyzer of `ShaderLab` compiler
8
- */
9
- export declare class ShaderTargetParser {
10
- readonly actionTable: StateActionTable;
11
- readonly gotoTable: StateGotoTable;
12
- readonly grammar: Grammar;
13
- readonly sematicAnalyzer: SematicAnalyzer;
14
- private _traceBackStack;
15
- private get curState();
16
- private get stateActionTable();
17
- private get stateGotoTable();
18
- static _singleton: ShaderTargetParser;
19
- static create(): ShaderTargetParser;
20
- private constructor();
21
- parse(tokens: Generator<BaseToken, BaseToken>): ASTNode.GLShaderProgram | null;
22
- private _printStack;
23
- }
@@ -1,34 +0,0 @@
1
- import { GalaceanDataType } from "../../common";
2
- import { EShaderStage } from "../../common/Enums";
3
- export declare enum EGenType {
4
- GenType = 200,
5
- GenIntType = 201,
6
- GenUintType = 202,
7
- GenBoolType = 203,
8
- Mat = 204,
9
- BoolVec = 205,
10
- IntVec = 206,
11
- UintVec = 207,
12
- Vec = 208,
13
- GVec4 = 209,
14
- GSampler2D = 210,
15
- GSampler3D = 211,
16
- GSamplerCube = 212,
17
- GSampler2DArray = 213
18
- }
19
- export type NonGenericGalaceanType = Exclude<GalaceanDataType, string>;
20
- type BuiltinType = NonGenericGalaceanType | EGenType;
21
- export declare class BuiltinFunction {
22
- ident: string;
23
- readonly args: BuiltinType[];
24
- readonly scope: EShaderStage;
25
- private _returnType;
26
- private _realReturnType;
27
- get realReturnType(): NonGenericGalaceanType;
28
- private constructor();
29
- static getReturnType(fn: BuiltinFunction, genType?: NonGenericGalaceanType): NonGenericGalaceanType;
30
- static _create(ident: string, returnType: BuiltinType, ...args: BuiltinType[]): void;
31
- static _createWithScop(ident: string, returnType: BuiltinType, scope: EShaderStage, ...args: BuiltinType[]): void;
32
- static getFn(ident: string, parameterTypes: NonGenericGalaceanType[]): BuiltinFunction | undefined;
33
- }
34
- export {};
@@ -1,2 +0,0 @@
1
- export * from "./functions";
2
- export * from "./variables";
@@ -1,11 +0,0 @@
1
- import { GalaceanDataType } from "../../common";
2
- import { EShaderStage } from "../../common/Enums";
3
- export declare const BuiltinVariableTable: Map<string, BuiltinVariable>;
4
- export declare class BuiltinVariable {
5
- type: GalaceanDataType;
6
- lexeme: string;
7
- scope: EShaderStage;
8
- private constructor();
9
- static createVariable(lexeme: string, type: GalaceanDataType, scope?: EShaderStage): void;
10
- static getVar(ident: string): BuiltinVariable;
11
- }
@@ -1,2 +0,0 @@
1
- export { ShaderTargetParser } from "./ShaderTargetParser";
2
- export { Grammar } from "./Grammar";
@@ -1,6 +0,0 @@
1
- import { ASTNode } from "../AST";
2
- import { SymbolInfo } from "./SymbolInfo";
3
- export declare class FnSymbol extends SymbolInfo {
4
- astNode: ASTNode.FunctionDefinition;
5
- constructor(lexeme: string, astNode: ASTNode.FunctionDefinition);
6
- }
@@ -1,6 +0,0 @@
1
- import { ASTNode } from "../AST";
2
- import { SymbolInfo } from "./SymbolInfo";
3
- export declare class StructSymbol extends SymbolInfo {
4
- astNode: ASTNode.StructSpecifier;
5
- constructor(lexeme: string, astNode: ASTNode.StructSpecifier);
6
- }
@@ -1,8 +0,0 @@
1
- import { GalaceanDataType } from "../../common";
2
- import { ASTNode } from "../AST";
3
- export declare class SymbolDataType {
4
- type: GalaceanDataType;
5
- typeLexeme: string;
6
- arraySpecifier?: ASTNode.ArraySpecifier;
7
- constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
8
- }
@@ -1,18 +0,0 @@
1
- import { IBaseSymbol } from "../../common/BaseSymbolTable";
2
- import { GalaceanDataType } from "../../common/types";
3
- import { ASTNode } from "../AST";
4
- import { SymbolDataType } from "./SymbolDataType";
5
- export declare enum ESymbolType {
6
- VAR = 0,
7
- FN = 1,
8
- STRUCT = 2
9
- }
10
- export type SymbolAstNode = ASTNode.Initializer | ASTNode.StructSpecifier | ASTNode.FunctionDefinition | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration;
11
- export declare class SymbolInfo implements IBaseSymbol {
12
- readonly ident: string;
13
- readonly symbolType: ESymbolType;
14
- readonly astNode?: SymbolAstNode;
15
- readonly dataType?: SymbolDataType;
16
- readonly signature?: GalaceanDataType[];
17
- constructor(ident: string, symbolType: ESymbolType, astNode?: SymbolAstNode, dataType?: SymbolDataType, signature?: GalaceanDataType[]);
18
- }
@@ -1,13 +0,0 @@
1
- import { GalaceanDataType } from "../../common";
2
- import { BaseSymbolTable } from "../../common/BaseSymbolTable";
3
- import { ASTNode } from "../AST";
4
- import { FnSymbol } from "./FnSymbol";
5
- import { StructSymbol } from "./StructSymbol";
6
- import { ESymbolType, SymbolInfo } from "./SymbolInfo";
7
- import { VarSymbol } from "./VarSymbol";
8
- export declare class TargetSymbolTable extends BaseSymbolTable<SymbolInfo> {
9
- insert(sm: SymbolInfo): void;
10
- lookup<T extends ESymbolType>(ident: string, symbolType: T, signature?: GalaceanDataType[], astNode?: ASTNode.FunctionDefinition): T extends ESymbolType.FN ? FnSymbol : T extends ESymbolType.STRUCT ? StructSymbol : T extends ESymbolType.VAR ? VarSymbol : SymbolInfo;
11
- getAllFnSymbols(fnIdent: string): FnSymbol[];
12
- private _compareWith;
13
- }
@@ -1,8 +0,0 @@
1
- import { ASTNode } from "../AST";
2
- import { SymbolDataType } from "./SymbolDataType";
3
- import { SymbolInfo } from "./SymbolInfo";
4
- export declare class VarSymbol extends SymbolInfo {
5
- astNode: ASTNode.Initializer | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration;
6
- readonly isGlobalVariable: boolean;
7
- constructor(ident: string, dataType: SymbolDataType, isGlobalVariable: boolean, initAst: ASTNode.Initializer | ASTNode.ParameterDeclarator | ASTNode.InitDeclaratorList | ASTNode.VariableDeclaration);
8
- }
@@ -1,6 +0,0 @@
1
- export * from "./FnSymbol";
2
- export * from "./StructSymbol";
3
- export * from "./SymbolDataType";
4
- export * from "./SymbolInfo";
5
- export * from "./TargetSymbolTable";
6
- export * from "./VarSymbol";
@@ -1,23 +0,0 @@
1
- import { NoneTerminal } from "./GrammarSymbol";
2
- import { BaseToken } from "../common/BaseToken";
3
- import { GalaceanDataType } from "../common";
4
- import { ASTNode, TreeNode } from "./AST";
5
- export type TraceStackItem = NoneTerminal | BaseToken;
6
- export declare class SymbolType {
7
- type: GalaceanDataType;
8
- typeLexeme: string;
9
- arraySpecifier?: ASTNode.ArraySpecifier;
10
- constructor(type: GalaceanDataType, typeLexeme: string, arraySpecifier?: ASTNode.ArraySpecifier);
11
- }
12
- export declare class StructProp implements IParamInfo {
13
- typeInfo: SymbolType;
14
- ident: BaseToken;
15
- mrtIndex?: number;
16
- constructor(typeInfo: SymbolType, ident: BaseToken, mrtIndex?: number);
17
- }
18
- export type NodeChild = TreeNode | BaseToken;
19
- export type IParamInfo = {
20
- ident: BaseToken;
21
- typeInfo: SymbolType;
22
- astNode?: TreeNode;
23
- };
@@ -1,13 +0,0 @@
1
- import { BaseToken } from "../common/BaseToken";
2
- import { ShaderRange } from "../common";
3
- export declare class MacroDefine {
4
- readonly macro: BaseToken;
5
- readonly body?: BaseToken;
6
- readonly location?: ShaderRange;
7
- readonly args?: BaseToken[];
8
- private _replaceRegex?;
9
- private readonly _argsLexemes;
10
- get isFunction(): boolean;
11
- constructor(macro: BaseToken, body?: BaseToken, location?: ShaderRange, args?: BaseToken[]);
12
- expandFunctionBody(args: string[]): string;
13
- }