Package org.codehaus.groovy.control

# Interface ParserPlugin

All Known Implementing Classes:
  `Antlr4ParserPlugin`

public interface ParserPlugin
A simple extension point to allow us to switch between the classic Groovy parser and the new Antlr based parser(s).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ModuleNode`
  `buildAST(CharSequence sourceText, CompilerConfiguration config, GroovyClassLoader loader, ErrorCollector errors)`
  Parses and converts the supplied source text into a module AST.
  `ModuleNode`
  `buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst)`
  Builds the AST from a previously parsed CST.
  `Reduction`
  `parseCST(SourceUnit sourceUnit, Reader reader)`
  Parses source text into a concrete syntax tree.

- ## Method Details

  - ### parseCST

    Reduction parseCST(SourceUnit sourceUnit, Reader reader) throws CompilationFailedException
    Parses source text into a concrete syntax tree.
    Parameters:
      `sourceUnit` - the source being parsed
      `reader` - the source reader
    Returns:
      the parsed CST
    Throws:
      `CompilationFailedException` - if parsing fails

  - ### buildAST

    ModuleNode buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst) throws ParserException
    Builds the AST from a previously parsed CST.
    Parameters:
      `sourceUnit` - the source being compiled
      `classLoader` - the class loader to use during AST creation
      `cst` - the parsed CST
    Returns:
      the resulting module node
    Throws:
      `ParserException` - if AST construction fails

  - ### buildAST

    static ModuleNode buildAST(CharSequence sourceText, CompilerConfiguration config, GroovyClassLoader loader, ErrorCollector errors) throws CompilationFailedException
    Parses and converts the supplied source text into a module AST.
    Parameters:
      `sourceText` - the source text to compile
      `config` - the compiler configuration to use
      `loader` - the class loader used during compilation
      `errors` - the collector that receives compilation errors
    Returns:
      the compiled module AST
    Throws:
      `CompilationFailedException` - if parsing or conversion fails