@galacean/engine-shaderlab 0.0.0-experimental-1.4-small-language.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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +43 -0
  3. package/dist/browser.js +6608 -0
  4. package/dist/browser.js.map +1 -0
  5. package/dist/browser.min.js +2 -0
  6. package/dist/browser.min.js.map +1 -0
  7. package/dist/browser.verbose.js +7866 -0
  8. package/dist/browser.verbose.js.map +1 -0
  9. package/dist/browser.verbose.min.js +2 -0
  10. package/dist/browser.verbose.min.js.map +1 -0
  11. package/dist/main.js +6604 -0
  12. package/dist/main.js.map +1 -0
  13. package/dist/main.verbose.js +7862 -0
  14. package/dist/main.verbose.js.map +1 -0
  15. package/dist/module.js +6599 -0
  16. package/dist/module.js.map +1 -0
  17. package/dist/module.verbose.js +7854 -0
  18. package/dist/module.verbose.js.map +1 -0
  19. package/package.json +38 -0
  20. package/types/GSError.d.ts +15 -0
  21. package/types/ParserUtils.d.ts +12 -0
  22. package/types/ShaderLab.d.ts +1 -0
  23. package/types/ShaderLabUtils.d.ts +10 -0
  24. package/types/TempArray.d.ts +5 -0
  25. package/types/codeGen/CodeGenVisitor.d.ts +2 -0
  26. package/types/codeGen/GLES100.d.ts +16 -0
  27. package/types/codeGen/GLES300.d.ts +17 -0
  28. package/types/codeGen/GLESVisitor.d.ts +1 -0
  29. package/types/codeGen/VisitorContext.d.ts +1 -0
  30. package/types/codeGen/index.d.ts +3 -0
  31. package/types/codeGen/types.d.ts +12 -0
  32. package/types/common/BaseScanner.d.ts +2 -0
  33. package/types/common/BaseSymbolTable.d.ts +18 -0
  34. package/types/common/BaseToken.d.ts +12 -0
  35. package/types/common/Enums.d.ts +5 -0
  36. package/types/common/Keywords.d.ts +99 -0
  37. package/types/common/ShaderPosition.d.ts +8 -0
  38. package/types/common/ShaderRange.d.ts +8 -0
  39. package/types/common/index.d.ts +5 -0
  40. package/types/common/types.d.ts +102 -0
  41. package/types/contentParser/ContentSymbolTable.d.ts +10 -0
  42. package/types/contentParser/KeywordMap.d.ts +2 -0
  43. package/types/contentParser/Scanner.d.ts +10 -0
  44. package/types/contentParser/ShaderContentParser.d.ts +1 -0
  45. package/types/contentParser/index.d.ts +1 -0
  46. package/types/index.d.ts +4 -0
  47. package/types/lalr/CFG.d.ts +5 -0
  48. package/types/lalr/LALR1.d.ts +26 -0
  49. package/types/lalr/Production.d.ts +9 -0
  50. package/types/lalr/State.d.ts +20 -0
  51. package/types/lalr/StateItem.d.ts +20 -0
  52. package/types/lalr/Utils.d.ts +22 -0
  53. package/types/lalr/index.d.ts +2 -0
  54. package/types/lalr/types.d.ts +14 -0
  55. package/types/lexer/Lexer.d.ts +18 -0
  56. package/types/lexer/Utils.d.ts +7 -0
  57. package/types/lexer/index.d.ts +1 -0
  58. package/types/parser/AST.d.ts +347 -0
  59. package/types/parser/Grammar.d.ts +11 -0
  60. package/types/parser/GrammarSymbol.d.ts +107 -0
  61. package/types/parser/SemanticAnalyzer.d.ts +2 -0
  62. package/types/parser/ShaderInfo.d.ts +8 -0
  63. package/types/parser/ShaderTargetParser.d.ts +23 -0
  64. package/types/parser/builtin/functions.d.ts +34 -0
  65. package/types/parser/builtin/index.d.ts +2 -0
  66. package/types/parser/builtin/variables.d.ts +11 -0
  67. package/types/parser/index.d.ts +2 -0
  68. package/types/parser/symbolTable/FnSymbol.d.ts +6 -0
  69. package/types/parser/symbolTable/StructSymbol.d.ts +6 -0
  70. package/types/parser/symbolTable/SymbolDataType.d.ts +8 -0
  71. package/types/parser/symbolTable/SymbolInfo.d.ts +18 -0
  72. package/types/parser/symbolTable/TargetSymbolTable.d.ts +13 -0
  73. package/types/parser/symbolTable/VarSymbol.d.ts +8 -0
  74. package/types/parser/symbolTable/index.d.ts +6 -0
  75. package/types/parser/types.d.ts +23 -0
  76. package/types/preprocessor/MacroDefine.d.ts +13 -0
  77. package/types/preprocessor/PpParser.d.ts +7 -0
  78. package/types/preprocessor/PpScanner.d.ts +51 -0
  79. package/types/preprocessor/Preprocessor.d.ts +1 -0
  80. package/types/preprocessor/Utils.d.ts +10 -0
  81. package/types/preprocessor/constants.d.ts +56 -0
  82. package/types/preprocessor/index.d.ts +1 -0
  83. package/types/preprocessor/sourceMap/index.d.ts +37 -0
  84. package/verbose/package.json +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2020 - present Ant Group
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ ## Installation
2
+
3
+ ```sh
4
+ npm install @galacean/engine-shaderlab
5
+ ```
6
+
7
+ ## Usage
8
+
9
+ ```typescript
10
+ import { ShaderLab } from "@galacean/engine-shaderlab";
11
+
12
+ // Create ShaderLab
13
+ const shaderLab = new ShaderLab();
14
+
15
+ // Create engine with shaderLab
16
+ const engine = await WebGLEngine.create({ canvas: "canvas", shaderLab });
17
+
18
+ ......
19
+
20
+ // Create shader by galacean shader code directly
21
+ const shader = Shader.create(galaceanShaderCode);
22
+
23
+ .......
24
+
25
+ // Run engine
26
+ engine.run()
27
+ ```
28
+
29
+ There are two versions of ShaderLab: `Release` and `Verbose`. The `Verbose` version offers more user-friendly diagnostic information for debug ShaderLab compilation errors, while the Release version provides superior performance.
30
+
31
+ you can use `Verbose` version by import:
32
+
33
+ ```ts
34
+ import { ShaderLab } from "@galacean/engine-shaderlab/verbose";
35
+ ```
36
+
37
+ ## CFG Grammar conflict detection
38
+
39
+ The Galacean ShaderLab syntax is defined using Context-Free Grammar (CFG) and is documented within the `\*.y` file. When modifications to the ShaderLab syntax are required, it is recommended to make changes to the existing CFG syntax file, and employ [Bison](https://www.gnu.org/software/bison/manual/bison.html) to detect any potential grammar conflicts.
40
+
41
+ ```sh
42
+ bison ./Parser.y -r all
43
+ ```