Skip to content

Commit 8695423

Browse files
authored
Refactor AST code in ShaderLab for performance (galacean#2486)
* refactor(shaderlab): opt ast
1 parent 338b1e1 commit 8695423

File tree

5 files changed

+342
-300
lines changed

5 files changed

+342
-300
lines changed

packages/shader-lab/src/lalr/CFG.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Grammar } from "../parser/Grammar";
44
import { NoneTerminal, GrammarSymbol } from "../parser/GrammarSymbol";
55
import GrammarUtils from "./Utils";
66
import { EKeyword, ETokenType } from "../common";
7-
import SematicAnalyzer, { TranslationRule } from "../parser/SemanticAnalyzer";
7+
import SemanticAnalyzer, { TranslationRule } from "../parser/SemanticAnalyzer";
88
import { ASTNode } from "../parser/AST";
99

1010
const productionAndRules: [GrammarSymbol[], TranslationRule | undefined][] = [
@@ -849,7 +849,7 @@ const createGrammar = () =>
849849
productionAndRules.map((item) => item[0])
850850
);
851851

852-
const addTranslationRule = (sa: SematicAnalyzer) => {
852+
const addTranslationRule = (sa: SemanticAnalyzer) => {
853853
for (let i = 0; i < productionAndRules.length; i++) {
854854
const rule = productionAndRules[i][1];
855855
if (rule) {

packages/shader-lab/src/lexer/Utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class LexerUtils {
2020
);
2121
}
2222

23-
static isPpCharactors(charCode: number) {
23+
static isPpCharacters(charCode: number) {
2424
return (
2525
charCode === 35 || // #
2626
charCode === 46 || // .

0 commit comments

Comments
 (0)