Class GlslParser

java.lang.Object
io.github.ocelot.glslprocessor.api.GlslParser

public final class GlslParser extends Object
  • Constructor Details

    • GlslParser

      public GlslParser()
  • Method Details

    • preprocessParse

      public static GlslTree preprocessParse(String input, Map<String,String> macros) throws GlslSyntaxException, LexerException
      Runs the C preprocessor on the specified source before passing it off to the parser.
      Parameters:
      input - The source code input
      macros - 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 code
      LexerException - If there is any issue pre-processing the code
    • parse

      public static GlslTree parse(String input) throws GlslSyntaxException
      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

      public static GlslNode parseExpression(String input) throws GlslSyntaxException
      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

      public static GlslNode parseExpression(GlslLexer.Token... tokens) throws GlslSyntaxException
      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

      public static List<GlslNode> parseExpressionList(String input) throws GlslSyntaxException
      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