@Test public void testQualifiers() throws Exception { final String prog = "in vec3 blah; out vec3 bloo; void foo(in float x, out float y);"; final TranslationUnit tu = ParseHelper.parse(prog); assertEquals(3, tu.getTopLevelDeclarations().size()); { final Declaration decl = tu.getTopLevelDeclarations().get(0); final VariablesDeclaration variablesDeclaration = (VariablesDeclaration) decl; assertTrue(variablesDeclaration.getBaseType().hasQualifier(TypeQualifier.SHADER_INPUT)); assertFalse(variablesDeclaration.getBaseType().hasQualifier(TypeQualifier.IN_PARAM)); } { final Declaration decl = tu.getTopLevelDeclarations().get(1); final VariablesDeclaration variablesDeclaration = (VariablesDeclaration) decl; assertTrue(variablesDeclaration.getBaseType().hasQualifier(TypeQualifier.SHADER_OUTPUT)); assertFalse(variablesDeclaration.getBaseType().hasQualifier(TypeQualifier.OUT_PARAM)); } { final Declaration decl = tu.getTopLevelDeclarations().get(2); FunctionPrototype proto = (FunctionPrototype) decl; assertTrue(proto.getParameters().get(0).getType().hasQualifier(TypeQualifier.IN_PARAM)); assertFalse(proto.getParameters().get(0).getType().hasQualifier(TypeQualifier.SHADER_INPUT)); assertTrue(proto.getParameters().get(1).getType().hasQualifier(TypeQualifier.OUT_PARAM)); assertFalse(proto.getParameters().get(1).getType().hasQualifier(TypeQualifier.SHADER_OUTPUT)); } }
public static synchronized TranslationUnit parse(File file) throws IOException, ParseTimeoutException, InterruptedException, GlslParserException { return parseInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(file)), ShaderKind.fromExtension(FilenameUtils.getExtension(file.getName()))); }
ParseHelper { public static synchronized TranslationUnit parse(File file) throws IOException, ParseTimeoutException, InterruptedException, GlslParserException { return parseInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(file)), ShaderKind.fromExtension(FilenameUtils.getExtension(file.getName()))); } }
ParseHelper { public static synchronized TranslationUnit parse(File file) throws IOException, ParseTimeoutException, InterruptedException, GlslParserException { return parseInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(file)), ShaderKind.fromExtension(FilenameUtils.getExtension(file.getName()))); }  }
ParseHelper { public static synchronized TranslationUnit parse(File file) throws IOException, ParseTimeoutException, InterruptedException, GlslParserException { return parseInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(file)), ShaderKind.fromExtension(FilenameUtils.getExtension(file.getName()))); }  static Optional<TranslationUnit> maybeParseShader(File shader); static synchronized TranslationUnit parse(File file); static synchronized TranslationUnit parse(String string, ShaderKind shaderKind); static synchronized TranslationUnit parse(String string); }
ParseHelper { public static synchronized TranslationUnit parse(File file) throws IOException, ParseTimeoutException, InterruptedException, GlslParserException { return parseInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(file)), ShaderKind.fromExtension(FilenameUtils.getExtension(file.getName()))); }  static Optional<TranslationUnit> maybeParseShader(File shader); static synchronized TranslationUnit parse(File file); static synchronized TranslationUnit parse(String string, ShaderKind shaderKind); static synchronized TranslationUnit parse(String string); static final String END_OF_GRAPHICSFUZZ_DEFINES; }