Class GlslParser
java.lang.Object
io.github.ocelot.glslprocessor.api.GlslParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GlslTreeParses the specified input code into a GLSL tree.static GlslNodeparseExpression(GlslLexer.Token... tokens) Parses the specified token array as a single GLSL expression.static GlslNodeparseExpression(String input) Parses the specified input code as a single GLSL expression.parseExpressionList(GlslLexer.Token[] tokens) Parses the specified token array as multiple GLSL expressions.parseExpressionList(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.
-
Constructor Details
-
GlslParser
public GlslParser()
-
-
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
Parses 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
public static List<GlslNode> parseExpressionList(GlslLexer.Token[] tokens) throws GlslSyntaxException Parses 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
-