@galacean/engine-shaderlab 0.0.0-experimental-1.4-small-language.3 → 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,15 +0,0 @@
1
- import { ShaderPosition } from "./common/ShaderPosition";
2
- import { ShaderRange } from "./common/ShaderRange";
3
- export declare class GSError extends Error {
4
- readonly location: ShaderRange | ShaderPosition;
5
- readonly source: string;
6
- readonly file?: string;
7
- static wrappingLineCount: number;
8
- constructor(name: GSErrorName, message: string, location: ShaderRange | ShaderPosition, source: string, file?: string);
9
- toString(): string;
10
- }
11
- export declare enum GSErrorName {
12
- PreprocessorError = "PreprocessorError",
13
- CompilationError = "CompilationError",
14
- ScannerError = "ScannerError"
15
- }
@@ -1,12 +0,0 @@
1
- import { NoneTerminal, GrammarSymbol } from "./parser/GrammarSymbol";
2
- import { GalaceanDataType } from "./common";
3
- import { TreeNode } from "./parser/AST";
4
- export declare class ParserUtils {
5
- static unwrapNodeByType<T = TreeNode>(node: TreeNode, type: NoneTerminal): T | undefined;
6
- /**
7
- * Check if type `tb` is compatible with type `ta`.
8
- */
9
- static typeCompatible(ta: GalaceanDataType, tb: GalaceanDataType | undefined): boolean;
10
- static toString(sm: GrammarSymbol): string;
11
- static isTerminal(sm: GrammarSymbol): boolean;
12
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { ClearableObjectPool, IPoolElement } from "@galacean/engine";
2
- import { GSErrorName } from "./GSError";
3
- import { ShaderRange } from "./common/ShaderRange";
4
- import { ShaderPosition } from "./common/ShaderPosition";
5
- export declare class ShaderLabUtils {
6
- private static _shaderLabObjectPoolSet;
7
- static createObjectPool<T extends IPoolElement>(type: new () => T): ClearableObjectPool<T>;
8
- static clearAllShaderLabObjectPool(): void;
9
- static createGSError(message: string, errorName: GSErrorName, source: string, location: ShaderRange | ShaderPosition, file?: string): Error | undefined;
10
- }
@@ -1,5 +0,0 @@
1
- import { IPoolElement } from "@galacean/engine";
2
- export declare class TempArray<T> implements IPoolElement {
3
- array: Array<T>;
4
- dispose(): void;
5
- }
@@ -1,2 +0,0 @@
1
- export declare const V3_GL_FragColor = "GS_glFragColor";
2
- export declare const V3_GL_FragData = "GS_glFragData";
@@ -1,16 +0,0 @@
1
- import { ASTNode } from "../parser/AST";
2
- import { GLESVisitor } from "./GLESVisitor";
3
- import { ICodeSegment } from "./types";
4
- export declare class GLES100Visitor extends GLESVisitor {
5
- _versionText: string;
6
- _extensions: string;
7
- private static _singleton;
8
- static getVisitor(): GLES100Visitor;
9
- getFragDataCodeGen(index: string | number): string;
10
- getReferencedMRTPropText(index: string | number, ident: string): string;
11
- getAttributeDeclare(out: ICodeSegment[]): void;
12
- getVaryingDeclare(out: ICodeSegment[]): void;
13
- getMRTDeclare(out: ICodeSegment[]): void;
14
- visitPostfixExpression(node: ASTNode.PostfixExpression): string;
15
- visitJumpStatement(node: ASTNode.JumpStatement): string;
16
- }
@@ -1,17 +0,0 @@
1
- import { ASTNode } from "../parser/AST";
2
- import { GLESVisitor } from "./GLESVisitor";
3
- import { ICodeSegment } from "./types";
4
- export declare class GLES300Visitor extends GLESVisitor {
5
- _versionText: string;
6
- private static _singleton;
7
- static getVisitor(): GLES300Visitor;
8
- getFragDataCodeGen(index: string | number): string;
9
- getReferencedMRTPropText(index: string | number, ident: string): string;
10
- getAttributeDeclare(out: ICodeSegment[]): void;
11
- getVaryingDeclare(out: ICodeSegment[]): void;
12
- getMRTDeclare(out: ICodeSegment[]): void;
13
- visitFunctionIdentifier(node: ASTNode.FunctionIdentifier): string;
14
- visitVariableIdentifier(node: ASTNode.VariableIdentifier): string;
15
- visitJumpStatement(node: ASTNode.JumpStatement): string;
16
- private _registerFragColorVariable;
17
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export { GLES100Visitor } from "./GLES100";
2
- export { GLES300Visitor } from "./GLES300";
3
- export { CodeGenVisitor } from "./CodeGenVisitor";
@@ -1,12 +0,0 @@
1
- import { IShaderContent } from "@galacean/engine-design";
2
- export type IRenderState = [
3
- /** Constant RenderState. */
4
- Record<number, boolean | string | number | any>,
5
- /** Variable RenderState. */
6
- Record<number, string>
7
- ];
8
- export type ITag = IShaderContent["subShaders"][number]["tags"];
9
- export type ICodeSegment = {
10
- text: string;
11
- index: number;
12
- };
@@ -1,2 +0,0 @@
1
- import { BaseToken } from "./BaseToken";
2
- export type OnToken = (token: BaseToken, scanner: BaseScanner) => void;
@@ -1,18 +0,0 @@
1
- export interface IBaseSymbol {
2
- readonly ident: string;
3
- }
4
- /**
5
- * The base class of `SymbolTable`
6
- */
7
- export declare abstract class BaseSymbolTable<T extends IBaseSymbol = IBaseSymbol> {
8
- protected _table: Map<string, T[]>;
9
- abstract insert(sm: T): void;
10
- }
11
- export declare class SymbolTableStack<S extends IBaseSymbol, T extends BaseSymbolTable<S>> {
12
- stack: T[];
13
- get _scope(): T;
14
- newScope(scope: T): void;
15
- clear(): void;
16
- dropScope(): void;
17
- insert(sm: S): void;
18
- }
@@ -1,12 +0,0 @@
1
- import { ShaderRange, ShaderPosition } from ".";
2
- import { IPoolElement } from "@galacean/engine";
3
- export declare class BaseToken<T extends number = number> implements IPoolElement {
4
- static pool: import("@galacean/engine").ClearableObjectPool<BaseToken<number>>;
5
- type: T;
6
- lexeme: string;
7
- location: ShaderRange;
8
- set(type: T, lexeme: string, start?: ShaderPosition): any;
9
- set(type: T, lexeme: string, location?: ShaderRange): any;
10
- dispose(): void;
11
- }
12
- export declare const EOF: BaseToken<number>;
@@ -1,5 +0,0 @@
1
- export declare enum EShaderStage {
2
- VERTEX = 0,
3
- FRAGMENT = 1,
4
- ALL = 2
5
- }
@@ -1,99 +0,0 @@
1
- export declare enum EKeyword {
2
- ATTRIBUTE = 0,
3
- CONST = 1,
4
- BOOL = 2,
5
- FLOAT = 3,
6
- DOUBLE = 4,
7
- INT = 5,
8
- UINT = 6,
9
- BREAK = 7,
10
- CONTINUE = 8,
11
- DO = 9,
12
- ELSE = 10,
13
- FOR = 11,
14
- IF = 12,
15
- WHILE = 13,
16
- DISCARD = 14,
17
- RETURN = 15,
18
- BVEC2 = 16,
19
- BVEC3 = 17,
20
- BVEC4 = 18,
21
- IVEC2 = 19,
22
- IVEC3 = 20,
23
- IVEC4 = 21,
24
- UVEC2 = 22,
25
- UVEC3 = 23,
26
- UVEC4 = 24,
27
- VEC2 = 25,
28
- VEC3 = 26,
29
- VEC4 = 27,
30
- VEC4_ARRAY = 28,
31
- MAT2 = 29,
32
- MAT3 = 30,
33
- MAT4 = 31,
34
- MAT2X3 = 32,
35
- MAT2X4 = 33,
36
- MAT3X2 = 34,
37
- MAT3X4 = 35,
38
- MAT4X2 = 36,
39
- MAT4X3 = 37,
40
- IN = 38,
41
- OUT = 39,
42
- INOUT = 40,
43
- CENTROID = 41,
44
- SAMPLER2D = 42,
45
- SAMPLER3D = 43,
46
- SAMPLER_CUBE = 44,
47
- SAMPLER2D_SHADOW = 45,
48
- SAMPLER_CUBE_SHADOW = 46,
49
- SAMPLER2D_ARRAY = 47,
50
- SAMPLER2D_ARRAY_SHADOW = 48,
51
- I_SAMPLER2D = 49,
52
- I_SAMPLER3D = 50,
53
- I_SAMPLER_CUBE = 51,
54
- I_SAMPLER2D_ARRAY = 52,
55
- U_SAMPLER2D = 53,
56
- U_SAMPLER3D = 54,
57
- U_SAMPLER_CUBE = 55,
58
- U_SAMPLER2D_ARRAY = 56,
59
- STRUCT = 57,
60
- LAYOUT = 58,
61
- LOCATION = 59,
62
- VOID = 60,
63
- TRUE = 61,
64
- FALSE = 62,
65
- PRECISION = 63,
66
- PRECISE = 64,
67
- HIGHP = 65,
68
- MEDIUMP = 66,
69
- LOWP = 67,
70
- INVARIANT = 68,
71
- SMOOTH = 69,
72
- FLAT = 70,
73
- NOPERSPECTIVE = 71,
74
- GS_RenderQueueType = 72,
75
- GS_BlendState = 73,
76
- GS_DepthState = 74,
77
- GS_StencilState = 75,
78
- GS_RasterState = 76,
79
- GS_EditorProperties = 77,
80
- GS_EditorMacros = 78,
81
- GS_Editor = 79,
82
- GS_Tags = 80,
83
- GS_ReplacementTag = 81,
84
- GS_LightMode = 82,
85
- GS_PipelineStage = 83,
86
- GS_VertexShader = 84,
87
- GS_FragmentShader = 85,
88
- GS_SubShader = 86,
89
- GS_Pass = 87,
90
- GS_BlendFactor = 88,
91
- GS_BlendOperation = 89,
92
- GS_Bool = 90,
93
- GS_Number = 91,
94
- GS_Color = 92,
95
- GS_CompareFunction = 93,
96
- GS_StencilOperation = 94,
97
- GS_CullMode = 95,
98
- GS_UsePass = 96
99
- }
@@ -1,8 +0,0 @@
1
- import { IPoolElement } from "@galacean/engine";
2
- export declare class ShaderPosition implements IPoolElement {
3
- index: number;
4
- line: number;
5
- column: number;
6
- set(index: number, line: number, column: number): void;
7
- dispose(): void;
8
- }
@@ -1,8 +0,0 @@
1
- import { IPoolElement } from "@galacean/engine";
2
- import { ShaderPosition } from "./ShaderPosition";
3
- export declare class ShaderRange implements IPoolElement {
4
- start: ShaderPosition;
5
- end: ShaderPosition;
6
- set(start: ShaderPosition, end: ShaderPosition): void;
7
- dispose(): void;
8
- }
@@ -1,5 +0,0 @@
1
- import { ShaderRange } from "./ShaderRange";
2
- import { ShaderPosition } from "./ShaderPosition";
3
- export { ShaderRange, ShaderPosition };
4
- export * from "./types";
5
- export * from "./Keywords";
@@ -1,102 +0,0 @@
1
- import { EKeyword } from "./Keywords";
2
- export declare const KeywordTable: Map<string, EKeyword>;
3
- export declare enum ETokenType {
4
- ID = 1000,
5
- FLOAT_CONSTANT = 1001,
6
- INT_CONSTANT = 1002,
7
- STRING_CONST = 1003,
8
- /** << */
9
- LEFT_OP = 1004,
10
- /** \>> */
11
- RIGHT_OP = 1005,
12
- /** ++ */
13
- INC_OP = 1006,
14
- /** -- */
15
- DEC_OP = 1007,
16
- /** <= */
17
- LE_OP = 1008,
18
- /** \>= */
19
- GE_OP = 1009,
20
- /** == */
21
- EQ_OP = 1010,
22
- /** != */
23
- NE_OP = 1011,
24
- /** && */
25
- AND_OP = 1012,
26
- /** || */
27
- OR_OP = 1013,
28
- /** ^^ */
29
- XOR_OP = 1014,
30
- /** *= */
31
- MUL_ASSIGN = 1015,
32
- /** /= */
33
- DIV_ASSIGN = 1016,
34
- /** += */
35
- ADD_ASSIGN = 1017,
36
- /** -= */
37
- SUB_ASSIGN = 1018,
38
- /** %= */
39
- MOD_ASSIGN = 1019,
40
- /** <<= */
41
- LEFT_ASSIGN = 1020,
42
- /** >>= */
43
- RIGHT_ASSIGN = 1021,
44
- /** &= */
45
- AND_ASSIGN = 1022,
46
- /** ^= */
47
- XOR_ASSIGN = 1023,
48
- /** |= */
49
- OR_ASSIGN = 1024,
50
- /** ( */
51
- LEFT_PAREN = 1025,
52
- /** ) */
53
- RIGHT_PAREN = 1026,
54
- /** [ */
55
- LEFT_BRACKET = 1027,
56
- /** ] */
57
- RIGHT_BRACKET = 1028,
58
- /** { */
59
- LEFT_BRACE = 1029,
60
- /** } */
61
- RIGHT_BRACE = 1030,
62
- /** . */
63
- DOT = 1031,
64
- /** , */
65
- COMMA = 1032,
66
- COLON = 1033,
67
- /** = */
68
- EQUAL = 1034,
69
- /** ; */
70
- SEMICOLON = 1035,
71
- /** ! */
72
- BANG = 1036,
73
- /** \- */
74
- DASH = 1037,
75
- /** ~ */
76
- TILDE = 1038,
77
- PLUS = 1039,
78
- /** \* */
79
- STAR = 1040,
80
- /** / */
81
- SLASH = 1041,
82
- /** % */
83
- PERCENT = 1042,
84
- /** < */
85
- LEFT_ANGLE = 1043,
86
- /** \> */
87
- RIGHT_ANGLE = 1044,
88
- VERTICAL_BAR = 1045,
89
- /** ^ */
90
- CARET = 1046,
91
- /** & */
92
- AMPERSAND = 1047,
93
- /** ? */
94
- QUESTION = 1048,
95
- NOT_WORD = 1049,
96
- /** ε */
97
- EPSILON = 1998,
98
- EOF = 1999
99
- }
100
- export declare const TypeAny = 3000;
101
- export type GalaceanDataType = EKeyword.VOID | EKeyword.FLOAT | EKeyword.BOOL | EKeyword.INT | EKeyword.UINT | EKeyword.VEC2 | EKeyword.VEC3 | EKeyword.VEC4 | EKeyword.BVEC2 | EKeyword.BVEC3 | EKeyword.BVEC4 | EKeyword.IVEC2 | EKeyword.IVEC3 | EKeyword.IVEC4 | EKeyword.UVEC2 | EKeyword.UVEC3 | EKeyword.UVEC4 | EKeyword.MAT2 | EKeyword.MAT3 | EKeyword.MAT4 | EKeyword.MAT2X3 | EKeyword.MAT2X4 | EKeyword.MAT3X2 | EKeyword.MAT3X4 | EKeyword.MAT4X2 | EKeyword.MAT4X3 | EKeyword.SAMPLER2D | EKeyword.SAMPLER3D | EKeyword.SAMPLER_CUBE | EKeyword.SAMPLER2D_SHADOW | EKeyword.SAMPLER_CUBE_SHADOW | EKeyword.SAMPLER2D_ARRAY | EKeyword.SAMPLER2D_ARRAY_SHADOW | EKeyword.I_SAMPLER2D | EKeyword.I_SAMPLER3D | EKeyword.I_SAMPLER_CUBE | EKeyword.I_SAMPLER2D_ARRAY | EKeyword.U_SAMPLER2D | EKeyword.U_SAMPLER3D | EKeyword.U_SAMPLER_CUBE | EKeyword.U_SAMPLER2D_ARRAY | EKeyword.VEC4_ARRAY | typeof TypeAny | string;
102
- export type TokenType = ETokenType | EKeyword;
@@ -1,10 +0,0 @@
1
- import { TokenType } from "../common";
2
- import { BaseSymbolTable, IBaseSymbol } from "../common/BaseSymbolTable";
3
- export interface ISymbol extends IBaseSymbol {
4
- type: number;
5
- value?: any;
6
- }
7
- export default class ContentSymbolTable extends BaseSymbolTable<ISymbol> {
8
- insert(sm: ISymbol): void;
9
- lookup(ident: string, type: TokenType): ISymbol | undefined;
10
- }
@@ -1,2 +0,0 @@
1
- import { EKeyword } from "../common";
2
- export declare const KeywordMap: Map<string, EKeyword>;
@@ -1,10 +0,0 @@
1
- import BaseScanner from "../common/BaseScanner";
2
- export default class Scanner extends BaseScanner {
3
- constructor(source: string, kws?: Map<string, number>);
4
- /**
5
- * split by space
6
- */
7
- scanWord(): string;
8
- scanNumber(): number;
9
- scanToCharacter(char: string): void;
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { ShaderContentParser } from "./ShaderContentParser";
package/types/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { ShaderLab } from "./ShaderLab";
2
- export { Preprocessor } from "./preprocessor";
3
- export * from "./GSError";
4
- export declare const version = "__buildVersion";
@@ -1,5 +0,0 @@
1
- import { Grammar } from "../parser/Grammar";
2
- import SemanticAnalyzer from "../parser/SemanticAnalyzer";
3
- declare const createGrammar: () => Grammar;
4
- declare const addTranslationRule: (sa: SemanticAnalyzer) => void;
5
- export { createGrammar, addTranslationRule };
@@ -1,26 +0,0 @@
1
- import { Grammar } from "../parser/Grammar";
2
- import { NoneTerminal, Terminal } from "../parser/GrammarSymbol";
3
- import { StateActionTable, StateGotoTable } from "./types";
4
- /**
5
- * The [LALR1](https://web.stanford.edu/class/archive/cs/cs143/cs143.1128/handouts/140%20LALR%20Parsing.pdf) Parser generator
6
- */
7
- export declare class LALR1 {
8
- readonly firstSetMap: Map<NoneTerminal, Set<Terminal>>;
9
- readonly followSetMap: Map<NoneTerminal, Set<Terminal>>;
10
- readonly actionTable: StateActionTable;
11
- readonly gotoTable: StateGotoTable;
12
- private grammar;
13
- /** For circle detect */
14
- private _firstSetNTStack;
15
- constructor(grammar: Grammar);
16
- generate(): void;
17
- private buildStateTable;
18
- private _extendState;
19
- private _closure;
20
- private _extendStateItem;
21
- private _inferNextState;
22
- /** Resolve shift-reduce/reduce-reduce conflict detect */
23
- private _addAction;
24
- private computeFirstSet;
25
- private _computeFirstSetForNT;
26
- }
@@ -1,9 +0,0 @@
1
- import { NoneTerminal, GrammarSymbol } from "../parser/GrammarSymbol";
2
- export default class Production {
3
- private static _id;
4
- static pool: Map<number, Production>;
5
- readonly goal: NoneTerminal;
6
- readonly derivation: GrammarSymbol[];
7
- readonly id: number;
8
- constructor(goal: NoneTerminal, derivation: GrammarSymbol[]);
9
- }
@@ -1,20 +0,0 @@
1
- import { Terminal } from "../parser/GrammarSymbol";
2
- import Production from "./Production";
3
- import StateItem from "./StateItem";
4
- export default class State {
5
- static closureMap: Map<string /** state mapKey */, State>;
6
- static pool: Map<number, State>;
7
- static _id: number;
8
- readonly id: number;
9
- readonly cores: Set<StateItem>;
10
- private _items;
11
- get items(): Set<StateItem>;
12
- closured: boolean;
13
- get needReInfer(): boolean;
14
- private _stateItemPool;
15
- static create(cores: StateItem[]): State;
16
- static getMapKey(cores: StateItem[]): string;
17
- private constructor();
18
- getStateItemMapKey(production: Production, position: number): string;
19
- createStateItem(production: Production, position: number, lookaheadSet?: Iterable<Terminal>): StateItem;
20
- }
@@ -1,20 +0,0 @@
1
- import { Terminal } from "../parser/GrammarSymbol";
2
- import Production from "./Production";
3
- export default class StateItem {
4
- static _id: number;
5
- readonly production: Production;
6
- readonly position: number;
7
- readonly lookaheadSet: Set<Terminal>;
8
- readonly id: number;
9
- _needReInfer: boolean;
10
- get needReInfer(): boolean;
11
- set needReInfer(v: boolean);
12
- get curSymbol(): import("../parser/GrammarSymbol").GrammarSymbol;
13
- get nextSymbol(): import("../parser/GrammarSymbol").GrammarSymbol;
14
- constructor(production: Production, position: number, lookahead: Iterable<Terminal>);
15
- addLookahead(ts: Iterable<Terminal>): void;
16
- symbolByOffset(offset: number): import("../parser/GrammarSymbol").GrammarSymbol;
17
- canReduce(): boolean;
18
- advance(): StateItem;
19
- toString(): string;
20
- }
@@ -1,22 +0,0 @@
1
- import { ShaderRange } from "../common";
2
- import { TreeNode } from "../parser/AST";
3
- import { TranslationRule } from "../parser/SemanticAnalyzer";
4
- import { NoneTerminal, GrammarSymbol } from "../parser/GrammarSymbol";
5
- import Production from "./Production";
6
- import { ActionInfo } from "./types";
7
- import { ClearableObjectPool, IPoolElement } from "@galacean/engine";
8
- import { NodeChild } from "../parser/types";
9
- export default class GrammarUtils {
10
- static isTerminal(sm: GrammarSymbol): boolean;
11
- static toString(sm: GrammarSymbol): string;
12
- static createProductionWithOptions(goal: NoneTerminal, options: GrammarSymbol[][],
13
- /** the ast node */
14
- astTypePool?: ClearableObjectPool<{
15
- set: (loc: ShaderRange, children: NodeChild[]) => void;
16
- } & IPoolElement & TreeNode>): [GrammarSymbol[], TranslationRule][];
17
- static addMapSetItem<K, T>(map: Map<K, Set<T>>, k: K, v: T): void;
18
- static isSubSet<T>(sa: Set<T>, sb: Set<T>): boolean;
19
- static isActionEqual(a: ActionInfo, b: ActionInfo): boolean;
20
- static printAction(actionInfo: ActionInfo): string;
21
- static printProduction(production: Production): string;
22
- }
@@ -1,2 +0,0 @@
1
- export { LALR1 } from "./LALR1";
2
- export * from "./CFG";
@@ -1,14 +0,0 @@
1
- import { NoneTerminal, Terminal } from "../parser/GrammarSymbol";
2
- export type StateActionTable = Map<number /** state ID */, ActionTable>;
3
- export type ActionTable = Map<Terminal, ActionInfo>;
4
- export type StateGotoTable = Map<number /** state ID */, GotoTable>;
5
- export type GotoTable = Map<NoneTerminal, number /** state ID */>;
6
- export declare enum EAction {
7
- Shift = 0,
8
- Reduce = 1,
9
- Accept = 2
10
- }
11
- export interface ActionInfo {
12
- action: EAction;
13
- target?: number;
14
- }
@@ -1,18 +0,0 @@
1
- import { BaseToken } from "../common/BaseToken";
2
- import BaseScanner from "../common/BaseScanner";
3
- /**
4
- * The Lexer of ShaderLab Compiler
5
- */
6
- export declare class Lexer extends BaseScanner {
7
- reset(source: string): void;
8
- tokenize(): Generator<BaseToken<number>, BaseToken<number>, unknown>;
9
- skipSpace(): void;
10
- scanToken(): BaseToken;
11
- private _scanStringConst;
12
- private _scanNumAfterDot;
13
- private _getPosition;
14
- private _scanWord;
15
- private _scanNum;
16
- private _scanFloatSuffix;
17
- private _scanIntegerSuffix;
18
- }
@@ -1,7 +0,0 @@
1
- export default class LexerUtils {
2
- static isNum(charCode: number): boolean;
3
- static isLetter(charCode: number): boolean;
4
- static isAlpha(charCode: number): boolean;
5
- static isPpCharacters(charCode: number): boolean;
6
- static isSpace(charCode: number): charCode is 9 | 10 | 13 | 32;
7
- }
@@ -1 +0,0 @@
1
- export * from "./Lexer";