Class GlslParser
java.lang.Object
io.github.ocelot.glslprocessor.api.GlslParser
Parses GLSL source code strings into a mutable AST.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic GlslTreeParses the specified input code into a GLSL tree.static GlslNodeparseExpression(GlslLexer.Token... tokens) Deprecated, for removal: This API element is subject to removal in a future version.static GlslNodeparseExpression(String input) Parses the specified input code as a single GLSL expression.parseExpressionList(GlslLexer.Token[] tokens) Deprecated, for removal: This API element is subject to removal in a future version.UseparseExpressionList(String)insteadparseExpressionList(String input) Parses the specified input code as multiple GLSL expressions.static GlslTreepreprocessParse(String input, Map<String, String> macros) Runs the C preprocessor on the specified source before passing it off to the parser.
-
Method Details
-
preprocessParse
public static GlslTree preprocessParse(String input, Map<String, String> macros) throws GlslSyntaxException, LexerExceptionRuns the C preprocessor on the specified source before passing it off to the parser.- Parameters:
input- The source code inputmacros- All macros to evaluate during pre-processing- Returns:
- A new tree of all nodes
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source codeLexerException- If there is any issue pre-processing the code
-
parse
Parses the specified input code into a GLSL tree.- Parameters:
input- The GLSL source input- Returns:
- A new tree of all nodes
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source code
-
parseExpression
Parses the specified input code as a single GLSL expression.- Parameters:
input- The GLSL source input- Returns:
- A single node
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source code
-
parseExpression
@ScheduledForRemoval(inVersion="2.0.0") @Deprecated(since="0.2.0", forRemoval=true) public static GlslNode parseExpression(GlslLexer.Token... tokens) throws GlslSyntaxException Deprecated, for removal: This API element is subject to removal in a future version.UseparseExpression(String)insteadParses the specified token array as a single GLSL expression.- Parameters:
tokens- The tokens to parse- Returns:
- A single node
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source code
-
parseExpressionList
Parses the specified input code as multiple GLSL expressions. This only supports multiple statements in a list.- Parameters:
input- The GLSL source input- Returns:
- A single node
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source code
-
parseExpressionList
@ScheduledForRemoval(inVersion="2.0.0") @Deprecated(since="0.2.0", forRemoval=true) public static List<GlslNode> parseExpressionList(GlslLexer.Token[] tokens) throws GlslSyntaxException Deprecated, for removal: This API element is subject to removal in a future version.UseparseExpressionList(String)insteadParses the specified token array as multiple GLSL expressions. This only supports multiple statements in a list.- Parameters:
tokens- The tokens to parse- Returns:
- A single node
- Throws:
GlslSyntaxException- If there is a syntax error in the GLSL source code
-
parseExpression(String)instead