@Test public void testShaderKinds() throws Exception { final File frag = temporaryFolder.newFile("a.frag"); final File vert = temporaryFolder.newFile("a.vert"); final File comp = temporaryFolder.newFile("a.comp"); final String emptyShader = "#version 320 es\nvoid main() { }\n"; FileUtils.writeStringToFile(frag, emptyShader, StandardCharsets.UTF_8); FileUtils.writeStringToFile(vert, emptyShader, StandardCharsets.UTF_8); FileUtils.writeStringToFile(comp, emptyShader, StandardCharsets.UTF_8); final TranslationUnit fragTu = ParseHelper.parse(frag); final TranslationUnit vertTu = ParseHelper.parse(vert); final TranslationUnit compTu = ParseHelper.parse(comp); assertEquals(ShaderKind.FRAGMENT, fragTu.getShaderKind()); assertEquals(ShaderKind.VERTEX, vertTu.getShaderKind()); assertEquals(ShaderKind.COMPUTE, compTu.getShaderKind()); }
public ShaderKind getShaderKind() { return shaderKind; }
TranslationUnit implements IAstNode { public ShaderKind getShaderKind() { return shaderKind; } }
TranslationUnit implements IAstNode { public ShaderKind getShaderKind() { return shaderKind; } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); }
TranslationUnit implements IAstNode { public ShaderKind getShaderKind() { return shaderKind; } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); boolean hasMainFunction(); FunctionDefinition getMainFunction(); ShaderKind getShaderKind(); void setShaderKind(ShaderKind shaderKind); List<Declaration> getTopLevelDeclarations(); boolean hasShadingLanguageVersion(); ShadingLanguageVersion getShadingLanguageVersion(); void setShadingLanguageVersion(ShadingLanguageVersion shadingLanguageVersion); void setTopLevelDeclarations(List<Declaration> topLevelDeclarations); @Override void accept(IAstVisitor visitor); void addDeclaration(Declaration decl); void addDeclarationBefore(Declaration newDecl, Declaration existingDecl); void updateTopLevelDeclaration(Declaration newDecl, Declaration existingDecl); void removeTopLevelDeclaration(int index); void removeTopLevelDeclaration(Declaration declaration); @Override TranslationUnit clone(); List<VariableDeclInfo> getGlobalVarDeclInfos(); List<VariablesDeclaration> getGlobalVariablesDeclarations(); List<VariablesDeclaration> getUniformDecls(); VariablesDeclaration getUniformDeclaration(String name); boolean hasUniformDeclaration(String name); List<StructDefinitionType> getStructDefinitions(); StructDefinitionType getStructDefinition(StructNameType type); }
TranslationUnit implements IAstNode { public ShaderKind getShaderKind() { return shaderKind; } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); boolean hasMainFunction(); FunctionDefinition getMainFunction(); ShaderKind getShaderKind(); void setShaderKind(ShaderKind shaderKind); List<Declaration> getTopLevelDeclarations(); boolean hasShadingLanguageVersion(); ShadingLanguageVersion getShadingLanguageVersion(); void setShadingLanguageVersion(ShadingLanguageVersion shadingLanguageVersion); void setTopLevelDeclarations(List<Declaration> topLevelDeclarations); @Override void accept(IAstVisitor visitor); void addDeclaration(Declaration decl); void addDeclarationBefore(Declaration newDecl, Declaration existingDecl); void updateTopLevelDeclaration(Declaration newDecl, Declaration existingDecl); void removeTopLevelDeclaration(int index); void removeTopLevelDeclaration(Declaration declaration); @Override TranslationUnit clone(); List<VariableDeclInfo> getGlobalVarDeclInfos(); List<VariablesDeclaration> getGlobalVariablesDeclarations(); List<VariablesDeclaration> getUniformDecls(); VariablesDeclaration getUniformDeclaration(String name); boolean hasUniformDeclaration(String name); List<StructDefinitionType> getStructDefinitions(); StructDefinitionType getStructDefinition(StructNameType type);  }