@galacean/engine-shaderlab 1.4.0-alpha.3
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.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/browser.js +6742 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -0
- package/dist/browser.min.js.map +1 -0
- package/dist/browser.verbose.js +7994 -0
- package/dist/browser.verbose.js.map +1 -0
- package/dist/browser.verbose.min.js +2 -0
- package/dist/browser.verbose.min.js.map +1 -0
- package/dist/main.js +6738 -0
- package/dist/main.js.map +1 -0
- package/dist/main.verbose.js +7990 -0
- package/dist/main.verbose.js.map +1 -0
- package/dist/module.js +6733 -0
- package/dist/module.js.map +1 -0
- package/dist/module.verbose.js +7982 -0
- package/dist/module.verbose.js.map +1 -0
- package/package.json +38 -0
- package/types/GSError.d.ts +15 -0
- package/types/ParserUtils.d.ts +12 -0
- package/types/ShaderLab.d.ts +1 -0
- package/types/ShaderLabUtils.d.ts +10 -0
- package/types/TempArray.d.ts +5 -0
- package/types/codeGen/CodeGenVisitor.d.ts +2 -0
- package/types/codeGen/GLES100.d.ts +16 -0
- package/types/codeGen/GLES300.d.ts +17 -0
- package/types/codeGen/GLESVisitor.d.ts +1 -0
- package/types/codeGen/VisitorContext.d.ts +1 -0
- package/types/codeGen/index.d.ts +3 -0
- package/types/codeGen/types.d.ts +12 -0
- package/types/common/BaseScanner.d.ts +2 -0
- package/types/common/BaseSymbolTable.d.ts +18 -0
- package/types/common/BaseToken.d.ts +12 -0
- package/types/common/Enums.d.ts +5 -0
- package/types/common/Keywords.d.ts +99 -0
- package/types/common/ShaderPosition.d.ts +8 -0
- package/types/common/ShaderRange.d.ts +8 -0
- package/types/common/index.d.ts +5 -0
- package/types/common/types.d.ts +101 -0
- package/types/contentParser/ContentSymbolTable.d.ts +10 -0
- package/types/contentParser/KeywordMap.d.ts +2 -0
- package/types/contentParser/Scanner.d.ts +10 -0
- package/types/contentParser/ShaderContentParser.d.ts +1 -0
- package/types/contentParser/index.d.ts +1 -0
- package/types/index.d.ts +4 -0
- package/types/lalr/CFG.d.ts +5 -0
- package/types/lalr/LALR1.d.ts +26 -0
- package/types/lalr/Production.d.ts +9 -0
- package/types/lalr/State.d.ts +20 -0
- package/types/lalr/StateItem.d.ts +20 -0
- package/types/lalr/Utils.d.ts +22 -0
- package/types/lalr/index.d.ts +2 -0
- package/types/lalr/types.d.ts +14 -0
- package/types/lexer/Lexer.d.ts +18 -0
- package/types/lexer/Utils.d.ts +7 -0
- package/types/lexer/index.d.ts +1 -0
- package/types/parser/AST.d.ts +322 -0
- package/types/parser/Grammar.d.ts +11 -0
- package/types/parser/GrammarSymbol.d.ts +105 -0
- package/types/parser/SemanticAnalyzer.d.ts +2 -0
- package/types/parser/ShaderInfo.d.ts +8 -0
- package/types/parser/ShaderTargetParser.d.ts +23 -0
- package/types/parser/builtin/functions.d.ts +35 -0
- package/types/parser/builtin/index.d.ts +2 -0
- package/types/parser/builtin/variables.d.ts +11 -0
- package/types/parser/index.d.ts +2 -0
- package/types/parser/symbolTable/FnSymbol.d.ts +6 -0
- package/types/parser/symbolTable/StructSymbol.d.ts +6 -0
- package/types/parser/symbolTable/SymbolDataType.d.ts +8 -0
- package/types/parser/symbolTable/SymbolInfo.d.ts +18 -0
- package/types/parser/symbolTable/TargetSymbolTable.d.ts +13 -0
- package/types/parser/symbolTable/VarSymbol.d.ts +8 -0
- package/types/parser/symbolTable/index.d.ts +6 -0
- package/types/parser/types.d.ts +23 -0
- package/types/preprocessor/MacroDefine.d.ts +13 -0
- package/types/preprocessor/PpParser.d.ts +7 -0
- package/types/preprocessor/PpScanner.d.ts +51 -0
- package/types/preprocessor/Preprocessor.d.ts +1 -0
- package/types/preprocessor/Utils.d.ts +10 -0
- package/types/preprocessor/constants.d.ts +56 -0
- package/types/preprocessor/index.d.ts +1 -0
- package/types/preprocessor/sourceMap/index.d.ts +37 -0
- package/verbose/package.json +14 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderLab={}),e.Galacean)}(this,function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function o(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;var s,c,u,l,p,h,_,d,f,g,S,y,m,v,E,x,C,T,A,O,b,I,P,R,L,M,k,N,G,V,D,F,w,B,U,W,j,H,q,z,X,Q,Y,K,J,$,Z,ee,et,er,en,ei,ea,eo,es,ec,eu,el,ep,eh,e_,ed,ef,eg,eS,ey,em,ev,eE,ex,eC,eT,eA,eO,eb,eI,eP,eR,eL,eM,ek,eN,eG,eV,eD,eF,ew,eB,eU=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),eW=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){this.index=e,this.line=t,this.column=r},t.dispose=function(){this.index=0,this.line=0,this.column=0},e}(),ej=((s={})[s.ATTRIBUTE=0]="ATTRIBUTE",s[s.CONST=1]="CONST",s[s.BOOL=2]="BOOL",s[s.FLOAT=3]="FLOAT",s[s.DOUBLE=4]="DOUBLE",s[s.INT=5]="INT",s[s.UINT=6]="UINT",s[s.BREAK=7]="BREAK",s[s.CONTINUE=8]="CONTINUE",s[s.DO=9]="DO",s[s.ELSE=10]="ELSE",s[s.FOR=11]="FOR",s[s.IF=12]="IF",s[s.WHILE=13]="WHILE",s[s.DISCARD=14]="DISCARD",s[s.RETURN=15]="RETURN",s[s.BVEC2=16]="BVEC2",s[s.BVEC3=17]="BVEC3",s[s.BVEC4=18]="BVEC4",s[s.IVEC2=19]="IVEC2",s[s.IVEC3=20]="IVEC3",s[s.IVEC4=21]="IVEC4",s[s.UVEC2=22]="UVEC2",s[s.UVEC3=23]="UVEC3",s[s.UVEC4=24]="UVEC4",s[s.VEC2=25]="VEC2",s[s.VEC3=26]="VEC3",s[s.VEC4=27]="VEC4",s[s.VEC4_ARRAY=28]="VEC4_ARRAY",s[s.MAT2=29]="MAT2",s[s.MAT3=30]="MAT3",s[s.MAT4=31]="MAT4",s[s.MAT2X3=32]="MAT2X3",s[s.MAT2X4=33]="MAT2X4",s[s.MAT3X2=34]="MAT3X2",s[s.MAT3X4=35]="MAT3X4",s[s.MAT4X2=36]="MAT4X2",s[s.MAT4X3=37]="MAT4X3",s[s.IN=38]="IN",s[s.OUT=39]="OUT",s[s.INOUT=40]="INOUT",s[s.CENTROID=41]="CENTROID",s[s.SAMPLER2D=42]="SAMPLER2D",s[s.SAMPLER3D=43]="SAMPLER3D",s[s.SAMPLER_CUBE=44]="SAMPLER_CUBE",s[s.SAMPLER2D_SHADOW=45]="SAMPLER2D_SHADOW",s[s.SAMPLER_CUBE_SHADOW=46]="SAMPLER_CUBE_SHADOW",s[s.SAMPLER2D_ARRAY=47]="SAMPLER2D_ARRAY",s[s.SAMPLER2D_ARRAY_SHADOW=48]="SAMPLER2D_ARRAY_SHADOW",s[s.I_SAMPLER2D=49]="I_SAMPLER2D",s[s.I_SAMPLER3D=50]="I_SAMPLER3D",s[s.I_SAMPLER_CUBE=51]="I_SAMPLER_CUBE",s[s.I_SAMPLER2D_ARRAY=52]="I_SAMPLER2D_ARRAY",s[s.U_SAMPLER2D=53]="U_SAMPLER2D",s[s.U_SAMPLER3D=54]="U_SAMPLER3D",s[s.U_SAMPLER_CUBE=55]="U_SAMPLER_CUBE",s[s.U_SAMPLER2D_ARRAY=56]="U_SAMPLER2D_ARRAY",s[s.STRUCT=57]="STRUCT",s[s.LAYOUT=58]="LAYOUT",s[s.LOCATION=59]="LOCATION",s[s.VOID=60]="VOID",s[s.TRUE=61]="TRUE",s[s.FALSE=62]="FALSE",s[s.PRECISION=63]="PRECISION",s[s.PRECISE=64]="PRECISE",s[s.HIGHP=65]="HIGHP",s[s.MEDIUMP=66]="MEDIUMP",s[s.LOWP=67]="LOWP",s[s.INVARIANT=68]="INVARIANT",s[s.SMOOTH=69]="SMOOTH",s[s.FLAT=70]="FLAT",s[s.NOPERSPECTIVE=71]="NOPERSPECTIVE",s[s.GS_RenderQueueType=72]="GS_RenderQueueType",s[s.GS_BlendState=73]="GS_BlendState",s[s.GS_DepthState=74]="GS_DepthState",s[s.GS_StencilState=75]="GS_StencilState",s[s.GS_RasterState=76]="GS_RasterState",s[s.GS_EditorProperties=77]="GS_EditorProperties",s[s.GS_EditorMacros=78]="GS_EditorMacros",s[s.GS_Editor=79]="GS_Editor",s[s.GS_Tags=80]="GS_Tags",s[s.GS_ReplacementTag=81]="GS_ReplacementTag",s[s.GS_LightMode=82]="GS_LightMode",s[s.GS_PipelineStage=83]="GS_PipelineStage",s[s.GS_VertexShader=84]="GS_VertexShader",s[s.GS_FragmentShader=85]="GS_FragmentShader",s[s.GS_SubShader=86]="GS_SubShader",s[s.GS_Pass=87]="GS_Pass",s[s.GS_BlendFactor=88]="GS_BlendFactor",s[s.GS_BlendOperation=89]="GS_BlendOperation",s[s.GS_Bool=90]="GS_Bool",s[s.GS_Number=91]="GS_Number",s[s.GS_Color=92]="GS_Color",s[s.GS_CompareFunction=93]="GS_CompareFunction",s[s.GS_StencilOperation=94]="GS_StencilOperation",s[s.GS_CullMode=95]="GS_CullMode",s[s.GS_UsePass=96]="GS_UsePass",s),eH=new Map([["attribute",ej.ATTRIBUTE],["const",ej.CONST],["bool",ej.BOOL],["float",ej.FLOAT],["double",ej.DOUBLE],["int",ej.INT],["uint",ej.UINT],["break",ej.BREAK],["continue",ej.CONTINUE],["do",ej.DO],["else",ej.ELSE],["for",ej.FOR],["if",ej.IF],["while",ej.WHILE],["discard",ej.DISCARD],["return",ej.RETURN],["bvec2",ej.BVEC2],["bvec3",ej.BVEC3],["bvec4",ej.BVEC4],["ivec2",ej.IVEC2],["ivec3",ej.IVEC3],["ivec4",ej.IVEC4],["uvec2",ej.UVEC2],["uvec3",ej.UVEC3],["uvec4",ej.UVEC4],["vec2",ej.VEC2],["vec3",ej.VEC3],["vec4",ej.VEC4],["mat2",ej.MAT2],["mat3",ej.MAT3],["mat4",ej.MAT4],["in",ej.IN],["out",ej.OUT],["inout",ej.INOUT],["sampler2D",ej.SAMPLER2D],["samplerCube",ej.SAMPLER_CUBE],["sampler3D",ej.SAMPLER3D],["sampler2DShadow",ej.SAMPLER2D_SHADOW],["samplerCubeShadow",ej.SAMPLER_CUBE_SHADOW],["sampler2DArray",ej.SAMPLER2D_ARRAY],["sampler2DArrayShadow",ej.SAMPLER2D_ARRAY_SHADOW],["isampler2D",ej.I_SAMPLER2D],["isampler3D",ej.I_SAMPLER3D],["isamplerCube",ej.I_SAMPLER_CUBE],["isampler2DArray",ej.I_SAMPLER2D_ARRAY],["usampler2D",ej.U_SAMPLER2D],["usampler3D",ej.U_SAMPLER3D],["usamplerCube",ej.U_SAMPLER_CUBE],["usampler2DArray",ej.U_SAMPLER2D_ARRAY],["struct",ej.STRUCT],["void",ej.VOID],["true",ej.TRUE],["false",ej.FALSE],["precision",ej.PRECISION],["precise",ej.PRECISE],["highp",ej.HIGHP],["mediump",ej.MEDIUMP],["lowp",ej.LOWP],["invariant",ej.INVARIANT],["flat",ej.FLAT],["smooth",ej.SMOOTH],["noperspective",ej.NOPERSPECTIVE],["centroid",ej.CENTROID],["layout",ej.LAYOUT],["location",ej.LOCATION]]),eq=((c={})[c.ID=1e3]="ID",c[c.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",c[c.INT_CONSTANT=1002]="INT_CONSTANT",c[c.STRING_CONST=1003]="STRING_CONST",c[c.LEFT_OP=1004]="LEFT_OP",c[c.RIGHT_OP=1005]="RIGHT_OP",c[c.INC_OP=1006]="INC_OP",c[c.DEC_OP=1007]="DEC_OP",c[c.LE_OP=1008]="LE_OP",c[c.GE_OP=1009]="GE_OP",c[c.EQ_OP=1010]="EQ_OP",c[c.NE_OP=1011]="NE_OP",c[c.AND_OP=1012]="AND_OP",c[c.OR_OP=1013]="OR_OP",c[c.XOR_OP=1014]="XOR_OP",c[c.MUL_ASSIGN=1015]="MUL_ASSIGN",c[c.DIV_ASSIGN=1016]="DIV_ASSIGN",c[c.ADD_ASSIGN=1017]="ADD_ASSIGN",c[c.SUB_ASSIGN=1018]="SUB_ASSIGN",c[c.MOD_ASSIGN=1019]="MOD_ASSIGN",c[c.LEFT_ASSIGN=1020]="LEFT_ASSIGN",c[c.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",c[c.AND_ASSIGN=1022]="AND_ASSIGN",c[c.XOR_ASSIGN=1023]="XOR_ASSIGN",c[c.OR_ASSIGN=1024]="OR_ASSIGN",c[c.LEFT_PAREN=1025]="LEFT_PAREN",c[c.RIGHT_PAREN=1026]="RIGHT_PAREN",c[c.LEFT_BRACKET=1027]="LEFT_BRACKET",c[c.RIGHT_BRACKET=1028]="RIGHT_BRACKET",c[c.LEFT_BRACE=1029]="LEFT_BRACE",c[c.RIGHT_BRACE=1030]="RIGHT_BRACE",c[c.DOT=1031]="DOT",c[c.COMMA=1032]="COMMA",c[c.COLON=1033]="COLON",c[c.EQUAL=1034]="EQUAL",c[c.SEMICOLON=1035]="SEMICOLON",c[c.BANG=1036]="BANG",c[c.DASH=1037]="DASH",c[c.TILDE=1038]="TILDE",c[c.PLUS=1039]="PLUS",c[c.STAR=1040]="STAR",c[c.SLASH=1041]="SLASH",c[c.PERCENT=1042]="PERCENT",c[c.LEFT_ANGLE=1043]="LEFT_ANGLE",c[c.RIGHT_ANGLE=1044]="RIGHT_ANGLE",c[c.VERTICAL_BAR=1045]="VERTICAL_BAR",c[c.CARET=1046]="CARET",c[c.AMPERSAND=1047]="AMPERSAND",c[c.QUESTION=1048]="QUESTION",c[c.NOT_WORD=1049]="NOT_WORD",c[c.EPSILON=1998]="EPSILON",c[c.EOF=1999]="EOF",c);function ez(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function eX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eX=function(){return!!e})()}function eQ(e,t,r){return(eQ=eX()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&i(a,r.prototype),a}).apply(null,arguments)}function eY(e){return(eY=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eK(e){var t="function"==typeof Map?new Map:void 0;return(eK=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return eQ(e,arguments,eY(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}var eJ=/*#__PURE__*/function(e){function t(t,r,n,i,a){var o;return(o=e.call(this,r)||this).location=n,o.source=i,o.file=a,o.name=t,o}return a(t,e),t.prototype.toString=function(){var e,r,n=this.message,i=this.location,a=this.source;if(!a)return n;ez(i,eW)?e=r=i:(e=i.start,r=i.end);for(var o=a.split("\n"),s=this.name+": "+n+"\n\n",c="|\xb7\xb7\xb7",u=t.wrappingLineCount,l=e.line-u,p=r.line+u;l<=p;l++){var h=o[l];if(s+=c+""+h+"\n",!(l<e.line)&&!(l>r.line)){var _=0,d=h.length,f=c.length;l===e.line&&(_=e.column,f+=e.column),l===r.line&&(d=r.column);var g=Math.max(d-_,1);s+=" ".repeat(f)+"^".repeat(g)+"\n"}}return s},t}(eK(Error));eJ.wrappingLineCount=2;var e$=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u),eZ=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(r){var n=new t.ClearableObjectPool(r);return e._shaderLabObjectPoolSet.push(n),n},e.clearAllShaderLabObjectPool=function(){for(var t=0,r=e._shaderLabObjectPoolSet.length;t<r;t++)e._shaderLabObjectPoolSet[t].clear()},e.createGSError=function(e,t,r,n,i){return new eJ(t,e,n,r,i)},e}();eZ._shaderLabObjectPoolSet=[];var e0=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,r){if(ez(r,eU))this.location=r;else{var n=t1.createPosition(r.index+t.length,r.line,r.column+t.length);this.location=t1.createRange(r,n)}}},t.dispose=function(){},e}();e0.pool=eZ.createObjectPool(e0);var e2=new e0;e2.set(eq.EOF,"/EOF");var e1=/*#__PURE__*/function(){function e(){}return e.isNum=function(e){return e>=48&&e<=57},e.isLetter=function(e){return 95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isPpCharactors=function(e){return 35===e||46===e||95===e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122},e.isSpace=function(e){return 9===e||10===e||32===e},e}();function e3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function e4(e,t,r){return t&&e3(e.prototype,t),r&&e3(e,r),e}var e9=/*#__PURE__*/function(){function e(e,t){void 0===t&&(t=new Map),this._currentIndex=0,this._column=0,this._line=0,this._source=e,this._keywordsMap=t}var r=e.prototype;return r.getCurPosition=function(){return t1.createPosition(this._currentIndex,this._line,this._column)},r.isEnd=function(){return this._currentIndex>=this._source.length},r.getCurChar=function(){return this._source[this._currentIndex]},r.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},r.advance=function(e){void 0===e&&(e=1);for(var t=0;t<e;t++)this._advance()},r._advance=function(){"\n"===this.getCurChar()?(this._line+=1,this._column=0):this._column+=1,this._currentIndex++},r.skipSpace=function(t){for(var r=t?e._spaceCharsWithBreak:e._spaceChars,n=this.getCurChar();e._checkIsIn(n,r);)this._advance(),n=this.getCurChar()},r.skipCommentsAndSpace=function(){if(this.skipSpace(!0),"//"===this.peek(2)){var e=this.getCurPosition();for(this.advance(2);"\n"!==this.getCurChar();)this._advance();return this.skipCommentsAndSpace(),t1.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var t=this.getCurPosition();for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),this.skipCommentsAndSpace(),t1.createRange(t,this.getCurPosition())}},r.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},r.scanText=function(e){this.skipCommentsAndSpace();var t=this.peek(e.length);t!==e&&this.throwError(this.getCurPosition(),'Expect text "'+e+'", but got "'+t+'"'),this.advance(e.length)},r.throwError=function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=eZ.createGSError(n.join(" "),e$.ScannerError,this._source,e);throw t.Logger.error(a.toString()),a},r.scanPairedText=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1),n||this.scanText(e);for(var i=this._currentIndex,a=r?1:0;this.peek(t.length)!==t||0!==a;){if(this.isEnd())return;if(r){if(this.peek(e.length)===e){a+=1,this.advance(e.length);continue}if(this.peek(t.length)===t){if(0==(a-=1))break;this.advance(t.length);continue}}this.advance(t.length)}return this.advance(t.length),this._source.substring(i,this._currentIndex-t.length)},r.scanToken=function(e,t){void 0===t&&(t=/\w/),this.skipCommentsAndSpace();var r,n=this.getCurPosition();if(!this.isEnd()){for(;t.test(this.getCurChar())&&!this.isEnd();)this._advance();var i=this.getCurPosition();if(n.index===i.index){this._advance();var a=e0.pool.get();return a.set(eq.NOT_WORD,this._source[n.index],n),null==e||e(a,this),a}var o=this._source.substring(n.index,i.index),s=null!=(r=this._keywordsMap.get(o))?r:eq.ID,c=t1.createRange(n,i),u=e0.pool.get();return u.set(s,o,c),null==e||e(u,this),u}},e._checkIsIn=function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1},e4(e,[{key:"current",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}},{key:"line",get:function(){return this._line}},{key:"column",get:function(){return this._column}}]),e}();e9._spaceCharsWithBreak=[" "," ","\n"],e9._spaceChars=[" "," "];var e5=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.reset=function(e){this._source=e,this._currentIndex=0,this._line=this._column=0},r.tokenize=function(){return function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(e){switch(e.label){case 0:if(this.isEnd())return[3,2];return[4,this.scanToken()];case 1:return e.sent(),[3,0];case 2:return[2,e2]}})},r.skipSpace=function(){for(;e1.isSpace(this.getCurCharCode());)this._advance()},r.scanToken=function(){if(this.skipCommentsAndSpace(),this.isEnd())return e2;if(e1.isAlpha(this.getCurCharCode()))return this._scanWord();if(e1.isNum(this.getCurCharCode()))return this._scanNum();var e,t=this._getPosition(),r=e0.pool.get();switch(this.getCurChar()){case"<":if(this._advance(),"<"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.LEFT_ASSIGN,"<<=",t);break}r.set(eq.LEFT_OP,"<<",t);break}if("="===e){this._advance(),r.set(eq.LE_OP,"<=",t);break}r.set(eq.LEFT_ANGLE,"<",t);break;case">":if(this._advance(),">"===(e=this.getCurChar())){if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.RIGHT_ASSIGN,">>=",t);break}r.set(eq.RIGHT_OP,">>",t);break}if("="===e){this._advance(),r.set(eq.GE_OP,">=",t);break}r.set(eq.RIGHT_ANGLE,">",t);break;case"+":if(this._advance(),"+"===(e=this.getCurChar())){this._advance(),r.set(eq.INC_OP,"++",t);break}if("="===e){this._advance(),r.set(eq.ADD_ASSIGN,"+=",t);break}r.set(eq.PLUS,"+",t);break;case"-":if(this._advance(),"-"===(e=this.getCurChar())){this._advance(),r.set(eq.DEC_OP,"--",t);break}if("="===e){this._advance(),r.set(eq.SUB_ASSIGN,"-=",t);break}r.set(eq.DASH,"-",t);break;case"=":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.EQ_OP,"==",t);break}r.set(eq.EQUAL,"=",t);break;case"!":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.NE_OP,"!=",t);break}r.set(eq.BANG,"!",t);break;case"&":if(this._advance(),"&"===(e=this.getCurChar())){this._advance(),r.set(eq.AND_OP,"&&",t);break}if("="===e){this._advance(),r.set(eq.ADD_ASSIGN,"&=",t);break}r.set(eq.AMPERSAND,"&",t);break;case"|":if(this._advance(),"|"===(e=this.getCurChar())){this._advance(),r.set(eq.OR_OP,"||",t);break}if("="===e){this._advance(),r.set(eq.OR_ASSIGN,"|=",t);break}r.set(eq.VERTICAL_BAR,"|",t);break;case"^":if(this._advance(),"^"===(e=this.getCurChar())){this._advance(),r.set(eq.XOR_OP,"^^",t);break}if("="===e){this._advance(),r.set(eq.XOR_ASSIGN,"^=",t);break}r.set(eq.CARET,"^",t);break;case"*":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.MUL_ASSIGN,"*=",t);break}r.set(eq.STAR,"*",t);break;case"/":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.DIV_ASSIGN,"/=",t);break}r.set(eq.SLASH,"/",t);break;case"%":if(this._advance(),"="===this.getCurChar()){this._advance(),r.set(eq.MOD_ASSIGN,"%=",t);break}r.set(eq.PERCENT,"%",t);break;case"(":this._advance(),r.set(eq.LEFT_PAREN,"(",t);break;case")":this._advance(),r.set(eq.RIGHT_PAREN,")",t);break;case"{":this._advance(),r.set(eq.LEFT_BRACE,"{",t);break;case"}":this._advance(),r.set(eq.RIGHT_BRACE,"}",t);break;case"[":this._advance(),r.set(eq.LEFT_BRACKET,"[",t);break;case"]":this._advance(),r.set(eq.RIGHT_BRACKET,"]",t);break;case".":if(this._advance(),e1.isNum(this.getCurCharCode()))return this._scanNumAfterDot();r.set(eq.DOT,".",t);break;case",":this._advance(),r.set(eq.COMMA,",",t);break;case":":this._advance(),r.set(eq.COLON,":",t);break;case";":this._advance(),r.set(eq.SEMICOLON,";",t);break;case"~":this._advance(),r.set(eq.TILDE,"~",t);break;case"?":this._advance(),r.set(eq.QUESTION,"?",t);break;case'"':return this._advance(),this._scanStringConst();default:this.throwError(this.getCurPosition(),"Unexpected character "+this.getCurChar())}return r},r._scanStringConst=function(){for(var e=this._getPosition(),t=[];'"'!==this.getCurChar();)t.push(this.getCurChar()),this._advance();this._advance();var r=t1.createRange(e,this._getPosition()),n=e0.pool.get();return n.set(eq.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];e1.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var t=e0.pool.get();return t.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(1)),t},r._getPosition=function(e){return void 0===e&&(e=0),t1.createPosition(this.current-e,this._line,this._column-e)},r._scanWord=function(){var e=[this.getCurChar()],t=this._getPosition();for(this._advance();e1.isLetter(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();var r=e.join(""),n=eH.get(r);if(n){var i=e0.pool.get();return i.set(n,r,t),i}var a=e0.pool.get();return a.set(eq.ID,r,t),a},r._scanNum=function(){for(var e=[];e1.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();if("."===this.getCurChar()){for(e.push(this.getCurChar()),this._advance();e1.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();this._scanFloatSuffix(e);var t=e0.pool.get();return t.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),t}if("e"===this.getCurChar()||"E"===this.getCurChar()){this._scanFloatSuffix(e);var r=e0.pool.get();return r.set(eq.FLOAT_CONSTANT,e.join(""),this._getPosition(e.length)),r}this._scanIntegerSuffix(e);var n=e0.pool.get();return n.set(eq.INT_CONSTANT,e.join(""),this._getPosition(e.length)),n},r._scanFloatSuffix=function(e){if("e"===this.getCurChar()||"E"===this.getCurChar())for(e.push(this.getCurChar()),this._advance(),("+"===this.getCurChar()||"-"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance()),e1.isNum(this.getCurCharCode())||this.throwError(this.getCurPosition(),"lexing error, invalid exponent suffix.");e1.isNum(this.getCurCharCode());)e.push(this.getCurChar()),this._advance();("f"===this.getCurChar()||"F"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},r._scanIntegerSuffix=function(e){("u"===this.getCurChar()||"U"===this.getCurChar())&&(e.push(this.getCurChar()),this._advance())},t}(e9),e6=((l={})[l.Shift=0]="Shift",l[l.Reduce=1]="Reduce",l[l.Accept=2]="Accept",l),e7=function(){this.globalPrecisions=[]},e8=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},te=((p={})[p.VAR=0]="VAR",p[p.FN=1]="FN",p[p.STRUCT=2]="STRUCT",p),tt=function(e,t,r,n,i){this.ident=e,this.symbolType=t,this.astNode=r,this.dataType=n,this.signature=i},tr=/*#__PURE__*/function(e){function t(t,r){var n=new e8(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,te.FN,r,n)||this}return a(t,e),t}(tt),tn=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,te.STRUCT,r)||this}return a(t,e),t}(tt),ti=function(){this._table=new Map},ta=/*#__PURE__*/function(){function e(){this.stack=[]}var t=e.prototype;return t.newScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.dropScope=function(){this.stack.pop()},t.insert=function(e){this._scope.insert(e)},e4(e,[{key:"_scope",get:function(){return this.stack[this.stack.length-1]}}]),e}(),to=/*#__PURE__*/function(e){function r(){return e.apply(this,arguments)||this}a(r,e);var n=r.prototype;return n.insert=function(e){for(var r,n=null!=(r=this._table.get(e.ident))?r:[],i=0;i<n.length;i++)if(this._compareWith(n[i],e.symbolType,e.signature,e.astNode)){t.Logger.warn("replace symbol:",e.ident),n[i]=e;return}n.push(e),this._table.set(e.ident,n)},n.lookup=function(e,t,r,n){var i=this._table.get(e);if(i)for(var a=i.length,o=0;o<a;o++){var s=i[o];if(this._compareWith(s,t,r,n))return s}},n.getAllFnSymbols=function(e){var t;return(null!=(t=this._table.get(e))?t:[]).filter(function(e){return e.symbolType===te.FN})},n._compareWith=function(e,t,r,n){if(e.symbolType!==t)return!1;if(e.symbolType===te.FN){if(!n&&!r)return!0;var i=e.astNode.protoType.paramSig,a=null!=r?r:n.protoType.paramSig,o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;s++){var c=i[s],u=a[s];if(3e3!==c&&3e3!==u&&c!==u)return!1}}return!0},r}(ti),ts=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,te.VAR,i,r)||this).isGlobalVariable=n,a}return a(t,e),t}(tt),tc=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new ta,this.curFunctionInfo={},this._shaderData=new e7,this._translationRuleTable=new Map,this.errors=[],this.newScope()}var t=e.prototype;return t.reset=function(){this.semanticStack.length=0,this._shaderData=new e7,this.symbolTableStack.clear(),this.newScope(),this.errors.length=0},t.newScope=function(){var e=new to;this.symbolTableStack.newScope(e)},t.dropScope=function(){return this.symbolTableStack.dropScope()},t.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},t.getTranslationRule=function(e){return this._translationRuleTable.get(e)},t.lookupSymbolBy=function(e,t,r,n){for(var i=this.symbolTableStack.stack,a=i.length,o=a-1;o>=0;o--){var s=i[o].lookup(e,t,r,n);if(s)return s}},t.reportError=function(e,t){this.errors.push(new eJ(e$.CompilationError,t,e,t1._processingPassText))},e4(e,[{key:"shaderData",get:function(){return this._shaderData}}]),e}(),tu=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.array_specifier_list=2004]="array_specifier_list",h[h.array_specifier=2005]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2006]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2007]="precision_specifier",h[h.variable_identifier=2008]="variable_identifier",h[h.variable_identifier_node=2009]="variable_identifier_node",h[h.primary_expression=2010]="primary_expression",h[h.postfix_expression=2011]="postfix_expression",h[h.integer_expression=2012]="integer_expression",h[h.function_call=2013]="function_call",h[h.function_call_generic=2014]="function_call_generic",h[h.function_call_header_no_parameters=2015]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2016]="function_call_header_with_parameters",h[h.function_call_parameter_list=2017]="function_call_parameter_list",h[h.function_call_header=2018]="function_call_header",h[h.function_identifier=2019]="function_identifier",h[h.constructor_identifier=2020]="constructor_identifier",h[h.unary_expression=2021]="unary_expression",h[h.unary_operator=2022]="unary_operator",h[h.multiplicative_expression=2023]="multiplicative_expression",h[h.additive_expression=2024]="additive_expression",h[h.shift_expression=2025]="shift_expression",h[h.relational_expression=2026]="relational_expression",h[h.equality_expression=2027]="equality_expression",h[h.and_expression=2028]="and_expression",h[h.inclusive_or_expression=2029]="inclusive_or_expression",h[h.exclusive_or_expression=2030]="exclusive_or_expression",h[h.logical_and_expression=2031]="logical_and_expression",h[h.logical_xor_expression=2032]="logical_xor_expression",h[h.logical_or_expression=2033]="logical_or_expression",h[h.conditional_expression=2034]="conditional_expression",h[h.assignment_expression=2035]="assignment_expression",h[h.assignment_operator=2036]="assignment_operator",h[h.expression=2037]="expression",h[h.integer_constant_expression=2038]="integer_constant_expression",h[h.integer_constant_expression_operator=2039]="integer_constant_expression_operator",h[h.declaration=2040]="declaration",h[h.function_prototype=2041]="function_prototype",h[h.function_declarator=2042]="function_declarator",h[h.function_header_with_parameters=2043]="function_header_with_parameters",h[h.function_header=2044]="function_header",h[h.function_parameter_list=2045]="function_parameter_list",h[h.parameter_declarator=2046]="parameter_declarator",h[h.parameter_declaration=2047]="parameter_declaration",h[h.parameter_qualifier=2048]="parameter_qualifier",h[h.parameter_type_specifier=2049]="parameter_type_specifier",h[h.init_declarator_list=2050]="init_declarator_list",h[h.single_declaration=2051]="single_declaration",h[h.fully_specified_type=2052]="fully_specified_type",h[h.type_qualifier=2053]="type_qualifier",h[h.single_type_qualifier=2054]="single_type_qualifier",h[h.storage_qualifier=2055]="storage_qualifier",h[h.precision_qualifier=2056]="precision_qualifier",h[h.interpolation_qualifier=2057]="interpolation_qualifier",h[h.invariant_qualifier=2058]="invariant_qualifier",h[h.type_specifier=2059]="type_specifier",h[h.type_specifier_nonarray=2060]="type_specifier_nonarray",h[h.type_specifier_no_prec=2061]="type_specifier_no_prec",h[h.basic_type=2062]="basic_type",h[h.struct_specifier=2063]="struct_specifier",h[h.struct_declaration_list=2064]="struct_declaration_list",h[h.struct_declaration=2065]="struct_declaration",h[h.layout_qualifier=2066]="layout_qualifier",h[h.struct_declarator_list=2067]="struct_declarator_list",h[h.struct_declarator=2068]="struct_declarator",h[h.identifier_list=2069]="identifier_list",h[h.decl_identifier=2070]="decl_identifier",h[h.initializer=2071]="initializer",h[h.initializer_list=2072]="initializer_list",h[h.declaration_statement=2073]="declaration_statement",h[h.simple_statement=2074]="simple_statement",h[h.compound_statement_no_scope=2075]="compound_statement_no_scope",h[h.statement_with_scope=2076]="statement_with_scope",h[h.compound_statement=2077]="compound_statement",h[h.statement=2078]="statement",h[h.statement_list=2079]="statement_list",h[h.iteration_statement_no_new_scope=2080]="iteration_statement_no_new_scope",h[h.expression_statement=2081]="expression_statement",h[h.selection_statement=2082]="selection_statement",h[h.selection_rest_statement=2083]="selection_rest_statement",h[h.condition=2084]="condition",h[h.conditionopt=2085]="conditionopt",h[h.iteration_statement=2086]="iteration_statement",h[h.for_init_statement=2087]="for_init_statement",h[h.for_rest_statement=2088]="for_rest_statement",h[h.jump_statement=2089]="jump_statement",h[h.external_declaration=2090]="external_declaration",h[h.function_definition=2091]="function_definition",h[h.field_selection=2092]="field_selection",h[h.bool_constant=2093]="bool_constant",h[h.function_identifier_node=2094]="function_identifier_node",h[h.typename_identifier_node=2095]="typename_identifier_node",h[h.scope_brace=2096]="scope_brace",h[h.scope_end_brace=2097]="scope_end_brace",h[h._ignore=2098]="_ignore",h),tl=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tl._id=0,tl.pool=new Map;var tp=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tl(tu.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===eq.EPSILON})},t.getProductionByID=function(e){return tl.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tl(e[0],e.slice(1))}))},e}(),th=((_={})[_.VERTEX=0]="VERTEX",_[_.FRAGMENT=1]="FRAGMENT",_[_.ALL=2]="ALL",_);function t_(e){return e>=200&&e<=213}var td=new Map,tf=/*#__PURE__*/function(){function e(e,t,r){for(var n=arguments.length,i=Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];this.ident=e,this._returnType=t,this.args=i,this.scope=r}return e.getReturnType=function(e,t){return t_(e._returnType)?t:e._returnType},e._create=function(t,r){for(var n,i=arguments.length,a=Array(i>2?i-2:0),o=2;o<i;o++)a[o-2]=arguments[o];var s=eQ(e,[].concat([t,r,th.ALL],a)),c=null!=(n=td.get(t))?n:[];c.push(s),td.set(t,c)},e._createWithScop=function(t,r,n){for(var i,a=arguments.length,o=Array(a>3?a-3:0),s=3;s<a;s++)o[s-3]=arguments[s];var c=eQ(e,[].concat([t,r,n],o)),u=null!=(i=td.get(t))?i:[];u.push(c),td.set(t,u)},e.getFn=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=td.get(e),a=3e3;if(null==i?void 0:i.length){var o=i.find(function(e){if(e.args.length!==r.length)return!1;for(var t=0,n=0;n<r.length;n++)if(3e3!==r[n]){if(a=r[n],t_(e.args[n])){if(0===t){t=r[n];continue}a=t}if(3e3!==r[n]&&r[n]!==a)return!1}return!0});if(o)return{fun:o,genType:a}}},e}();tf._create("radians",200,200),tf._create("degrees",200,200),tf._create("sin",200,200),tf._create("cos",200,200),tf._create("tan",200,200),tf._create("asin",200,200),tf._create("acos",200,200),tf._create("atan",200,200,200),tf._create("atan",200,200),tf._create("sinh",200,200),tf._create("cosh",200,200),tf._create("tanh",200,200),tf._create("asinh",200,200),tf._create("acosh",200,200),tf._create("atanh",200,200),tf._create("pow",200,200,200),tf._create("exp",200,200),tf._create("log",200,200),tf._create("exp2",200,200),tf._create("log2",200,200),tf._create("sqrt",200,200),tf._create("inversesqrt",200,200),tf._create("abs",200,200),tf._create("abs",201,201),tf._create("sign",200,200),tf._create("sign",201,201),tf._create("floor",200,200),tf._create("trunc",200,200),tf._create("round",200,200),tf._create("roundEven",200,200),tf._create("ceil",200,200),tf._create("fract",200,200),tf._create("mod",200,200,ej.FLOAT),tf._create("mod",200,200,200),tf._create("min",200,200,200),tf._create("min",200,200,ej.FLOAT),tf._create("min",201,201,201),tf._create("min",201,201,ej.INT),tf._create("min",202,202,202),tf._create("min",202,202,ej.UINT),tf._create("max",200,200,200),tf._create("max",200,200,ej.FLOAT),tf._create("max",201,201,201),tf._create("max",201,201,ej.INT),tf._create("clamp",200,200,200,200),tf._create("clamp",200,200,ej.FLOAT,ej.FLOAT),tf._create("clamp",201,201,201,201),tf._create("clamp",201,201,ej.INT,ej.INT),tf._create("clamp",202,202,202,202),tf._create("clamp",202,202,ej.UINT,ej.UINT),tf._create("mix",200,200,200,200),tf._create("mix",200,200,200,ej.FLOAT),tf._create("mix",200,200,200,203),tf._create("step",200,200,200),tf._create("step",200,ej.FLOAT,200),tf._create("smoothstep",200,200,200,200),tf._create("smoothstep",200,ej.FLOAT,ej.FLOAT,200),tf._create("isnan",203,200),tf._create("isinf",203,200),tf._create("floatBitsToInt",200,200),tf._create("floatBitsToUint",202,200),tf._create("intBitsToFloat",200,201),tf._create("uintBitsToFloat",200,202),tf._create("packSnorm2x16",ej.UINT,ej.VEC2),tf._create("unpackSnorm2x16",ej.VEC2,ej.UINT),tf._create("packUnorm2x16",ej.UINT,ej.VEC2),tf._create("unpackUnorm2x16",ej.VEC2,ej.UINT),tf._create("packHalf2x16",ej.UINT,ej.VEC2),tf._create("unpackHalf2x16",ej.VEC2,ej.UINT),tf._create("length",ej.FLOAT,200),tf._create("distance",ej.FLOAT,200,200),tf._create("dot",ej.FLOAT,200,200),tf._create("cross",ej.VEC3,ej.VEC3,ej.VEC3),tf._create("normalize",200,200),tf._create("faceforward",200,200,200,200),tf._create("reflect",200,200,200),tf._create("refract",200,200,200,ej.FLOAT),tf._create("matrixCompMult",204,204,204),tf._create("outerProduct",ej.MAT2,ej.VEC2,ej.VEC2),tf._create("outerProduct",ej.MAT3,ej.VEC3,ej.VEC3),tf._create("outerProduct",ej.MAT4,ej.VEC4,ej.VEC4),tf._create("outerProduct",ej.MAT2X3,ej.VEC3,ej.VEC2),tf._create("outerProduct",ej.MAT3X2,ej.VEC2,ej.VEC3),tf._create("outerProduct",ej.MAT2X4,ej.VEC4,ej.VEC2),tf._create("outerProduct",ej.MAT4X2,ej.VEC2,ej.VEC4),tf._create("outerProduct",ej.MAT3X4,ej.VEC4,ej.VEC3),tf._create("outerProduct",ej.MAT4X3,ej.VEC3,ej.VEC4),tf._create("transpose",ej.MAT2,ej.MAT2),tf._create("transpose",ej.MAT3,ej.MAT3),tf._create("transpose",ej.MAT4,ej.MAT4),tf._create("transpose",ej.MAT2X3,ej.MAT3X2),tf._create("transpose",ej.MAT3X2,ej.MAT2X3),tf._create("transpose",ej.MAT4X2,ej.MAT2X4),tf._create("transpose",ej.MAT2X4,ej.MAT4X2),tf._create("transpose",ej.MAT3X4,ej.MAT4X3),tf._create("transpose",ej.MAT4X3,ej.MAT3X4),tf._create("determinant",ej.FLOAT,ej.MAT2),tf._create("determinant",ej.FLOAT,ej.MAT3),tf._create("determinant",ej.FLOAT,ej.MAT4),tf._create("inverse",ej.MAT2,ej.MAT2),tf._create("inverse",ej.MAT3,ej.MAT3),tf._create("inverse",ej.MAT4,ej.MAT4),tf._create("lessThan",205,208,208),tf._create("lessThan",205,206,206),tf._create("lessThan",205,207,207),tf._create("lessThanEqual",205,208,208),tf._create("lessThanEqual",205,206,206),tf._create("lessThanEqual",205,207,207),tf._create("greaterThan",205,208,208),tf._create("greaterThan",205,206,206),tf._create("greaterThan",205,207,207),tf._create("greaterThanEqual",205,208,208),tf._create("greaterThanEqual",205,206,206),tf._create("greaterThanEqual",205,207,207),tf._create("equal",205,208,208),tf._create("equal",205,206,206),tf._create("equal",205,207,207),tf._create("equal",205,205,205),tf._create("notEqual",205,208,208),tf._create("notEqual",205,206,206),tf._create("notEqual",205,207,207),tf._create("notEqual",205,205,205),tf._create("any",ej.BOOL,205),tf._create("all",ej.BOOL,205),tf._create("not",205,205),tf._create("textureSize",ej.IVEC2,210,ej.INT),tf._create("textureSize",ej.IVEC3,211,ej.INT),tf._create("textureSize",ej.IVEC2,212,ej.INT),tf._create("textureSize",ej.IVEC2,ej.SAMPLER2D_SHADOW,ej.INT),tf._create("textureSize",ej.IVEC2,ej.SAMPLER_CUBE_SHADOW,ej.INT),tf._create("textureSize",ej.IVEC3,213,ej.INT),tf._create("textureSize",ej.IVEC3,ej.SAMPLER2D_ARRAY_SHADOW,ej.INT),tf._create("texture2D",ej.SAMPLER2D,ej.VEC2),tf._create("texture2D",ej.SAMPLER2D,ej.VEC2,ej.FLOAT),tf._create("texture",209,210,ej.VEC2,ej.FLOAT),tf._create("texture",209,210,ej.VEC2),tf._create("texture",209,211,ej.VEC3,ej.FLOAT),tf._create("texture",209,211,ej.VEC3),tf._create("texture",209,212,ej.VEC3,ej.FLOAT),tf._create("texture",209,212,ej.VEC3),tf._create("texture",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.FLOAT),tf._create("texture",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3),tf._create("texture",ej.FLOAT,ej.SAMPLER_CUBE_SHADOW,ej.VEC4,ej.FLOAT),tf._create("texture",ej.FLOAT,ej.SAMPLER_CUBE_SHADOW,ej.VEC4),tf._create("texture",209,ej.SAMPLER2D_ARRAY,ej.VEC3,ej.FLOAT),tf._create("texture",209,ej.SAMPLER2D_ARRAY,ej.VEC3),tf._create("texture",ej.FLOAT,ej.SAMPLER2D_ARRAY_SHADOW,ej.VEC4),tf._create("textureProj",209,210,ej.VEC3,ej.FLOAT),tf._create("textureProj",209,210,ej.VEC3),tf._create("textureProj",209,210,ej.VEC4,ej.FLOAT),tf._create("textureProj",209,210,ej.VEC4),tf._create("textureProj",209,211,ej.VEC4,ej.FLOAT),tf._create("textureProj",209,211,ej.VEC4),tf._create("textureProj",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.FLOAT),tf._create("textureProj",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4),tf._create("textureLod",209,210,ej.VEC2,ej.FLOAT),tf._create("textureLod",209,211,ej.VEC3,ej.FLOAT),tf._create("textureLod",209,212,ej.VEC3,ej.FLOAT),tf._create("textureLod",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.FLOAT),tf._create("textureLod",209,213,ej.VEC3,ej.FLOAT),tf._create("textureCube",ej.SAMPLER_CUBE,ej.VEC3),tf._create("textureCube",ej.SAMPLER_CUBE,ej.VEC3,ej.FLOAT),tf._create("textureCubeLod",ej.SAMPLER_CUBE,ej.VEC3,ej.FLOAT),tf._create("textureOffset",209,210,ej.VEC2,ej.IVEC2,ej.FLOAT),tf._create("textureOffset",209,210,ej.VEC2,ej.IVEC2),tf._create("textureOffset",209,211,ej.VEC3,ej.IVEC3,ej.FLOAT),tf._create("textureOffset",209,211,ej.VEC3,ej.IVEC3),tf._create("textureOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.IVEC2,ej.FLOAT),tf._create("textureOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.IVEC2),tf._create("textureOffset",209,213,ej.VEC3,ej.IVEC2,ej.FLOAT),tf._create("textureOffset",209,213,ej.VEC3,ej.IVEC2),tf._create("texelFetch",209,210,ej.IVEC2,ej.INT),tf._create("texelFetch",209,211,ej.IVEC3,ej.INT),tf._create("texelFetch",209,213,ej.IVEC3,ej.INT),tf._create("texelFetchOffset",209,210,ej.IVEC2,ej.INT,ej.IVEC2),tf._create("texelFetchOffset",209,211,ej.IVEC3,ej.INT,ej.IVEC3),tf._create("texelFetchOffset",209,213,ej.IVEC3,ej.INT,ej.IVEC2),tf._create("textureProjOffset",209,210,ej.VEC3,ej.IVEC2,ej.FLOAT),tf._create("textureProjOffset",209,210,ej.VEC3,ej.IVEC2),tf._create("textureProjOffset",209,210,ej.VEC4,ej.IVEC2,ej.FLOAT),tf._create("textureProjOffset",209,210,ej.VEC4,ej.IVEC2),tf._create("textureProjOffset",209,211,ej.VEC4,ej.IVEC3,ej.FLOAT),tf._create("textureProjOffset",209,211,ej.VEC4,ej.IVEC3),tf._create("textureProjOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.IVEC2,ej.FLOAT),tf._create("textureProjOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.IVEC2),tf._create("textureLodOffset",209,210,ej.VEC2,ej.FLOAT,ej.IVEC2),tf._create("textureLodOffset",209,211,ej.VEC3,ej.FLOAT,ej.IVEC3),tf._create("textureLodOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.FLOAT,ej.IVEC2),tf._create("textureLodOffset",209,213,ej.VEC3,ej.FLOAT,ej.IVEC2),tf._create("textureProjLod",209,210,ej.VEC3,ej.FLOAT),tf._create("textureProjLod",209,210,ej.VEC4,ej.FLOAT),tf._create("textureProjLod",209,211,ej.VEC4,ej.FLOAT),tf._create("textureProjLod",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.FLOAT),tf._create("textureProjLodOffset",209,210,ej.VEC3,ej.FLOAT,ej.IVEC2),tf._create("textureProjLodOffset",209,210,ej.VEC4,ej.FLOAT,ej.IVEC2),tf._create("textureProjLodOffset",209,211,ej.VEC4,ej.FLOAT,ej.IVEC3),tf._create("textureProjLodOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.FLOAT,ej.IVEC2),tf._create("textureGrad",209,210,ej.VEC2,ej.VEC2,ej.VEC2),tf._create("textureGrad",209,211,ej.VEC3,ej.VEC3,ej.VEC3),tf._create("textureGrad",209,212,ej.VEC3,ej.VEC3,ej.VEC3),tf._create("textureGrad",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.VEC2,ej.VEC2),tf._create("textureGrad",ej.FLOAT,ej.SAMPLER_CUBE_SHADOW,ej.VEC4,ej.VEC3,ej.VEC3),tf._create("textureGrad",209,213,ej.VEC3,ej.VEC2,ej.VEC2),tf._create("textureGrad",ej.FLOAT,ej.SAMPLER2D_ARRAY_SHADOW,ej.VEC4,ej.VEC2,ej.VEC2),tf._create("textureGradOffset",209,210,ej.VEC2,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureGradOffset",209,211,ej.VEC3,ej.VEC3,ej.VEC3,ej.IVEC3),tf._create("textureGradOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC3,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureGradOffset",209,213,ej.VEC3,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureGradOffset",ej.FLOAT,ej.SAMPLER2D_ARRAY_SHADOW,ej.VEC3,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureProjGrad",209,210,ej.VEC3,ej.VEC2,ej.VEC2),tf._create("textureProjGrad",209,210,ej.VEC4,ej.VEC2,ej.VEC2),tf._create("textureProjGrad",209,211,ej.VEC4,ej.VEC3,ej.VEC3),tf._create("textureProjGrad",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.VEC2,ej.VEC2),tf._create("textureProjGradOffset",209,210,ej.VEC3,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureProjGradOffset",209,210,ej.VEC4,ej.VEC2,ej.VEC2,ej.IVEC2),tf._create("textureProjGradOffset",209,211,ej.VEC4,ej.VEC3,ej.VEC3,ej.IVEC3),tf._create("textureProjGradOffset",ej.FLOAT,ej.SAMPLER2D_SHADOW,ej.VEC4,ej.VEC2,ej.VEC2,ej.IVEC2),tf._createWithScop("dFdx",200,th.FRAGMENT,200),tf._createWithScop("dFdy",200,th.FRAGMENT,200),tf._createWithScop("fwidth",200,th.FRAGMENT,200);var tg=new Map,tS=/*#__PURE__*/function(){function e(e,t,r){this.type=e,this.lexeme=t,this.scope=r}return e.createVariable=function(t,r,n){void 0===n&&(n=th.ALL);var i=new e(r,t,n);tg.set(t,i)},e.getVar=function(e){return tg.get(e)},e}();tS.createVariable("gl_VertexID",ej.INT,th.VERTEX),tS.createVariable("gl_InstanceID",ej.INT,th.VERTEX),tS.createVariable("gl_Position",ej.VEC4,th.VERTEX),tS.createVariable("gl_PointSize",ej.FLOAT,th.VERTEX),tS.createVariable("gl_FragCoord",ej.VEC4,th.FRAGMENT),tS.createVariable("gl_FrontFacing",ej.BOOL,th.FRAGMENT),tS.createVariable("gl_FragDepth",ej.FLOAT,th.FRAGMENT),tS.createVariable("gl_PointCoord",ej.VEC2,th.FRAGMENT),tS.createVariable("gl_FragColor",ej.VEC4,th.FRAGMENT),tS.createVariable("gl_FragData",ej.VEC4_ARRAY,th.FRAGMENT),tS.createVariable("gl_MaxVertexAttribs",ej.INT),tS.createVariable("gl_MaxVertexUniformVectors",ej.INT),tS.createVariable("gl_MaxVertexOutputVectors",ej.INT),tS.createVariable("gl_MaxFragmentInputVectors",ej.INT),tS.createVariable("gl_MaxVertexTextureImageUnits",ej.INT),tS.createVariable("gl_MaxCombinedTextureImageUnits",ej.INT),tS.createVariable("gl_MaxTextureImageUnits",ej.INT),tS.createVariable("gl_MaxFragmentUniformVectors",ej.INT),tS.createVariable("gl_MaxDrawBuffers",ej.INT),tS.createVariable("gl_MinProgramTexelOffset",ej.INT),tS.createVariable("gl_MaxProgramTexelOffset",ej.INT);var ty=/*#__PURE__*/function(){function e(t,r,i){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var a,o=n(i);!(a=o()).done;){var s=a.value;this.lookaheadSet.add(s)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=n(e);!(t=r()).done;){var i=t.value;this.lookaheadSet.has(i)||(this.lookaheadSet.add(i),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==eq.EPSILON)return!1;return!0},t.advance=function(){if(this.canReduce())throw"Error: advance reduce-able parsing state item";return new e(this.production,this.position+1,this.lookaheadSet)},t.toString=function(){var e,t=this.production.derivation.map(function(e){return tA.toString(e)});return t[this.position]="."+(null!=(e=t[this.position])?e:""),tu[this.production.goal]+" :=> "+t.join("|")+" ;"+Array.from(this.lookaheadSet).map(function(e){return tA.toString(e)}).join("/")},e4(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();ty._id=0;var tm=/*#__PURE__*/function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var r,i=n(t);!(r=i()).done;){var a=r.value,o=this.getStateItemMapKey(a.production,a.position);this._stateItemPool.set(o,a)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,r){void 0===r&&(r=new Set);var i=this.getStateItemMapKey(e,t),a=this._stateItemPool.get(i);if(a){for(var o,s=n(r);!(o=s()).done;){var c=o.value;a.lookaheadSet.has(c)||(a.lookaheadSet.add(c),a.needReInfer=!0)}return a}var u=new ty(e,t,r);return this._stateItemPool.set(i,u),u},e.create=function(t){var r=this.getMapKey(t),i=this.closureMap.get(r);if(i){for(var a,o=n(t);!(a=o()).done;){var s=a.value;i.createStateItem(s.production,s.position,s.lookaheadSet)}return i}var c=new e(t);return this.closureMap.set(r,c),c},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},e4(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=n(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tm.closureMap=new Map,tm.pool=new Map,tm._id=0;var tv=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!ez(n,e0))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.typeCompatible=function(e,t){return void 0==t||(e===ej.INT?e===t||t===ej.UINT:e===t)},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eq[e])?t:ej[e]}return tu[e]},e.isTerminal=function(e){return e<tu.START},e.printStatePool=function(e){var t="";console.log("========== Parser Pool ==========");for(var r,i=0,a=n(tm.pool.values());!(r=a()).done;){var o=r.value;i++;var s="";s+=(""+o.id+": \n").padEnd(4);for(var c,u=n(o.items);!(c=u()).done;)s+=" "+c.value.toString()+"\n";t+=s}console.log("state count:",i),console.log(t)},e}(),tE=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},tx=function(e,t,r){this.typeInfo=e,this.ident=t,this.mrtIndex=r};function tC(e){return function(t){t.prototype.nt=e,t.pool=eZ.createObjectPool(t)}}var tT=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this._location=e,this._children=t,this.init()},t.init=function(){},t.dispose=function(){},t.codeGen=function(e){return e.defaultCodeGen(this.children)},t.semanticAnalyze=function(e){},e4(e,[{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(d=eB||(eB={}))._unwrapToken=function(e){if(ez(e,e0))return e;throw"not token"},d.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},f=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.TrivialNode=f,f=o([tC(tu._ignore)],f),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.newScope()},t}(tT),d.ScopeBrace=g,g=o([tC(tu.scope_brace)],g),S=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.dropScope()},t}(tT),d.ScopeEndBrace=S,S=o([tC(tu.scope_end_brace)],S),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){d._unwrapToken(this.children[0]).type===ej.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return e.visitJumpStatement(this)},t}(tT),d.JumpStatement=y,y=o([tC(tu.jump_statement)],y),m=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.ConditionOpt=m,m=o([tC(tu.conditionopt)],m),v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.ForRestStatement=v,v=o([tC(tu.for_rest_statement)],v),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.Condition=E,E=o([tC(tu.condition)],E),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.ForInitStatement=x,x=o([tC(tu.for_init_statement)],x),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.IterationStatement=C,C=o([tC(tu.iteration_statement)],C),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.SelectionStatement=T,T=o([tC(tu.selection_statement)],T),A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.ExpressionStatement=A,A=o([tC(tu.expression_statement)],A),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},e4(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tT),d.ExpressionAstNode=O,b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(O),d.InitializerList=b,b=o([tC(tu.initializer_list)],b),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=this.children[1].type},t}(O),d.Initializer=I,I=o([tC(tu.initializer)],I),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children[0],n=this.children[1];if(this.typeSpecifier=r.typeSpecifier,2===this.children.length||4===this.children.length){var i=new tE(r.type,r.typeSpecifier.lexeme),a=this.children[3];t=new ts(n.lexeme,i,!1,a)}else{var o=this.children[2];this.arraySpecifier=o;var s=new tE(r.type,r.typeSpecifier.lexeme,o),c=this.children[4];t=new ts(n.lexeme,s,!1,c)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return e.visitSingleDeclaration(this)},t}(tT),d.SingleDeclaration=P,P=o([tC(tu.single_declaration)],P),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"qualifierList",get:function(){if(this.children.length>1)return this.children[0].qualifierList}},{key:"typeSpecifier",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"type",get:function(){return this.typeSpecifier.type}}]),t}(tT),d.FullySpecifiedType=R,R=o([tC(tu.fully_specified_type)],R),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.children.length>1?this.qualifierList=[].concat(this.children[0].qualifierList,[this.children[1].qualifier]):this.qualifierList=[this.children[0].qualifier]},t}(tT),d.TypeQualifier=L,L=o([tC(tu.type_qualifier)],L),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];ez(t,e0)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tT),d.SingleTypeQualifier=M,M=o([tC(tu.single_type_qualifier)],M),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"qualifier",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}}]),t}(tT)),d.StorageQualifier=N,N=o([tC(tu.storage_qualifier)],N),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),d.PrecisionQualifier=G,G=o([tC(tu.precision_qualifier)],G),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),d.InterpolationQualifier=V,V=o([tC(tu.interpolation_qualifier)],V),D=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(k),d.InvariantQualifier=D,D=o([tC(tu.invariant_qualifier)],D),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"type",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"arraySize",get:function(){var e,t;return null==(t=this.children)?void 0:null==(e=t[1])?void 0:e.size}},{key:"isCustom",get:function(){return"string"==typeof this.type}}]),t}(tT),d.TypeSpecifier=F,F=o([tC(tu.type_specifier)],F),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"size",get:function(){return this.children[1].value}}]),t}(tT),d.ArraySpecifier=w,w=o([tC(tu.array_specifier)],w),B=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(t.type){case eq.PLUS:this.compute=function(e,t){return e+t};break;case eq.DASH:this.compute=function(e,t){return e-t};break;case eq.STAR:this.compute=function(e,t){return e*t};break;case eq.SLASH:this.compute=function(e,t){return e/t};break;case eq.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},e4(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}}]),t}(tT),d.IntegerConstantExpressionOperator=B,B=o([tC(tu.integer_constant_expression_operator)],B),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];if(ez(t,e0))this.value=Number(t.lexeme);else if(t.symbolInfo||e.reportError(t.location,"Undeclared symbol: "+t.lexeme),!tv.typeCompatible(ej.INT,t.typeInfo)){e.reportError(t.location,"Invalid integer.");return}}},t}(tT),d.IntegerConstantExpression=U,U=o([tC(tu.integer_constant_expression)],U),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];ez(e,e0)?this.type=e.lexeme:this.type=e.type,this.lexeme=e.lexeme},t}(tT),d.TypeSpecifierNonArray=W,W=o([tC(tu.type_specifier_nonarray)],W),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tT),d.ExtBuiltinTypeSpecifierNonArray=j,j=o([tC(tu.ext_builtin_type_specifier_nonarray)],j),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t;if(3===this.children.length||5===this.children.length)t=new ts(this.children[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===this.children.length||6===this.children.length){var r=this.typeInfo,n=this.children[3];r.arraySpecifier&&n&&e.reportError(n.location,"Array of array is not supported."),r.arraySpecifier=n,t=new ts(this.children[2].lexeme,r,!1,this),e.symbolTableStack.insert(t)}},e4(t,[{key:"typeInfo",get:function(){if(1===this.children.length){var e=this.children[0];return new tE(e.typeSpecifier.type,e.typeSpecifier.lexeme,e.arraySpecifier)}return this.children[0].typeInfo}}]),t}(tT),d.InitDeclaratorList=H,H=o([tC(tu.init_declarator_list)],H),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"idList",get:function(){return 2===this.children.length?[this.children[1]]:[].concat(this.children[0].idList,[this.children[2]])}}]),t}(tT),d.IdentifierList=q,q=o([tC(tu.identifier_list)],q),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitDeclaration(this)},t}(tT),d.Declaration=z,z=o([tC(tu.declaration)],z),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionProtoType(this)},e4(t,[{key:"declarator",get:function(){return this.children[0]}},{key:"ident",get:function(){return this.declarator.ident}},{key:"returnType",get:function(){return this.declarator.returnType}},{key:"parameterList",get:function(){return this.declarator.parameterInfoList}},{key:"paramSig",get:function(){return this.declarator.paramSig}}]),t}(tT),d.FunctionProtoType=X,X=o([tC(tu.function_prototype)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this},e4(t,[{key:"header",get:function(){return this.children[0]}},{key:"parameterList",get:function(){return this.children[1]}},{key:"ident",get:function(){return this.header.ident}},{key:"returnType",get:function(){return this.header.returnType}},{key:"parameterInfoList",get:function(){var e;return null==(e=this.parameterList)?void 0:e.parameterInfoList}},{key:"paramSig",get:function(){var e;return null==(e=this.parameterList)?void 0:e.paramSig}}]),t}(tT),d.FunctionDeclarator=Q,Q=o([tC(tu.function_declarator)],Q),Y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.newScope()},r.codeGen=function(e){return e.visitFunctionHeader(this)},e4(t,[{key:"ident",get:function(){return this.children[1]}},{key:"returnType",get:function(){return this.children[0]}}]),t}(tT),d.FunctionHeader=Y,Y=o([tC(tu.function_header)],Y),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitFunctionParameterList(this)},e4(t,[{key:"parameterInfoList",get:function(){if(1===this.children.length){var e=this.children[0];return[{ident:e.ident,typeInfo:e.typeInfo,astNode:e}]}var t=this.children[0],r=this.children[2];return[].concat(t.parameterInfoList,[{ident:r.ident,typeInfo:r.typeInfo,astNode:r}])}},{key:"paramSig",get:function(){if(1===this.children.length)return[this.children[0].typeInfo.type];var e=this.children[0],t=this.children[2];return e.paramSig.concat([t.typeInfo.type])}}]),t}(tT),d.FunctionParameterList=K,K=o([tC(tu.function_parameter_list)],K),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t,r=new ts((t=1===this.children.length?this.children[0]:this.children[1]).ident.lexeme,t.typeInfo,!1,this);e.symbolTableStack.insert(r)},e4(t,[{key:"typeQualifier",get:function(){if(2===this.children.length)return this.children[0]}},{key:"parameterDeclarator",get:function(){return 1===this.children.length?this.children[0]:this.children[1]}},{key:"typeInfo",get:function(){return this.parameterDeclarator.typeInfo}},{key:"ident",get:function(){return this.parameterDeclarator.ident}}]),t}(tT),d.ParameterDeclaration=J,J=o([tC(tu.parameter_declaration)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"ident",get:function(){return this.children[1]}},{key:"typeInfo",get:function(){var e=this.children[0],t=this.children[2];return new tE(e.type,e.lexeme,t)}}]),t}(tT),d.ParameterDeclarator=$,$=o([tC(tu.parameter_declarator)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.SimpleStatement=Z,Z=o([tC(tu.simple_statement)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.CompoundStatement=ee,ee=o([tC(tu.compound_statement)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.CompoundStatementNoScope=et,et=o([tC(tu.compound_statement_no_scope)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.Statement=er,er=o([tC(tu.statement)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return e.visitStatementList(this)},t}(tT),d.StatementList=en,en=o([tC(tu.statement_list)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this._returnStatement=void 0},r.semanticAnalyze=function(e){e.dropScope();var t=new tr(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(t);var r=e.curFunctionInfo,n=r.header,i=r.returnStatement;n.returnType.type===ej.VOID?i&&e.reportError(n.returnType.location,"Return in void function."):i?this._returnStatement=i:e.reportError(n.returnType.location,"No return statement found."),r.header=void 0,r.returnStatement=void 0},r.codeGen=function(e){return e.visitFunctionDefinition(this)},e4(t,[{key:"returnStatement",get:function(){return this._returnStatement}},{key:"protoType",get:function(){return this.children[0]}},{key:"statements",get:function(){return this.children[1]}}]),t}(tT),d.FunctionDefinition=ei,ei=o([tC(tu.function_definition)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return e.visitFunctionCall(this)},t}(O),d.FunctionCall=ea,ea=o([tC(tu.function_call)],ea),eo=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,n,i=t.ident;if(4===this.children.length){var a=this.children[2];ez(a,es)&&(n=a.paramSig)}var o=tf.getFn.apply(tf,[].concat([i],null!=n?n:[]));if(o){this.type=tf.getReturnType(o.fun,o.genType);return}var s=e.lookupSymbolBy(i,te.FN,n);if(!s){e.reportError(this.location,"No overload function type found: "+t.ident);return}this.type=null==s?void 0:null==(r=s.dataType)?void 0:r.type,this.fnSymbol=s}},t}(O),d.FunctionCallGeneric=eo,eo=o([tC(tu.function_call_generic)],eo),es=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"paramSig",get:function(){if(1===this.children.length){var e=this.children[0];return void 0==e.type?[3e3]:[e.type]}var t=this.children[0],r=this.children[2];return void 0==t.paramSig||void 0==r.type?[3e3]:t.paramSig.concat([r.type])}},{key:"paramNodes",get:function(){if(1===this.children.length)return[this.children[0]];var e=this.children[0],t=this.children[2];return e.paramNodes.concat([t])}}]),t}(tT),d.FunctionCallParameterList=es,es=o([tC(tu.function_call_parameter_list)],es),ec=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.shaderData.globalPrecisions.push(this)},t}(tT),d.PrecisionSpecifier=ec,ec=o([tC(tu.precision_specifier)],ec),eu=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){},r.codeGen=function(e){return e.visitFunctionIdentifier(this)},e4(t,[{key:"ident",get:function(){return this.children[0].type}},{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"isBuiltin",get:function(){return"string"!=typeof this.ident}}]),t}(tT),d.FunctionIdentifier=eu,eu=o([tC(tu.function_identifier)],eu),el=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];this.type=null!=(t=r.type)?t:3e3}else{var n,i=this.children[2];this.type=null!=(n=i.type)?n:3e3}},t}(O),d.AssignmentExpression=el,el=o([tC(tu.assignment_expression)],el),ep=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.AssignmentOperator=ep,ep=o([tC(tu.assignment_operator)],ep),eh=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];this.type=t.type}else{var r=this.children[2];this.type=r.type}},t}(O),d.Expression=eh,eh=o([tC(tu.expression)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(ez(r,eV))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eq.INT_CONSTANT:this._type=ej.INT;break;case eq.FLOAT_CONSTANT:this.type=ej.FLOAT;break;case ej.TRUE:case ej.FALSE:this.type=ej.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(O),d.PrimaryExpression=e_,e_=o([tC(tu.primary_expression)],e_),ed=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},r.codeGen=function(e){return e.visitPostfixExpression(this)},t}(O),d.PostfixExpression=ed,ed=o([tC(tu.postfix_expression)],ed),ef=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tT),d.UnaryOperator=ef,ef=o([tC(tu.unary_operator)],ef),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this.type=this.children[0].type},t}(O),d.UnaryExpression=eg,eg=o([tC(tu.unary_expression)],eg),eS=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){if(e.prototype.init.call(this),1===this.children.length)this.type=this.children[0].type;else{var t=this.children[0],r=this.children[2];t.type===r.type&&(this.type=t.type)}},t}(O),d.MultiplicativeExpression=eS,eS=o([tC(tu.multiplicative_expression)],eS),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){if(e.prototype.init.call(this),1===this.children.length)this.type=this.children[0].type;else{var t=this.children[0],r=this.children[2];t.type===r.type&&(this.type=t.type)}},t}(O),d.AdditiveExpression=ey,ey=o([tC(tu.additive_expression)],ey),em=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(O),d.ShiftExpression=em,em=o([tC(tu.shift_expression)],em),ev=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.BOOL},t}(O),d.RelationalExpression=ev,ev=o([tC(tu.relational_expression)],ev),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.BOOL},t}(O),d.EqualityExpression=eE,eE=o([tC(tu.equality_expression)],eE),ex=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.UINT},t}(O),d.AndExpression=ex,ex=o([tC(tu.and_expression)],ex),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.UINT},t}(O),d.ExclusiveOrExpression=eC,eC=o([tC(tu.exclusive_or_expression)],eC),eT=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.UINT},t}(O),d.InclusiveOrExpression=eT,eT=o([tC(tu.inclusive_or_expression)],eT),eA=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.BOOL},t}(O),d.LogicalAndExpression=eA,eA=o([tC(tu.logical_and_expression)],eA),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.BOOL},t}(O),d.LogicalXorExpression=eO,eO=o([tC(tu.logical_xor_expression)],eO),eb=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=ej.BOOL},t}(O),d.LogicalOrExpression=eb,eb=o([tC(tu.logical_or_expression)],eb),eI=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length&&(this.type=this.children[0].type)},t}(O),d.ConditionalExpression=eI,eI=o([tC(tu.conditional_expression)],eI),eP=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){6===this.children.length&&(this.ident=this.children[1],e.symbolTableStack.insert(new tn(this.ident.lexeme,this)))},e4(t,[{key:"propList",get:function(){return(6===this.children.length?this.children[3]:this.children[2]).propList}}]),t}(tT),d.StructSpecifier=eP,eP=o([tC(tu.struct_specifier)],eP),eR=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"propList",get:function(){if(1===this.children.length)return this.children[0].propList;var e=this.children[0],t=this.children[1];return[e.propList,t.propList].flat()}}]),t}(tT),d.StructDeclarationList=eR,eR=o([tC(tu.struct_declaration_list)],eR),eL=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"typeSpecifier",get:function(){return 3===this.children.length?this.children[0]:this.children[1]}},{key:"declaratorList",get:function(){return 3===this.children.length?this.children[1]:this.children[2]}},{key:"propList",get:function(){var e=[],t=this.children[0];if(ez(t,eM)){var r=this.children[1],n=this.children[2],i=new tx(new tE(r.type,r.lexeme),n.ident,t.index);e.push(i)}else for(var a=0;a<this.declaratorList.declaratorList.length;a++){var o=this.declaratorList.declaratorList[a],s=new tx(new tE(this.typeSpecifier.type,this.typeSpecifier.lexeme,o.arraySpecifier),o.ident);e.push(s)}return e}}]),t}(tT),d.StructDeclaration=eL,eL=o([tC(tu.struct_declaration)],eL),eM=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"index",get:function(){return Number(this.children[4].lexeme)}}]),t}(tT),d.LayoutQualifier=eM,eM=o([tC(tu.layout_qualifier)],eM),ek=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"declaratorList",get:function(){return 1===this.children.length?[this.children[0]]:[].concat(this.children[0].declaratorList,[this.children[1]])}}]),t}(tT),d.StructDeclaratorList=ek,ek=o([tC(tu.struct_declarator_list)],ek),eN=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),e4(t,[{key:"ident",get:function(){return this.children[0]}},{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tT),d.StructDeclarator=eN,eN=o([tC(tu.struct_declarator)],eN),eG=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t,r=this.children[0];t=new ts(this.children[1].lexeme,new tE(r.type,r.typeSpecifier.lexeme),!0,this),e.symbolTableStack.insert(t)},r.codeGen=function(e){return e.visitGlobalVariableDeclaration(this)},t}(tT),d.VariableDeclaration=eG,eG=o([tC(tu.variable_declaration)],eG),eV=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0],r=tS.getVar(t.lexeme);if(r){this.symbolInfo=r;return}this.symbolInfo=e.lookupSymbolBy(t.lexeme,te.VAR),this.symbolInfo||e.reportError(this.location,"undeclared identifier: "+t.lexeme)},r.codeGen=function(e){return e.visitVariableIdentifier(this)},e4(t,[{key:"lexeme",get:function(){return this.children[0].lexeme}},{key:"typeInfo",get:function(){var e;return ez(this.symbolInfo,ts)?this.symbolInfo.dataType.type:null==(e=this.symbolInfo)?void 0:e.type}}]),t}(tT),d.VariableIdentifier=eV,eV=o([tC(tu.variable_identifier)],eV),eD=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack._scope},t}(tT),d.GLShaderProgram=eD,o([tC(tu.gs_shader_program)],eD);var tA=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<tu.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eq[e])?t:ej[e]}return tu[e]},e.createProductionWithOptions=function(e,t,r){for(var i,a=[],o=n(t);!(i=o()).done;){var s=i.value;a.push([[].concat([e],s),function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(n[0]){var a=n[0].location.start,o=n[n.length-1].location.end,s=t1.createRange(a,o);eB.get(null!=r?r:eB.TrivialNode.pool,e,s,n)}}])}return a},e.addMapSetItem=function(e,t,r){var n,i=null!=(n=e.get(t))?n:new Set;i.add(r),e.set(t,i)},e.isSubSet=function(e,t){for(var r,i=n(e);!(r=i()).done;){var a=r.value;if(!t.has(a))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e.printAction=function(e){return"<Action: "+e6[e.action]+" -> "+(e.action===e6.Reduce?tl.pool.get(e.target):"State "+e.target)+">"},e.printProduction=function(t){var r=t.derivation.map(function(t){return e.toString(t)}).join("|");return tu[t.goal]+" :=> "+r},e}(),tO=[].concat(tA.createProductionWithOptions(tu.gs_shader_program,[[tu.global_declaration],[tu.gs_shader_program,tu.global_declaration]],eB.GLShaderProgram.pool),tA.createProductionWithOptions(tu.global_declaration,[[tu.precision_specifier],[tu.variable_declaration],[tu.struct_specifier],[tu.function_definition]]),tA.createProductionWithOptions(tu.variable_declaration,[[ej.GS_RenderQueueType,eq.ID,eq.SEMICOLON],[tu.fully_specified_type,eq.ID,eq.SEMICOLON],[tu.fully_specified_type,eq.ID,tu.array_specifier,eq.SEMICOLON]],eB.VariableDeclaration.pool),tA.createProductionWithOptions(tu.ext_builtin_type_specifier_nonarray,[[ej.VOID],[ej.FLOAT],[ej.BOOL],[ej.INT],[ej.UINT],[ej.VEC2],[ej.VEC3],[ej.VEC4],[ej.BVEC2],[ej.BVEC3],[ej.BVEC4],[ej.IVEC2],[ej.IVEC3],[ej.IVEC4],[ej.UVEC2],[ej.UVEC3],[ej.UVEC4],[ej.MAT2],[ej.MAT3],[ej.MAT4],[ej.MAT2X3],[ej.MAT2X4],[ej.MAT3X2],[ej.MAT3X4],[ej.MAT4X2],[ej.MAT4X3],[ej.SAMPLER2D],[ej.SAMPLER3D],[ej.SAMPLER_CUBE],[ej.SAMPLER2D_SHADOW],[ej.SAMPLER_CUBE_SHADOW],[ej.SAMPLER2D_ARRAY],[ej.SAMPLER2D_ARRAY_SHADOW],[ej.I_SAMPLER2D],[ej.I_SAMPLER3D],[ej.I_SAMPLER_CUBE],[ej.I_SAMPLER2D_ARRAY],[ej.U_SAMPLER2D],[ej.U_SAMPLER3D],[ej.U_SAMPLER_CUBE],[ej.U_SAMPLER2D_ARRAY]],eB.ExtBuiltinTypeSpecifierNonArray.pool),tA.createProductionWithOptions(tu.type_specifier_nonarray,[[eq.ID],[tu.ext_builtin_type_specifier_nonarray]],eB.TypeSpecifierNonArray.pool),tA.createProductionWithOptions(tu.fully_specified_type,[[tu.type_specifier],[tu.type_qualifier,tu.type_specifier]],eB.FullySpecifiedType.pool),tA.createProductionWithOptions(tu.type_specifier,[[tu.type_specifier_nonarray],[tu.ext_builtin_type_specifier_nonarray,tu.array_specifier]],eB.TypeSpecifier.pool),tA.createProductionWithOptions(tu.type_qualifier,[[tu.single_type_qualifier],[tu.type_qualifier,tu.single_type_qualifier]],eB.TypeQualifier.pool),tA.createProductionWithOptions(tu.single_type_qualifier,[[tu.storage_qualifier],[tu.precision_qualifier],[tu.interpolation_qualifier],[tu.invariant_qualifier],[ej.PRECISE]],eB.SingleTypeQualifier.pool),tA.createProductionWithOptions(tu.storage_qualifier,[[ej.CONST],[ej.IN],[ej.INOUT],[ej.OUT],[ej.CENTROID]],eB.StorageQualifier.pool),tA.createProductionWithOptions(tu.interpolation_qualifier,[[ej.SMOOTH],[ej.FLAT]],eB.InterpolationQualifier.pool),tA.createProductionWithOptions(tu.invariant_qualifier,[[ej.INVARIANT]],eB.InvariantQualifier.pool),tA.createProductionWithOptions(tu.precision_qualifier,[[ej.HIGHP],[ej.MEDIUMP],[ej.LOWP]],eB.PrecisionQualifier.pool),tA.createProductionWithOptions(tu.struct_specifier,[[ej.STRUCT,eq.ID,eq.LEFT_BRACE,tu.struct_declaration_list,eq.RIGHT_BRACE,eq.SEMICOLON],[ej.STRUCT,eq.LEFT_BRACE,tu.struct_declaration_list,eq.RIGHT_BRACE,eq.SEMICOLON]],eB.StructSpecifier.pool),tA.createProductionWithOptions(tu.struct_declaration_list,[[tu.struct_declaration],[tu.struct_declaration_list,tu.struct_declaration]],eB.StructDeclarationList.pool),tA.createProductionWithOptions(tu.struct_declaration,[[tu.type_specifier,tu.struct_declarator_list,eq.SEMICOLON],[tu.type_qualifier,tu.type_specifier,tu.struct_declarator_list,eq.SEMICOLON],[tu.layout_qualifier,tu.type_specifier,tu.struct_declarator,eq.SEMICOLON]],eB.StructDeclaration.pool),tA.createProductionWithOptions(tu.layout_qualifier,[[ej.LAYOUT,eq.LEFT_PAREN,ej.LOCATION,eq.EQUAL,eq.INT_CONSTANT,eq.RIGHT_PAREN]],eB.LayoutQualifier.pool),tA.createProductionWithOptions(tu.struct_declarator_list,[[tu.struct_declarator],[tu.struct_declarator_list,eq.COMMA,tu.struct_declarator]],eB.StructDeclaratorList.pool),tA.createProductionWithOptions(tu.struct_declarator,[[eq.ID],[eq.ID,tu.array_specifier]],eB.StructDeclarator.pool),tA.createProductionWithOptions(tu.array_specifier,[[eq.LEFT_BRACKET,eq.RIGHT_BRACKET],[eq.LEFT_BRACKET,tu.integer_constant_expression,eq.RIGHT_BRACKET]],eB.ArraySpecifier.pool),tA.createProductionWithOptions(tu.integer_constant_expression_operator,[[eq.PLUS],[eq.DASH],[eq.STAR],[eq.SLASH],[eq.PERCENT]],eB.IntegerConstantExpressionOperator.pool),tA.createProductionWithOptions(tu.integer_constant_expression,[[tu.variable_identifier],[eq.INT_CONSTANT],[tu.integer_constant_expression,tu.integer_constant_expression_operator,eq.INT_CONSTANT],[tu.integer_constant_expression,tu.integer_constant_expression_operator,tu.variable_identifier]],eB.IntegerConstantExpression.pool),tA.createProductionWithOptions(tu.conditional_expression,[[tu.logical_or_expression],[tu.logical_or_expression,eq.QUESTION,tu.expression,eq.COLON,tu.assignment_expression]],eB.ConditionalExpression.pool),tA.createProductionWithOptions(tu.logical_or_expression,[[tu.logical_xor_expression],[tu.logical_or_expression,eq.OR_OP,tu.logical_xor_expression]],eB.LogicalOrExpression.pool),tA.createProductionWithOptions(tu.logical_xor_expression,[[tu.logical_and_expression],[tu.logical_xor_expression,eq.XOR_OP,tu.logical_and_expression]],eB.LogicalXorExpression.pool),tA.createProductionWithOptions(tu.logical_and_expression,[[tu.inclusive_or_expression],[tu.logical_and_expression,eq.AND_OP,tu.inclusive_or_expression]],eB.LogicalAndExpression.pool),tA.createProductionWithOptions(tu.inclusive_or_expression,[[tu.exclusive_or_expression],[tu.inclusive_or_expression,eq.VERTICAL_BAR,tu.exclusive_or_expression]],eB.InclusiveOrExpression.pool),tA.createProductionWithOptions(tu.exclusive_or_expression,[[tu.and_expression],[tu.exclusive_or_expression,eq.CARET,tu.and_expression]],eB.ExclusiveOrExpression.pool),tA.createProductionWithOptions(tu.and_expression,[[tu.equality_expression],[tu.and_expression,eq.AMPERSAND,tu.equality_expression]],eB.AndExpression.pool),tA.createProductionWithOptions(tu.equality_expression,[[tu.relational_expression],[tu.equality_expression,eq.EQ_OP,tu.relational_expression],[tu.equality_expression,eq.NE_OP,tu.relational_expression]],eB.EqualityExpression.pool),tA.createProductionWithOptions(tu.relational_expression,[[tu.shift_expression],[tu.relational_expression,eq.LEFT_ANGLE,tu.shift_expression],[tu.relational_expression,eq.RIGHT_ANGLE,tu.shift_expression],[tu.relational_expression,eq.LE_OP,tu.shift_expression],[tu.relational_expression,eq.GE_OP,tu.shift_expression]],eB.RelationalExpression.pool),tA.createProductionWithOptions(tu.shift_expression,[[tu.additive_expression],[tu.shift_expression,eq.LEFT_OP,tu.additive_expression],[tu.shift_expression,eq.RIGHT_OP,tu.additive_expression]],eB.ShiftExpression.pool),tA.createProductionWithOptions(tu.additive_expression,[[tu.multiplicative_expression],[tu.additive_expression,eq.PLUS,tu.multiplicative_expression],[tu.additive_expression,eq.DASH,tu.multiplicative_expression]],eB.AdditiveExpression.pool),tA.createProductionWithOptions(tu.multiplicative_expression,[[tu.unary_expression],[tu.multiplicative_expression,eq.STAR,tu.unary_expression],[tu.multiplicative_expression,eq.SLASH,tu.unary_expression],[tu.multiplicative_expression,eq.PERCENT,tu.unary_expression]],eB.MultiplicativeExpression.pool),tA.createProductionWithOptions(tu.unary_expression,[[tu.postfix_expression],[eq.INC_OP,tu.unary_expression],[eq.DEC_OP,tu.unary_expression],[tu.unary_operator,tu.unary_expression]],eB.UnaryExpression.pool),tA.createProductionWithOptions(tu.unary_operator,[[eq.PLUS],[eq.DASH],[eq.BANG],[eq.TILDE]],eB.UnaryOperator.pool),tA.createProductionWithOptions(tu.postfix_expression,[[tu.primary_expression],[tu.postfix_expression,eq.LEFT_BRACKET,tu.expression,eq.RIGHT_BRACKET],[tu.function_call],[tu.postfix_expression,eq.DOT,eq.ID],[tu.postfix_expression,eq.DOT,tu.function_call],[tu.postfix_expression,eq.INC_OP],[tu.postfix_expression,eq.DEC_OP]],eB.PostfixExpression.pool),tA.createProductionWithOptions(tu.primary_expression,[[tu.variable_identifier],[eq.INT_CONSTANT],[eq.FLOAT_CONSTANT],[ej.TRUE],[ej.FALSE],[eq.LEFT_PAREN,tu.expression,eq.RIGHT_PAREN]],eB.PrimaryExpression.pool),tA.createProductionWithOptions(tu.expression,[[tu.assignment_expression],[tu.expression,eq.COMMA,tu.assignment_expression]],eB.Expression.pool),tA.createProductionWithOptions(tu.assignment_expression,[[tu.conditional_expression],[tu.unary_expression,tu.assignment_operator,tu.assignment_expression]],eB.AssignmentExpression.pool),tA.createProductionWithOptions(tu.assignment_operator,[[eq.EQUAL],[eq.MUL_ASSIGN],[eq.DIV_ASSIGN],[eq.MOD_ASSIGN],[eq.ADD_ASSIGN],[eq.SUB_ASSIGN],[eq.LEFT_ASSIGN],[eq.RIGHT_ASSIGN],[eq.AND_ASSIGN],[eq.XOR_ASSIGN],[eq.OR_ASSIGN]],eB.AssignmentOperator.pool),tA.createProductionWithOptions(tu.function_call,[[tu.function_call_generic]],eB.FunctionCall.pool),tA.createProductionWithOptions(tu.function_call_generic,[[tu.function_identifier,eq.LEFT_PAREN,tu.function_call_parameter_list,eq.RIGHT_PAREN],[tu.function_identifier,eq.LEFT_PAREN,eq.RIGHT_PAREN],[tu.function_identifier,ej.VOID,eq.RIGHT_PAREN]],eB.FunctionCallGeneric.pool),tA.createProductionWithOptions(tu.function_call_parameter_list,[[tu.assignment_expression],[tu.function_call_parameter_list,eq.COMMA,tu.assignment_expression]],eB.FunctionCallParameterList.pool),tA.createProductionWithOptions(tu.function_identifier,[[tu.type_specifier]],eB.FunctionIdentifier.pool),tA.createProductionWithOptions(tu.function_definition,[[tu.function_prototype,tu.compound_statement_no_scope]],eB.FunctionDefinition.pool),tA.createProductionWithOptions(tu.function_prototype,[[tu.function_declarator,eq.RIGHT_PAREN]],eB.FunctionProtoType.pool),tA.createProductionWithOptions(tu.function_declarator,[[tu.function_header],[tu.function_header,tu.function_parameter_list]],eB.FunctionDeclarator.pool),tA.createProductionWithOptions(tu.function_header,[[tu.fully_specified_type,eq.ID,eq.LEFT_PAREN]],eB.FunctionHeader.pool),tA.createProductionWithOptions(tu.function_parameter_list,[[tu.parameter_declaration],[tu.function_parameter_list,eq.COMMA,tu.parameter_declaration]],eB.FunctionParameterList.pool),tA.createProductionWithOptions(tu.parameter_declaration,[[tu.type_qualifier,tu.parameter_declarator],[tu.parameter_declarator]],eB.ParameterDeclaration.pool),tA.createProductionWithOptions(tu.parameter_declarator,[[tu.type_specifier,eq.ID],[tu.type_specifier,eq.ID,tu.array_specifier]],eB.ParameterDeclarator.pool),tA.createProductionWithOptions(tu.statement_list,[[tu.statement],[tu.statement_list,tu.statement]],eB.StatementList.pool),tA.createProductionWithOptions(tu.statement,[[tu.compound_statement],[tu.simple_statement]],eB.Statement.pool),tA.createProductionWithOptions(tu.compound_statement_no_scope,[[eq.LEFT_BRACE,eq.RIGHT_BRACE],[eq.LEFT_BRACE,tu.statement_list,eq.RIGHT_BRACE]],eB.CompoundStatementNoScope.pool),tA.createProductionWithOptions(tu.compound_statement,[[eq.LEFT_BRACE,eq.RIGHT_BRACE],[tu.scope_brace,tu.statement_list,tu.scope_end_brace]],eB.CompoundStatement.pool),tA.createProductionWithOptions(tu.simple_statement,[[tu.declaration],[tu.expression_statement],[tu.selection_statement],[tu.iteration_statement],[tu.jump_statement]],eB.SimpleStatement.pool),tA.createProductionWithOptions(tu.declaration,[[tu.function_prototype,eq.SEMICOLON],[tu.init_declarator_list,eq.SEMICOLON],[ej.PRECISION,tu.precision_qualifier,tu.ext_builtin_type_specifier_nonarray,eq.SEMICOLON],[tu.type_qualifier,eq.ID,eq.SEMICOLON],[tu.type_qualifier,eq.ID,tu.identifier_list,eq.SEMICOLON]],eB.Declaration.pool),tA.createProductionWithOptions(tu.identifier_list,[[eq.COMMA,eq.ID],[tu.identifier_list,eq.COMMA,eq.ID]],eB.IdentifierList.pool),tA.createProductionWithOptions(tu.init_declarator_list,[[tu.single_declaration],[tu.init_declarator_list,eq.COMMA,eq.ID],[tu.init_declarator_list,eq.COMMA,eq.ID,tu.array_specifier],[tu.init_declarator_list,eq.COMMA,eq.ID,tu.array_specifier,eq.EQUAL,tu.initializer],[tu.init_declarator_list,eq.COMMA,eq.ID,eq.EQUAL,tu.initializer]],eB.InitDeclaratorList.pool),tA.createProductionWithOptions(tu.single_declaration,[[tu.fully_specified_type,eq.ID],[tu.fully_specified_type,eq.ID,tu.array_specifier],[tu.fully_specified_type,eq.ID,tu.array_specifier,eq.EQUAL,tu.initializer],[tu.fully_specified_type,eq.ID,eq.EQUAL,tu.initializer]],eB.SingleDeclaration.pool),tA.createProductionWithOptions(tu.initializer,[[tu.assignment_expression],[eq.LEFT_BRACE,tu.initializer_list,eq.RIGHT_BRACE]],eB.Initializer.pool),tA.createProductionWithOptions(tu.initializer_list,[[tu.initializer],[tu.initializer_list,eq.COMMA,tu.initializer]],eB.InitializerList.pool),tA.createProductionWithOptions(tu.expression_statement,[[eq.SEMICOLON],[tu.expression,eq.SEMICOLON]],eB.ExpressionStatement.pool),tA.createProductionWithOptions(tu.selection_statement,[[ej.IF,eq.LEFT_PAREN,tu.expression,eq.RIGHT_PAREN,tu.statement],[ej.IF,eq.LEFT_PAREN,tu.expression,eq.RIGHT_PAREN,tu.statement,ej.ELSE,tu.statement]],eB.SelectionStatement.pool),tA.createProductionWithOptions(tu.iteration_statement,[[ej.WHILE,eq.LEFT_PAREN,tu.condition,eq.RIGHT_PAREN,tu.statement],[ej.FOR,eq.LEFT_PAREN,tu.for_init_statement,tu.for_rest_statement,eq.RIGHT_PAREN,tu.statement]],eB.IterationStatement.pool),tA.createProductionWithOptions(tu.precision_specifier,[[ej.PRECISION,tu.precision_qualifier,tu.ext_builtin_type_specifier_nonarray,eq.SEMICOLON]],eB.PrecisionSpecifier.pool),tA.createProductionWithOptions(tu.for_init_statement,[[tu.expression_statement],[tu.declaration]],eB.ForInitStatement.pool),tA.createProductionWithOptions(tu.condition,[[tu.expression],[tu.fully_specified_type,eq.ID,eq.EQUAL,tu.initializer]],eB.Condition.pool),tA.createProductionWithOptions(tu.for_rest_statement,[[tu.conditionopt,eq.SEMICOLON],[tu.conditionopt,eq.SEMICOLON,tu.expression]],eB.ForRestStatement.pool),tA.createProductionWithOptions(tu.conditionopt,[[eq.EPSILON],[tu.condition]],eB.ConditionOpt.pool),tA.createProductionWithOptions(tu.jump_statement,[[ej.CONTINUE,eq.SEMICOLON],[ej.BREAK,eq.SEMICOLON],[ej.RETURN,eq.SEMICOLON],[ej.RETURN,tu.expression,eq.SEMICOLON],[ej.DISCARD,eq.SEMICOLON]],eB.JumpStatement.pool),tA.createProductionWithOptions(tu.scope_brace,[[eq.LEFT_BRACE]],eB.ScopeBrace.pool),tA.createProductionWithOptions(tu.scope_end_brace,[[eq.RIGHT_BRACE]],eB.ScopeEndBrace.pool),tA.createProductionWithOptions(tu.variable_identifier,[[eq.ID]],eB.VariableIdentifier.pool)),tb=function(e){for(var t=0;t<tO.length;t++){var r=tO[t][1];r&&e.addTranslationRule(t,r)}},tI=/*#__PURE__*/function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new ty(this.grammar.productions[0],0,[eq.EOF])],t=tm.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),i=n(r);!(t=i()).done;){var a=t.value;this._extendState(a)}}},t._closure=function(e){for(var t,r=n(e.cores);!(t=r()).done;){var i=t.value;i.canReduce()||this._extendStateItem(e,i)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tA.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var i=new Set,a=!1,o=1,s=t.symbolByOffset(1);s;s=t.symbolByOffset(++o)){if(tA.isTerminal(s)){i.add(s),a=!0;break}c=this.firstSetMap.get(s);for(var c,u,l=n(c);!(u=l()).done;){var p=u.value;i.add(p)}if(!c.has(eq.EPSILON))break}if(!a&&(null==c?void 0:c.has(eq.EPSILON)))for(var h,_=n(t.lookaheadSet);!(h=_()).done;){var d=h.value;i.add(d)}for(var f,g=n(r);!(f=g()).done;){var S=f.value,y=e.createStateItem(S,0);e.items.has(y)&&tA.isSubSet(i,y.lookaheadSet)||(e.items.add(y),y.addLookahead(i),this._extendStateItem(e,y))}}else for(var m,v=n(r);!(m=v()).done;){var E=m.value,x=e.createStateItem(E,0);e.items.has(x)&&tA.isSubSet(t.lookaheadSet,x.lookaheadSet)||(e.items.add(x),x.addLookahead(t.lookaheadSet),this._extendStateItem(e,x))}}},t._inferNextState=function(e){var t=new Map,r=null!=(a=this.actionTable.get(e.id))?a:new Map,i=null!=(o=this.gotoTable.get(e.id))?o:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,i);for(var a,o,s,c=n(e.items);!(s=c()).done;){var u=s.value;if(u.canReduce()){var l=void 0;l=u.production.goal!==tu.START?{action:e6.Reduce,target:u.production.id}:{action:e6.Accept};for(var p,h=n(u.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,l)}}else{var d=u.advance();tA.addMapSetItem(t,u.curSymbol,d)}u.needReInfer=!1}for(var f,g=new Set,S=n(t.entries());!(f=S()).done;){var y=f.value,m=y[0],v=y[1],E=tm.create(Array.from(v));tA.isTerminal(m)?this._addAction(r,m,{action:e6.Shift,target:E.id}):i.set(m,E.id),g.add(E)}return g},t._addAction=function(e,t,r){var n=e.get(t);if(n&&!tA.isActionEqual(n,r)){if(t===ej.ELSE&&n.action===e6.Shift&&r.action===e6.Reduce)return;console.warn("conflict detect: <Terminal "+tA.toString(t)+">",tA.printAction(n)," -> ",tA.printAction(r))}e.set(t,r)},t.computeFirstSet=function(){for(var e,t=n(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},t._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),i=this._firstSetNTStack.length,a=i-1;a>t;a--){var o=this._firstSetNTStack[a];this.firstSetMap.set(o,r)}return r}this._firstSetNTStack.push(e);var s=this.grammar.getProductionList(e),c=new Set;this.firstSetMap.set(e,c),this.grammar.isNullableNT(e)&&c.add(eq.EPSILON);for(var u,l=n(s);!(u=l()).done;){for(var p=u.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tA.isTerminal(_)){c.add(_);break}for(var d,f=this._computeFirstSetForNT(_),g=n(f);!(d=g()).done;){var S=d.value;S!==eq.EPSILON&&c.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&c.add(eq.EPSILON)}return this._firstSetNTStack.pop(),c},e}(),tP=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new tc}var r=e.prototype;return r.parse=function(e){this.sematicAnalyzer.reset();var r=performance.now(),n=this._traceBackStack,i=this.sematicAnalyzer;n.push(0);for(var a=e.next(),o=0;;){o+=1;var s=a.value,c=this.stateActionTable.get(s.type);if((null==c?void 0:c.action)===e6.Shift)n.push(s,c.target),a=e.next();else if((null==c?void 0:c.action)===e6.Accept)return t.Logger.info("[pass compilation - parser] Accept! State automata run "+o+" times! cost time "+(performance.now()-r)+"ms"),null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();else if((null==c?void 0:c.action)===e6.Reduce){for(var u=c.target,l=this.grammar.getProductionByID(u),p=i.getTranslationRule(l.id),h=[],_=l.derivation.length-1;_>=0;_--)if(l.derivation[_]!==eq.EPSILON){n.pop();var d=n.pop();if(ez(d,e0))h.unshift(d);else{var f=i.semanticStack.pop();h.unshift(f)}}null==p||p.apply(void 0,[].concat([i],h));var g=this.stateGotoTable;n.push(l.goal);var S=null==g?void 0:g.get(l.goal);n.push(S);continue}else{var y=eZ.createGSError("Unexpected token "+s.lexeme,e$.CompilationError,t1._processingPassText,s.location);return this.sematicAnalyzer.errors.push(y),null}}},r._printStack=function(e){for(var r="",n=0;n<this._traceBackStack.length-1;n++){var i,a=this._traceBackStack[n++],o=this._traceBackStack[n];r+="State"+a+" - "+(null!=(i=o.lexeme)?i:tv.toString(o))+"; "}r+="State"+this._traceBackStack[this._traceBackStack.length-1]+" --- "+e.lexeme,t.Logger.info(r)},e.create=function(){if(!this._singleton){var t=tp.create(tu.gs_shader_program,tO.map(function(e){return e[0]})),r=new tI(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tb(this._singleton.sematicAnalyzer)}return this._singleton},e4(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}},{key:"errors",get:function(){return this.sematicAnalyzer.errors}}]),e}();function tR(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var tL=/*#__PURE__*/function(){function e(e,t,r,n){this.macro=e,this.body=t,this.location=r,this.args=n,n&&(this._argsLexemes=this.args.map(function(e){return e.lexeme}),this._replaceRegex=RegExp("\\b("+this._argsLexemes.join("|")+")\\b","g"))}return e.prototype.expandFunctionBody=function(e){var t,r=this;if(e.length!==(null==(t=this.args)?void 0:t.length))throw eZ.createGSError("mismatched function macro",e$.PreprocessorError,"",this.location);return this.body.lexeme.replace(this._replaceRegex,function(t){return e[r._argsLexemes.indexOf(t)]})},e4(e,[{key:"isFunction",get:function(){var e;return!!(null==(e=this.args)?void 0:e.length)}}]),e}(),tM=((eF={})[eF.id=0]="id",eF[eF.line_remain=1]="line_remain",eF[eF.chunk=2]="chunk",eF[eF.int_constant=3]="int_constant",eF[eF.string_const=4]="string_const",eF[eF.right_op=5]="right_op",eF[eF.left_op=6]="left_op",eF[eF.left_paren=7]="left_paren",eF[eF.right_paren=8]="right_paren",eF[eF.ge=9]="ge",eF[eF.le=10]="le",eF[eF.eq=11]="eq",eF[eF.neq=12]="neq",eF[eF.and=13]="and",eF[eF.or=14]="or",eF[eF.left_angle=15]="left_angle",eF[eF.right_angle=16]="right_angle",eF[eF.star=17]="star",eF[eF.plus=18]="plus",eF[eF.dash=19]="dash",eF[eF.bang=20]="bang",eF[eF.slash=21]="slash",eF[eF.percent=22]="percent",eF[eF.EOF=100]="EOF",eF),tk=((ew={})[ew.define=101]="define",ew[ew.undef=102]="undef",ew[ew.if=103]="if",ew[ew.ifdef=104]="ifdef",ew[ew.ifndef=105]="ifndef",ew[ew.else=106]="else",ew[ew.elif=107]="elif",ew[ew.endif=108]="endif",ew[ew.include=109]="include",ew[ew.defined=110]="defined",ew),tN=new Map([["#define",101],["#undef",102],["#if",103],["#ifdef",104],["#ifndef",105],["#else",106],["#elif",107],["#endif",108],["#include",109],["defined",110]]),tG=function(e,t,r){this.sourceFile=null!=e?e:"__main__",this.rangeInFile=t,this.sourceMap=r},tV=/*#__PURE__*/function(){function e(e,t,r){this.sourceLoc={block:e,rangeInBlock:t},this.generatedLoc=r}return e.prototype.getSourceIndex=function(e){var t,r,n,i,a=this.sourceLoc,o=a.block,s=a.rangeInBlock;if(o.sourceMap){if("__main__"!==o.sourceFile)return o.sourceMap.map(e-this.generatedLoc.start);if(s)return{sourceFile:o.sourceFile,index:(null!=(n=null==(r=o.rangeInFile)?void 0:r.start.index)?n:0)+s.start.index}}return{index:e-this.generatedLoc.start+s.start.index+(null!=(i=null==(t=o.rangeInFile)?void 0:t.start.index)?i:0),sourceFile:this.sourceLoc.block.sourceFile}},e}(),tD=/*#__PURE__*/function(){function e(){this.mapRanges=[]}var t=e.prototype;return t.addMapRange=function(e){this.mapRanges.push(e)},t.map=function(t){for(var r,i,a=n(this.mapRanges);!(i=a()).done;){var o=i.value,s=o.generatedLoc;if(e.rangeContains(s,t))return o.getSourceIndex(t);if(o.generatedLoc.start<t){r=o;continue}break}return r?{index:t-r.generatedLoc.end+r.sourceLoc.rangeInBlock.end.index,sourceFile:r.sourceLoc.block.sourceFile}:{sourceFile:"__main__",index:t}},e.rangeContains=function(e,t){return e.start<=t&&e.end>t},e}(),tF=/*#__PURE__*/function(){function e(){}return e.expand=function(e,t,r){for(var i,a=[],o=0,s=0,c=n(e);!(i=c()).done;){var u=i.value,l=t.slice(o,u.rangeInBlock.start.index);a.push(l,u.replace);var p=s+l.length+u.replace.length,h=new tV(u.block,u.rangeInBlock,{start:s+l.length,end:p});null==r||r.addMapRange(h),o=u.rangeInBlock.end.index,s=p}return a.push(t.slice(o)),a.join("")},e.assembleSegments=function(e,t){for(var r,i=[],a=0,o=n(e);!(r=o()).done;){var s=r.value,c=t.slice(a,s.range.start.index);i.push(c,s.replace),a=s.range.end.index}return i.push(t.slice(a)),i.join("")},e}(),tw=/*#__PURE__*/function(e){function t(t,r,n){var i;return void 0===r&&(r="__main__"),(i=e.call(this,t)||this).macroLvl=0,i.sourceMap=new tD,i.file=r,i.blockRange=n,i}a(t,e);var r=t.prototype;return r.scanDirective=function(e){var t=this._advanceToDirective(e);return[tk.if,tk.ifdef,tk.ifndef].includes(null==t?void 0:t.type)?this.macroLvl+=1:(null==t?void 0:t.type)===tk.endif&&(this.macroLvl-=1),t},r.scanWordsUntilChar=function(e){for(var t=[];;)if(this.skipSpace(!0),e1.isLetter(this.getCurCharCode()))t.push(this.scanWord());else{if(this.getCurChar()===e)return this._advance(),t;this._advance()}},r.scanWord=function(e){if(void 0===e&&(e=!1),e)for(;!e1.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();else this.skipSpace(!0);if(this.isEnd())return e2;for(var t=this._currentIndex;e1.isLetter(this.getCurCharCode())&&!this.isEnd();)this._advance();var r=this._currentIndex,n=this._source.slice(t,r);r===t&&this.throwError(this.getShaderPosition(0),"no word found.");var i=tN.get(n);if(i){var a=e0.pool.get();return a.set(i,n,this.getShaderPosition(0)),a}var o=e0.pool.get();return o.set(tM.id,n,this.getShaderPosition(n.length)),o},r.getShaderPosition=function(e){return t1.createPosition(this._currentIndex-e,this.line,this.column-e)},r.scanToken=function(e){if(this.skipCommentsAndSpace(),!this.isEnd()){for(var t=this._source,r=this._currentIndex,n=!1,i=t.length;this._currentIndex<i;)if(e1.isPpCharactors(t.charCodeAt(this._currentIndex)))this._advance(),n=!0;else{if(n)break;this._advance(),this.skipCommentsAndSpace(),r=this._currentIndex}var a=t.slice(r,this._currentIndex),o=e0.pool.get(),s=tN.get(a);return o.set(null!=s?s:tM.id,a,this.getShaderPosition(this._currentIndex-r)),null==e||e(o,this),o}},r.scanQuotedString=function(){this.skipSpace(!0),'"'!==this.getCurChar()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var e=this.getShaderPosition(0);this._advance();for(var t=this._currentIndex;'"'!==this.getCurChar()&&!this.isEnd();)this._advance();this.isEnd()&&this.throwError(this.getShaderPosition(0),"unexpected char, expected '\"'");var r=this._source.slice(t,this._currentIndex),n=e0.pool.get();return n.set(tM.string_const,r,e),n},r.scanToChar=function(e){for(var t=this._source;t[this._currentIndex]!==e&&!this.isEnd();)this._advance()},r.scanMacroBranchChunk=function(){for(var e=this._currentIndex,t=this.getShaderPosition(0),r=this.macroLvl,n=this.scanDirective();(n.type!==tk.endif||r-1!==this.macroLvl)&&(![tk.elif,tk.else].includes(n.type)||r!==this.macroLvl);)n=this.scanDirective();var i=this._source.slice(e,this._currentIndex-n.lexeme.length-1),a=e0.pool.get();return a.set(tM.chunk,i,t),{token:a,nextDirective:n}},r.scanPairedBlock=function(e,t){this.scanToChar(e);var r=0,n=this._source;do{var i=n[this._currentIndex];i===e?r++:i===t&&r--,this._advance()}while(r>0)},r.scanRemainMacro=function(){for(var e=this.macroLvl,t=this.scanDirective();!this.isEnd()&&(t.type!==tk.endif||e-1!==this.macroLvl);)t=this.scanDirective();return this.getShaderPosition(0)},r.peekNonSpace=function(){for(var e=this._currentIndex;/\s/.test(this._source[e]);)e+=1;return this._source[e]},r.scanInteger=function(){for(var e=this._currentIndex;e1.isNum(this.getCurCharCode());)this._advance();this._currentIndex===e&&this.throwError(this.getShaderPosition(0),"no integer found");var t=this._source.slice(e,this._currentIndex),r=e0.pool.get();return r.set(tM.int_constant,t,this.getShaderPosition(0)),r},r.scanLineRemain=function(){this.skipSpace(!1);for(var e=this._currentIndex,t=[];"\n"!==this.getCurChar();){if(this.isEnd()){var r=this._source.slice(e,this._currentIndex),n=e0.pool.get();return n.set(tM.line_remain,r,this.getShaderPosition(r.length)),n}this._advance();var i=this._skipComments();i&&(i.start.index-=e,i.end.index-=e,t.push(i))}var a=this._source.slice(e,this._currentIndex);t.length&&(a=tF.assembleSegments(t.map(function(e){return{range:e,replace:""}}),a));var o=e0.pool.get();return o.set(tM.line_remain,a,this.getShaderPosition(a.length)),o},r._advanceToDirective=function(e){for(;;){var t=this.scanToken(e);if(null==t?void 0:t.lexeme.startsWith("#"))return t;if(this.isEnd())return}},r._skipComments=function(){if("//"===this.peek(2)){for(var e=this.getShaderPosition(0);"\n"!==this.getCurChar()&&!this.isEnd();)this._advance();return t1.createRange(e,this.getCurPosition())}if("/*"===this.peek(2)){var t=this.getShaderPosition(0);for(this.advance(2);"*/"!==this.peek(2)&&!this.isEnd();)this._advance();return this.advance(2),t1.createRange(t,this.getShaderPosition(0))}},t}(e9),tB=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){this._definedMacros.clear(),this._expandSegmentsStack.length=0,this._expandSegmentsStack.push([]),this._branchMacros.clear(),this.addPredefinedMacro("GL_ES"),this._includeMap=e,this._basePathForIncludeKey=t,this._errors.length=0},e.addPredefinedMacro=function(e,t){var r,n=e0.pool.get();n.set(tM.id,e),t&&(r=e0.pool.get()).set(tM.id,t),this._definedMacros.set(e,new tL(n,r))},e.parse=function(e){for(;!e.isEnd();){var t=e.scanDirective(this._onToken.bind(this));if(e.isEnd())break;switch(t.type){case tk.define:this._parseDefine(e);break;case tk.undef:this._parseUndef(e);break;case tk.if:this._parseIf(e);break;case tk.ifndef:this._parseIfNdef(e);break;case tk.ifdef:this._parseIfDef(e);break;case tk.include:this._parseInclude(e)}}return this._errors.length>0?null:tF.expand(this.expandSegments,e.source,e.sourceMap)},e.reportError=function(e,t,r,n){var i=eZ.createGSError(t,e$.PreprocessorError,r,e,n);this._errors.push(i)},e._parseInclude=function(e){var r,n=e.getShaderPosition(8);e.skipSpace(!0);var i=e.scanQuotedString();r="."!==i.lexeme[0]?i.lexeme:new URL(i.lexeme,this._basePathForIncludeKey).href.substring(t.ShaderPass._shaderRootPath.length),e.scanToChar("\n");var a=e.getShaderPosition(0),o=this._includeMap[r];if(!o){this.reportError(i.location,'Shader slice "'+r+'" not founded.',e.source,e.file);return}var s=t1.createRange(n,a),c=this._expandMacroChunk(o,s,i.lexeme),u=new tG(i.lexeme,void 0,c.sourceMap);this.expandSegments.push({block:u,rangeInBlock:s,replace:c.content})},e._parseIfDef=function(e){var t=e.current-6,r=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(r.lexeme);var n=this._definedMacros.get(r.lexeme);e.skipSpace(!0);var i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(n){var s=o.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=new tG(e.file,e.blockRange,c.sourceMap),l=t1.createRange(a.location.start,s);this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._parseMacroBranch=function(e,t){if(e!==tk.endif){var r=t.current;if(e===tk.else){var n=t.scanMacroBranchChunk().token,i=this._expandMacroChunk(n.lexeme,n.location,t),a=new tG(t.file,t.blockRange,i.sourceMap),o=t1.createPosition(r),s=t1.createRange(o,t.getShaderPosition(0));this.expandSegments.push({block:a,rangeInBlock:s,replace:i.content})}else if(e===tk.elif){var c=this._parseConstantExpression(t),u=t.scanMacroBranchChunk(),l=u.token,p=u.nextDirective;if(c){var h=p.type===tk.endif?t.current:t.scanRemainMacro().index,_=this._expandMacroChunk(l.lexeme,l.location,t),d=new tG(t.file,t.blockRange,_.sourceMap),f=t1.createPosition(r),g=t1.createPosition(h),S=t1.createRange(f,g);this.expandSegments.push({block:d,rangeInBlock:S,replace:_.content})}else{var y=new tG(t.file,t.blockRange),m=t1.createPosition(r),v=t1.createPosition(t.current),E=t1.createRange(m,v);this.expandSegments.push({block:y,rangeInBlock:E,replace:""}),this._parseMacroBranch(p.type,t)}}}},e._parseConstantExpression=function(e){return e.skipSpace(!0),this._parseLogicalOrExpression(e)},e._parseLogicalOrExpression=function(e){var t=this._parseLogicalAndExpression(e),r=e.peek(2);if(r&&"||"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalOrExpression(e);return t||n}return t},e._parseLogicalAndExpression=function(e){var t=this._parseEqualityExpression(e),r=e.peek(2);if(r&&"&&"===r){e.advance(2),e.skipSpace(!1);var n=this._parseLogicalAndExpression(e);return t&&n}return t},e._parseEqualityExpression=function(e){var t=this._parseRelationalExpression(e),r=e.peek(2);if(r&&["==","!="].includes(r)){e.advance(2),e.skipSpace(!1);var n=this._parseEqualityExpression(e);switch(r){case"==":return t===n;case"!=":return t!==n}}return t},e._parseRelationalExpression=function(e){var t=this._parseShiftExpression(e),r=e.peek(2);if("="!==r[1]&&(r=r[0]),r&&[">","<",">=","<="].includes(r)){var n=e.getShaderPosition(0);e.advance(r.length),e.skipSpace(!1);var i=this._parseRelationalExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(n,"invalid operator in relation expression.",e.source,e.file);return}switch(r){case">":return t>i;case"<":return t<i;case">=":return t>=i;case"<=":return t<=i}}return t},e._parseShiftExpression=function(e){var t=this._parseAdditiveExpression(e),r=e.peek(2);if(r&&[">>","<<"].includes(r)){var n=e.getShaderPosition(0);e.advance(2),e.skipSpace(!1);var i=this._parseShiftExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(n,"invalid operator in shift expression.",e.source,e.file);return}switch(r){case">>":return t>>i;case"<<":return t<<i}}return t},e._parseAdditiveExpression=function(e){var t=this._parseMulticativeExpression(e);if([">","<"].includes(e.getCurChar())){var r=e.getShaderPosition(0);e.advance();var n=e.getCurChar();e.skipSpace(!1);var i=this._parseAdditiveExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t)return this.reportError(r,"invalid operator.",e.source,e.file),!1;switch(n){case"+":return t+i;case"-":return t-i}}return t},e._parseMulticativeExpression=function(e){var t=this._parseUnaryExpression(e);if(e.skipSpace(!1),["*","/","%"].includes(e.getCurChar())){var r=e.getShaderPosition(0),n=e.getCurChar();e.skipSpace(!1);var i=this._parseMulticativeExpression(e);if((void 0===t?"undefined":tR(t))!==(void 0===i?"undefined":tR(i))&&"number"!=typeof t){this.reportError(r,"invalid operator.",e.source,e.file);return}switch(n){case"*":return t*i;case"/":return t/i;case"%":return t%i}}return t},e._parseUnaryExpression=function(e){var t=e.getCurChar();if(["+","-","!"].includes(t)){e.advance();var r=e.getShaderPosition(0),n=this._parseParenthesisExpression(e);switch(("!"===t&&"boolean"!=typeof n||"!"!==t&&"number"!=typeof n)&&this.reportError(r,"invalid operator.",e.source,e.file),t){case"+":return n;case"-":return-n;case"!":return!n}}return this._parseParenthesisExpression(e)},e._parseParenthesisExpression=function(e){if("("===e.getCurChar()){e._advance(),e.skipSpace(!1);var t=this._parseConstantExpression(e);return e.scanToChar(")"),e._advance(),t}return this._parseConstant(e)},e._parseConstant=function(e){if(e1.isAlpha(e.getCurCharCode())){var t=e.scanWord();if(t.type===tk.defined){var r="("===e.peekNonSpace(),n=e.scanWord(!0);return r&&(e.scanToChar(")"),e._advance()),this._branchMacros.add(n.lexeme),!!this._definedMacros.get(n.lexeme)}var i=this._definedMacros.get(t.lexeme);if(!i)return!1;i.isFunction&&this.reportError(t.location,"invalid function macro usage",e.source,e.file);var a=Number(i.body.lexeme);return Number.isInteger(a)||this.reportError(t.location,"invalid const macro: "+t.lexeme,e.source,e.file),this._branchMacros.add(t.lexeme),a}if(e1.isNum(e.getCurCharCode()))return Number(e.scanInteger().lexeme);this.reportError(e.getShaderPosition(0),"invalid token: "+e.getCurChar(),e.source,e.file)},e._expandMacroChunk=function(e,t,r){this._expandSegmentsStack.push([]),n="string"==typeof r?new tw(e,r):new tw(e,r.file,t);var n,i=this.parse(n);return this._expandSegmentsStack.pop(),{content:i,sourceMap:n.sourceMap}},e._parseIfNdef=function(e){var t=e.current-7,r=e.scanWord();this._addEmptyReplace(e,t),this._branchMacros.add(r.lexeme);var n=this._definedMacros.get(r.lexeme),i=e.scanMacroBranchChunk(),a=i.token,o=i.nextDirective;if(!n){var s=o.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),c=this._expandMacroChunk(a.lexeme,a.location,e),u=new tG(e.file,e.blockRange,c.sourceMap),l=t1.createRange(a.location.start,s);this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(o.type,e)},e._addEmptyReplace=function(e,t){var r=new tG(e.file,e.blockRange),n=t1.createPosition(t),i=e.getCurPosition(),a=t1.createRange(n,i);this.expandSegments.push({block:r,rangeInBlock:a,replace:""})},e._parseIf=function(e){var t=e.current-3,r=this._parseConstantExpression(e);this._addEmptyReplace(e,t);var n=e.scanMacroBranchChunk(),i=n.token,a=n.nextDirective;if(r){var o=a.type===tk.endif?e.getShaderPosition(0):e.scanRemainMacro(),s=this._expandMacroChunk(i.lexeme,i.location,e),c=new tG(e.file,e.blockRange,s.sourceMap),u=t1.createRange(i.location.start,o);this.expandSegments.push({block:c,rangeInBlock:u,replace:s.content});return}this.expandSegments.pop(),this._addEmptyReplace(e,t),this._parseMacroBranch(a.type,e)},e._parseDefine=function(e){var t,r=e.getShaderPosition(7),n=e.scanWord(),i=n.location.end;this._definedMacros.get(n.lexeme)&&n.lexeme.startsWith("GL_")&&this.reportError(n.location,"redefined macro: "+n.lexeme,e.source,e.file),"("===e.getCurChar()&&(t=e.scanWordsUntilChar(")"),i=e.getShaderPosition(0));var a=new tL(n,e.scanLineRemain(),t1.createRange(r,i),t);this._definedMacros.set(n.lexeme,a);var o=new tG(e.file,e.blockRange);this.expandSegments.push({block:o,rangeInBlock:t1.createRange(r,e.getCurPosition()),replace:""})},e._parseUndef=function(e){var t=e.current-6,r=e.scanWord(),n=new tG(e.file,e.blockRange),i=t1.createPosition(t),a=t1.createRange(i,e.getCurPosition());this.expandSegments.push({block:n,rangeInBlock:a,replace:""}),this._definedMacros.delete(r.lexeme)},e._onToken=function(e,t){var r=this._definedMacros.get(e.lexeme);if(r){var n=r.body.lexeme;if(r.isFunction){t.scanToChar("("),t._advance();for(var i=[],a=1,o=t.current;;){if("("===t.getCurChar())a+=1;else if(")"===t.getCurChar()){if(0==(a-=1))break}else","===t.getCurChar()&&1===a&&(i.push(t.source.slice(o,t.current)),o=t.current+1);t._advance()}i.push(t.source.slice(o,t.current)),t._advance();var s=t1.createRange(e.location.start,t.getCurPosition());n=r.expandFunctionBody(i);var c=this._expandMacroChunk(n,s,t),u=new tG(t.file,t.blockRange,c.sourceMap),l=t1.createRange(e.location.start,t.getCurPosition());this.expandSegments.push({block:u,rangeInBlock:l,replace:c.content})}else{var p=this._expandMacroChunk(n,e.location,t),h=new tG(t.file,t.blockRange,p.sourceMap),_=t1.createRange(e.location.start,e.location.end);this.expandSegments.push({block:h,rangeInBlock:_,replace:p.content})}}},e4(e,null,[{key:"expandSegments",get:function(){return this._expandSegmentsStack[this._expandSegmentsStack.length-1]}}]),e}();tB._definedMacros=new Map,tB._expandSegmentsStack=[[]],tB._branchMacros=new Set,tB._errors=[];var tU=/*#__PURE__*/function(){function e(){}return e.reset=function(e,t){tB.reset(e,t)},e.process=function(e){return this.baseScanner=new tw(e),tB.parse(this.baseScanner)},e.addPredefinedMacro=function(e,t){tB.addPredefinedMacro(e,t)},e.convertSourceIndex=function(e){return this.baseScanner.sourceMap.map(e)},e}(),tW=/*#__PURE__*/function(){function e(){this.attributeList=[],this.attributeStructs=[],this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null)}var t=e.prototype;return t.reset=function(){this.attributeList.length=0,this.attributeStructs.length=0,this._referencedAttributeList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this.mrtStruct=void 0},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){var t,r;return(null==(r=this.varyingStruct)?void 0:null==(t=r.ident)?void 0:t.lexeme)===e},t.isMRTStruct=function(e){var t,r;return(null==(r=this.mrtStruct)?void 0:null==(t=r.ident)?void 0:t.lexeme)===e},t.referenceAttribute=function(e){if(!this._referencedAttributeList[e.lexeme]){var t=this.attributeList.find(function(t){return t.ident.lexeme===e.lexeme});if(!t)return eZ.createGSError("referenced attribute not found: "+e.lexeme,e$.CompilationError,t1._processingPassText,e.location);this._referencedAttributeList[e.lexeme]=t}},t.referenceVarying=function(e){if(!this._referencedVaryingList[e.lexeme]){var t,r=null==(t=this.varyingStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!r)return eZ.createGSError("referenced varying not found: "+e.lexeme,e$.CompilationError,t1._processingPassText,e.location);this._referencedVaryingList[e.lexeme]=r}},t.referenceMRTProp=function(e){if(!this._referencedMRTList[e.lexeme]){var t,r=null==(t=this.mrtStruct)?void 0:t.propList.find(function(t){return t.ident.lexeme===e.lexeme});if(!r)return eZ.createGSError("referenced mrt not found: "+e.lexeme,e$.CompilationError,t1._processingPassText,e.location);this._referencedMRTList[e.lexeme]=r}},t.referenceGlobal=function(e,t){if(!this._referencedGlobals[e]){if(t===te.FN){for(var r=this._passSymbolTable.getAllFnSymbols(e),n=0;n<r.length;n++){var i=0===n?e:e+n;this._referencedGlobals[i]=r[n]}return}var a=this._passSymbolTable.lookup(e,t);a&&(this._referencedGlobals[e]=a)}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},e4(e,[{key:"passSymbolTable",get:function(){return this._passSymbolTable}}],[{key:"context",get:function(){return this._singleton}}]),e}(),tj=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tH="GS_glFragColor",tq=/*#__PURE__*/function(){function e(){this.errors=[]}var t=e.prototype;return t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=n(t);!(a=o()).done;){var s=a.value;ez(s,e0)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return r.return(i),i.array.join(" ")},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,n=tW.context;if(3===r){var i=t[0],a=t[2];if(!ez(a,e0))return i.codeGen(this)+"."+a.codeGen(this);if(n.isAttributeStruct(i.type)){var o=n.referenceAttribute(a);return o&&this.errors.push(o),a.lexeme}if(n.isVaryingStruct(i.type)){var s=n.referenceVarying(a);return s&&this.errors.push(s),a.lexeme}if(n.isMRTStruct(i.type)){var c=n.referenceMRTProp(a);return c&&this.errors.push(c),a.lexeme}return i.codeGen(this)+"."+a.lexeme}if(4===r){var u=t[0],l=t[2],p=u.codeGen(this),h=l.codeGen(this);if("gl_FragData"===p){n._referencedVaryingList[tH]&&this._reportError(u.location,"cannot use both gl_FragData and gl_FragColor");var _=this.getFragDataCodeGen(h);return n._referencedMRTList[_]=this.getReferencedMRTPropText(h,_),_}return p+"["+h+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){return ez(e.symbolInfo,ts)&&e.symbolInfo.isGlobalVariable&&tW.context.referenceGlobal(e.lexeme,te.VAR),e.lexeme},t.visitFunctionCall=function(e){var t=e.children[0];if(ez(t.fnSymbol,tr)){tW.context.referenceGlobal(t.fnSymbol.ident,te.FN);var r=t.children[2],n=t.fnSymbol.astNode.protoType.parameterList;if(ez(r,eB.FunctionCallParameterList)){for(var i=[],a=r.paramNodes,o=0;o<a.length;o++)tW.context.isAttributeStruct(n[o].typeInfo.typeLexeme)||tW.context.isVaryingStruct(n[o].typeInfo.typeLexeme)||i.push(a[o].codeGen(this));return t.fnSymbol.ident+"("+i.join(", ")+")"}}return this.defaultCodeGen(e.children)},t.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},t.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&tW.context.referenceGlobal(t,te.STRUCT),this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];return ez(r,eB.FullySpecifiedType)&&r.typeSpecifier.isCustom&&tW.context.referenceGlobal(r.type,te.STRUCT),this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=tW.context,r=e.children,n=r[0];if(ez(n,eB.InitDeclaratorList)){var i=n.typeInfo.typeLexeme;if(t.isVaryingStruct(i)||t.isMRTStruct(i))return""}return this.defaultCodeGen(r)},t.visitFunctionProtoType=function(e){return tW.context._curFn=e,this.defaultCodeGen(e.children)},t.visitFunctionDefinition=function(e){return tW.context._curFn=void 0,this.defaultCodeGen(e.children)},t.visitFunctionParameterList=function(e){var t=this;return e.parameterInfoList.filter(function(e){return!tW.context.isAttributeStruct(e.typeInfo.typeLexeme)&&!tW.context.isVaryingStruct(e.typeInfo.typeLexeme)}).map(function(e){return e.astNode.codeGen(t)}).join(", ")},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return tW.context.isAttributeStruct(t)||tW.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===ej.RETURN){var r=t[1];if(ez(r,eB.Expression)){var n,i,a,o,s=tv.unwrapNodeByType(r,tu.variable_identifier);if((null==s?void 0:s.typeInfo)===(null==(i=tW.context.varyingStruct)?void 0:null==(n=i.ident)?void 0:n.lexeme))return"";var c=tv.unwrapNodeByType(r,tu.function_call);if((null==c?void 0:c.type)===(null==(o=tW.context.varyingStruct)?void 0:null==(a=o.ident)?void 0:a.lexeme))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t._reportError=function(e,t){this.errors.push(new eJ(e$.CompilationError,t,e,t1._processingPassText))},e}();tq._tmpArrayPool=new t.ReturnableObjectPool(tj,10);var tz=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="",t._extensions="",t._globalCodeArray=[],t}a(t,e);var r=t.prototype;return r.visitShaderProgram=function(e,t,r){return this.errors.length=0,tW.reset(),tW.context._passSymbolTable=e.shaderData.symbolTable,{vertex:this.vertexMain(t,e.shaderData),fragment:this._fragmentMain(r,e.shaderData)}},r.vertexMain=function(e,t){var r=t.symbolTable,i=r.lookup(e,te.FN);if(!(null==i?void 0:i.astNode))throw"no entry function found: "+e;var a=i.astNode;tW.context.stage=th.VERTEX;var o=a.protoType.returnType;if("string"==typeof o.type){var s=r.lookup(o.type,te.STRUCT);s?tW.context.varyingStruct=s.astNode:this._reportError(o.location,"invalid varying struct: "+o.type)}else o.type!==ej.VOID&&this._reportError(o.location,"vertex main entry can only return struct or void.");var c=a.protoType.parameterList;if(null==c?void 0:c.length)for(var u,l=n(c);!(u=l()).done;){var p=u.value;if("string"==typeof p.typeInfo.type){var h=r.lookup(p.typeInfo.type,te.STRUCT);if(!h){this._reportError(p.astNode.location,'Not found attribute struct "'+p.typeInfo.type+'".');continue}tW.context.attributeStructs.push(h.astNode);for(var _,d=n(h.astNode.propList);!(_=d()).done;){var f=_.value;tW.context.attributeList.push(f)}}else tW.context.attributeList.push(p)}var g=a.statements.codeGen(this),S=this._globalCodeArray;S.length=0,this._getGlobalText(t,S),this.getAttributeDeclare(S),this.getVaryingDeclare(S);var y=S.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return tW.context.reset(),this._versionText+"\n"+y+"\n\nvoid main() "+g},r._fragmentMain=function(e,t){var r=t.symbolTable,n=r.lookup(e,te.FN);if(!(null==n?void 0:n.astNode))throw"no entry function found: "+e;var i=n.astNode,a=i.returnStatement;a&&(a.isFragReturnStatement=!0);var o=tW.context;o.stage=th.FRAGMENT;var s=i.protoType.returnType,c=s.type,u=s.location;if("string"==typeof c){var l=r.lookup(c,te.STRUCT);l?o.mrtStruct=l.astNode:this._reportError(u,"invalid mrt struct: "+c)}else c!==ej.VOID&&c!==ej.VEC4&&this._reportError(u,"fragment main entry can only return struct or vec4.");var p=i.statements.codeGen(this),h=this._globalCodeArray;h.length=0,this._getGlobalText(t,h),this.getVaryingDeclare(h),this.getMRTDeclare(h);var _=h.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return o.reset(),this._versionText+"\n"+this._extensions+"\n\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n\n"+_+"\n\nvoid main() "+p},r._getGlobalText=function(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=new Set);var a=tW.context._referencedGlobals;if(r===Object.keys(a).length){for(var o,s=n(e.globalPrecisions);!(o=s()).done;){var c=o.value;t.push({text:c.codeGen(this),index:c.location.start.index})}return t}for(var u in r=Object.keys(a).length,a){var l=a[u];i.has(u)||(i.add(u),ez(l,tt)?l.symbolType===te.VAR?t.push({text:"uniform "+l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.astNode.codeGen(this),index:l.astNode.location.start.index}):t.push({text:l.codeGen(this),index:l.location.start.index}))}return this._getGlobalText(e,t,r,i)},t}(tq),tX=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 100",t._extensions=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives","GL_EXT_draw_buffers","GL_EXT_frag_depth"].map(function(e){return"#extension "+e+" : enable\n"}).join(""),t}a(t,e);var r=t.prototype;return r.getFragDataCodeGen=function(e){return"gl_FragData["+e+"]"},r.getReferencedMRTPropText=function(e,t){return""},r.getAttributeDeclare=function(e){for(var t,r=n(Object.values(tW.context._referencedAttributeList));!(t=r()).done;){var i=t.value;e.push({text:"attribute "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getVaryingDeclare=function(e){for(var t,r=n(Object.values(tW.context._referencedVaryingList));!(t=r()).done;){var i=t.value;e.push({text:"varying "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getMRTDeclare=function(e){},r.visitPostfixExpression=function(t){var r=t.children,n=r[0],i=tW.context;if(ez(n,eB.PostfixExpression)&&i.isMRTStruct(n.type)){var a=r[2],o=i.mrtStruct.propList.find(function(e){return e.ident.lexeme===a.lexeme});return o?"gl_FragData["+o.mrtIndex+"]":(this._reportError(a.location,"not found mrt property: "+a.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?"gl_FragColor = "+t.children[1].codeGen(this):e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tz),tQ=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._versionText="#version 300 es",t}a(t,e);var r=t.prototype;return r.getFragDataCodeGen=function(e){return"GS_glFragData_"+e},r.getReferencedMRTPropText=function(e,t){return"layout(location = "+e+") out vec4 "+t+";"},r.getAttributeDeclare=function(e){for(var t,r=n(Object.values(tW.context._referencedAttributeList));!(t=r()).done;){var i=t.value;e.push({text:"in "+i.typeInfo.typeLexeme+" "+i.ident.lexeme+";",index:i.ident.location.start.index})}},r.getVaryingDeclare=function(e){for(var t=tW.context.stage===th.FRAGMENT?"in":"out",r=Object.values(tW.context._referencedVaryingList),n=0;n<r.length;n++){var i,a=r[n];e.push({text:(null!=(i=a.qualifier)?i:t)+" "+a.typeInfo.typeLexeme+" "+a.ident.lexeme+";",index:a.ident.location.start.index})}},r.getMRTDeclare=function(e){var t=tW.context._referencedMRTList;for(var r in t){var n=t[r];"string"==typeof n?e.push({text:n,index:Number.MAX_SAFE_INTEGER}):e.push({text:this.getReferencedMRTPropText(n.mrtIndex,r),index:n.ident.location.start.index})}},r.visitFunctionIdentifier=function(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;if("texture2D"===e.ident||"textureCube"===e.ident)r="texture";else if("texture2DProj"===e.ident)r="textureProj";else if(tW.context.stage===th.FRAGMENT)switch(e.ident){case"texture2DLodEXT":case"textureCubeLodEXT":r="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":r="textureGrad";break;case"texture2DProjLodEXT":r="textureProjLod";break;case"texture2DProjGradEXT":r="textureProjGrad";break;case"gl_FragDepthEXT":r="gl_FragDepth"}return r},r.visitVariableIdentifier=function(t){var r=tW.context;return r.stage===th.FRAGMENT&&"gl_FragColor"===t.lexeme?(r._referencedMRTList.gl_FragData&&this._reportError(t.location,"cannot use both gl_FragData and gl_FragColor"),r.mrtStruct&&this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets)."),this._registerFragColorVariable(t),tH):e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tW.context.mrtStruct?"":(this._registerFragColorVariable(t),tH+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(e){var t=tW.context._referencedVaryingList;if(!t[tH]){var r=e0.pool.get();r.set(eq.ID,tH,t1.createPosition(0,0,0)),t[tH]={ident:r,typeInfo:new tE(ej.VEC4,"vec4"),qualifier:"out",astNode:e}}},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(tz);function tY(){return(tY=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var tK=new Map([["RenderQueueType",ej.GS_RenderQueueType],["BlendState",ej.GS_BlendState],["DepthState",ej.GS_DepthState],["StencilState",ej.GS_StencilState],["RasterState",ej.GS_RasterState],["EditorProperties",ej.GS_EditorProperties],["EditorMacros",ej.GS_EditorMacros],["Editor",ej.GS_Editor],["Tags",ej.GS_Tags],["VertexShader",ej.GS_VertexShader],["FragmentShader",ej.GS_FragmentShader],["SubShader",ej.GS_SubShader],["Pass",ej.GS_Pass],["BlendFactor",ej.GS_BlendFactor],["BlendOperation",ej.GS_BlendOperation],["Bool",ej.GS_Bool],["Number",ej.GS_Number],["CompareFunction",ej.GS_CompareFunction],["StencilOperation",ej.GS_StencilOperation],["CullMode",ej.GS_CullMode],["true",ej.TRUE],["false",ej.FALSE],["UsePass",ej.GS_UsePass],["Color",ej.GS_Color]]),tJ=/*#__PURE__*/function(e){function t(t,r){return void 0===r&&(r=new Map),e.call(this,t,r)||this}a(t,e);var r=t.prototype;return r.scanWord=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/\S/.test(this.getCurChar())&&!this.isEnd();)this._advance();return this._source.substring(e,this._currentIndex)},r.scanNumber=function(){this.skipCommentsAndSpace();for(var e=this._currentIndex;/[0-9]/.test(this.getCurChar());)this._advance();if("."===this.getCurChar())for(this._advance();/[0-9]/.test(this.getCurChar());)this._advance();return Number(this._source.substring(e,this._currentIndex))},r.scanToCharacter=function(e){for(;this.getCurChar()!==e&&!this.isEnd();)this._advance();this._advance()},t}(e9),t$=/*#__PURE__*/function(e){function r(){return e.apply(this,arguments)||this}a(r,e);var n=r.prototype;return n.insert=function(e){for(var r,n=null!=(r=this._table.get(e.ident))?r:[],i=0;i<n.length;i++)if(n[i].type===e.type){t.Logger.warn("replace symbol:",e.ident),n[i]=e;return}n.push(e),this._table.set(e.ident,n)},n.lookup=function(e,t){var r=this._table.get(e);if(r)for(var n=r.length,i=0;i<n;i++){var a=r[i];if(a.type===t)return a}},r}(ti),tZ=[ej.GS_RenderQueueType,ej.GS_BlendFactor,ej.GS_BlendOperation,ej.GS_Bool,ej.GS_Number,ej.GS_Color,ej.GS_CompareFunction,ej.GS_StencilOperation,ej.GS_CullMode],t0=[ej.GS_BlendState,ej.GS_DepthState,ej.GS_RasterState,ej.GS_StencilState],t2=/*#__PURE__*/function(){function e(){}return e.reset=function(){this._errors.length=0,this._symbolTableStack.clear(),this._newScope()},e.parse=function(e){var r=performance.now(),n=new tJ(e,tK),i={subShaders:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}}};n.scanText("Shader"),i.name=n.scanPairedText('"','"'),n.scanText("{"),n.skipCommentsAndSpace(),this._parseShaderStatements(i,n);for(var a=i.globalContents,o=i.renderStates,s=0;s<i.subShaders.length;s++)for(var c=i.subShaders[s],u=a.concat(c.globalContents),l=tY({},o.constantMap,c.renderStates.constantMap),p=tY({},o.variableMap,c.renderStates.variableMap),h=0;h<c.passes.length;h++){var _=c.passes[h];if(Object.assign(_.renderStates.constantMap,l),Object.assign(_.renderStates.variableMap,p),!_.isUsePass){var d=u.concat(_.globalContents);_.contents=d.map(function(e){return e.content}).join("\n")}}return t.Logger.info("[content compilation] cost time "+(performance.now()-r)+"ms"),i},e._isRenderStateDeclarator=function(e){return t0.includes(e.type)},e._isEngineType=function(e){return tZ.includes(e.type)},e._lookupSymbolByType=function(t,r){for(var n=e._symbolTableStack.stack,i=n.length,a=i-1;a>=0;a--){var o=n[a].lookup(t,r);if(o)return o}},e._parseShaderStatements=function(t,r){for(var n=1,i=r.getCurPosition();;){var a=r.scanToken();switch(a.type){case ej.GS_SubShader:this._addGlobalStatement(t,r,i,a.lexeme.length);var o=this._parseSubShader(r);t.subShaders.push(o),i=r.getCurPosition();break;case ej.GS_EditorProperties:case ej.GS_EditorMacros:case ej.GS_Editor:this._addGlobalStatement(t,r,i,a.lexeme.length),r.scanPairedText("{","}",!0),i=r.getCurPosition();break;case ej.GS_RenderQueueType:this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseRenderQueueAssignment(t,r),i=r.getCurPosition();break;case eq.NOT_WORD:if("{"===a.lexeme)n+=1;else if("}"===a.lexeme&&0==(n-=1)){this._addGlobalStatement(t,r,i,a.lexeme.length),this._symbolTableStack.dropScope();return}default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(t,a,r),i=r.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(t,r,i,a.lexeme.length),this._parseVariableDeclaration(a.type,r),i=r.getCurPosition())}}},e._parseRenderStateDeclarationOrAssignment=function(t,r,n){var i,a=n.scanToken();if(a.type===eq.ID)i=!0,n.scanText("{");else if("{"===a.lexeme)i=!1;else if("="===a.lexeme){var o=n.scanToken();n.scanText(";");var s=e._lookupSymbolByType(o.lexeme,r.type);if(!(null==s?void 0:s.value)){var c=eZ.createGSError('Invalid "'+r.lexeme+'" variable: '+o.lexeme,e$.CompilationError,n.source,o.location);this._errors.push(c);return}var u=s.value;Object.assign(t.renderStates.constantMap,u.constantMap),Object.assign(t.renderStates.variableMap,u.variableMap);return}var l=this._parseRenderStatePropList(r.lexeme,n);i?this._symbolTableStack.insert({ident:a.lexeme,type:r.type,value:l}):(Object.assign(t.renderStates.constantMap,l.constantMap),Object.assign(t.renderStates.variableMap,l.variableMap))},e._parseVariableDeclaration=function(e,t){var r=t.scanToken();t.scanText(";"),this._symbolTableStack.insert({type:r.type,ident:r.lexeme})},e._newScope=function(){var e=new t$;this._symbolTableStack.newScope(e)},e._dropScope=function(){this._symbolTableStack.dropScope()},e._parseRenderStatePropList=function(e,t){for(var r={constantMap:{},variableMap:{}};"}"!==t.getCurChar();)this._parseRenderStatePropItem(r,e,t),t.skipCommentsAndSpace();return t._advance(),r},e._parseRenderStatePropItem=function(r,n,i){var a=i.scanToken().lexeme,o=i.scanToken();if("BlendState"===n&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0;if("["===o.lexeme)s=i.scanNumber(),i.scanText("]"),i.scanText("=");else if("="!==o.lexeme){var c=eZ.createGSError("Invalid syntax, expect character '=', but got "+o.lexeme,e$.CompilationError,i.source,i.getCurPosition());this._errors.push(c),i.scanToCharacter(";");return}a+=s}a=n+a;var u=t.RenderStateDataKey[a];if(void 0==u){var l=eZ.createGSError("Invalid render state element "+a,e$.CompilationError,i.source,i.getCurPosition());this._errors.push(l),i.scanToCharacter(";");return}if(i.skipCommentsAndSpace(),/[0-9.]/.test(i.getCurChar()))_=i.scanNumber();else{var p=i.scanToken();if(p.type===ej.TRUE)_=!0;else if(p.type===ej.FALSE)_=!1;else if(p.type===ej.GS_Color){i.scanText("(");for(var h=[];;){if(h.push(i.scanNumber()),i.skipCommentsAndSpace(),")"===i.peek(1)){i._advance();break}i.scanText(",")}_=eQ(t.Color,[].concat(h))}else if("."===i.getCurChar()){i._advance();var _,d,f=i.scanToken();if(void 0==(_=null==(d=e._engineType[p.lexeme])?void 0:d[f.lexeme])){var g=eZ.createGSError("Invalid engine constant: "+p.lexeme+"."+f.lexeme,e$.CompilationError,i.source,f.location);this._errors.push(g),i.scanToCharacter(";");return}}else _=p.lexeme}i.scanText(";"),"string"==typeof _?r.variableMap[u]=_:r.constantMap[u]=_},e._parseRenderQueueAssignment=function(r,n){n.scanText("=");var i=n.scanToken();n.scanText(";");var a=e._engineType.RenderQueueType[i.lexeme],o=t.RenderStateDataKey.RenderQueueType;void 0==a?r.renderStates.variableMap[o]=i.lexeme:r.renderStates.constantMap[o]=a},e._addGlobalStatement=function(e,t,r,n){t.current>r.index+n&&e.globalContents.push({range:{start:r,end:tY({},t.getCurPosition(),{index:t.current-n-1})},content:t.source.substring(r.index,t.current-n-1)})},e._parseSubShader=function(t){this._newScope();var r={passes:[],globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}},n=1;r.name=t.scanPairedText('"','"'),t.scanText("{"),t.skipCommentsAndSpace();for(var i=t.getCurPosition();;){var a=t.scanToken();switch(a.type){case ej.GS_Pass:this._addGlobalStatement(r,t,i,a.lexeme.length);var o=this._parsePass(t);r.passes.push(o),i=t.getCurPosition();break;case ej.GS_RenderQueueType:this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseRenderQueueAssignment(r,t),i=t.getCurPosition();break;case ej.GS_UsePass:this._addGlobalStatement(r,t,i,a.lexeme.length);var s=t.scanPairedText('"','"');r.passes.push({name:s,isUsePass:!0,renderStates:{constantMap:{},variableMap:{}},tags:{}}),i=t.getCurPosition();break;case ej.GS_Tags:this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseTags(r,t),i=t.getCurPosition();break;case eq.NOT_WORD:if("{"===a.lexeme)n+=1;else if("}"===a.lexeme&&0==(n-=1))return this._addGlobalStatement(r,t,i,a.lexeme.length),this._dropScope(),r;default:if(e._isRenderStateDeclarator(a)){this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseRenderStateDeclarationOrAssignment(r,a,t),i=t.getCurPosition();break}e._isEngineType(a)&&(this._addGlobalStatement(r,t,i,a.lexeme.length),this._parseVariableDeclaration(a.type,t),i=t.getCurPosition())}}},e._parseTags=function(e,t){for(t.scanText("{");;){var r=t.scanToken();t.scanText("=");var n=t.scanPairedText('"','"');if(t.skipCommentsAndSpace(),e.tags[r.lexeme]=n,"}"===t.peek(1)){t._advance();return}t.scanText(",")}},e._parsePass=function(r){this._newScope();var n={globalContents:[],renderStates:{constantMap:{},variableMap:{}},tags:{}};n.name=r.scanPairedText('"','"'),r.scanText("{");var i=1;r.skipCommentsAndSpace();for(var a=r.getCurPosition();;){var o=r.scanToken();switch(o.type){case ej.GS_RenderQueueType:this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseRenderQueueAssignment(n,r),a=r.getCurPosition();break;case ej.GS_Tags:this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseTags(n,r),a=r.getCurPosition();break;case ej.GS_VertexShader:case ej.GS_FragmentShader:this._addGlobalStatement(n,r,a,o.lexeme.length),r.scanText("=");var s=r.scanToken();if(n[o.lexeme]){var c=eZ.createGSError("reassign main entry",e$.CompilationError,r.source,r.getCurPosition());throw t.Logger.error(c.toString()),c}n[o.type===ej.GS_VertexShader?"vertexEntry":"fragmentEntry"]=s.lexeme,r.scanText(";"),a=r.getCurPosition();break;case eq.NOT_WORD:if("{"===o.lexeme)i+=1;else if("}"===o.lexeme&&0==(i-=1))return this._addGlobalStatement(n,r,a,o.lexeme.length),this._dropScope(),n;default:if(e._isRenderStateDeclarator(o)){this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseRenderStateDeclarationOrAssignment(n,o,r),a=r.getCurPosition();break}e._isEngineType(o)&&(this._addGlobalStatement(n,r,a,o.lexeme.length),this._parseVariableDeclaration(o.type,r),a=r.getCurPosition())}}},e}();t2._engineType={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode},t2._errors=[],t2._symbolTableStack=new ta;var t1=/*#__PURE__*/function(){function e(){this.errors=[]}var r=e.prototype;return r._parseShaderPass=function(r,i,a,o,s,c,u){tU.reset(t.ShaderLib,u);for(var l,p=n(o);!(l=p()).done;){var h=l.value;tU.addPredefinedMacro(h.name,h.value)}for(var _=0;_<c.length;_++)tU.addPredefinedMacro(c[_]);var d=performance.now(),f=tU.process(r);if(tB._errors.length>0){for(var g,S=n(tB._errors);!(g=S()).done;){var y=g.value;this.errors.push(y)}this._logErrors();return}t.Logger.info("[pass compilation - preprocessor] cost time "+(performance.now()-d)+"ms");var m=new e5(f).tokenize(),v=e._parser;e._processingPassText=f;for(var E,x=v.parse(m),C=n(v.errors);!(E=C()).done;){var T=E.value;this.errors.push(T)}if(!x){this._logErrors();return}var A=s===t.ShaderPlatformTarget.GLES100?tX.getVisitor():tQ.getVisitor(),O=performance.now(),b=A.visitShaderProgram(x,i,a);t.Logger.info("[CodeGen] cost time: "+(performance.now()-O)+"ms"),e._processingPassText=void 0;for(var I,P=n(A.errors);!(I=P()).done;){var R=I.value;this.errors.push(R)}return this._logErrors(),b},r._parseShaderContent=function(e){eZ.clearAllShaderLabObjectPool(),t2.reset();var t=t2.parse(e);this.errors.length=0;for(var r,i=n(t2._errors);!(r=i()).done;){var a=r.value;this.errors.push(a)}return t},r._logErrors=function(){var e=this.errors;if(0!==e.length&&t.Logger.isEnabled){t.Logger.error(""+e.length+" errors occur!");for(var r,i=n(e);!(r=i()).done;){var a=r.value;t.Logger.error(a.toString())}}},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e,t,r),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();t1._parser=tP.create(),t1._shaderPositionPool=eZ.createObjectPool(eW),t1._shaderRangePool=eZ.createObjectPool(eU);var t3="1.4.0-alpha.3";console.log("Galacean ShaderLab version: "+t3+". mode: Verbose"),e.GSError=eJ,e.GSErrorName=e$,e.Preprocessor=tU,e.ShaderLab=t1,e.version=t3,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
|
+
//# sourceMappingURL=browser.verbose.min.js.map
|