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 TypeMethodDescriptionstatic ModuleNodebuildAST(CharSequence sourceText, CompilerConfiguration config, GroovyClassLoader loader, ErrorCollector errors) Parses and converts the supplied source text into a module AST.buildAST(SourceUnit sourceUnit, ClassLoader classLoader, Reduction cst) Builds the AST from a previously parsed CST.parseCST(SourceUnit sourceUnit, Reader reader) Parses source text into a concrete syntax tree.
-
Method Details
-
parseCST
Parses source text into a concrete syntax tree.- Parameters:
sourceUnit- the source being parsedreader- 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 compiledclassLoader- the class loader to use during AST creationcst- 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 compileconfig- the compiler configuration to useloader- the class loader used during compilationerrors- the collector that receives compilation errors- Returns:
- the compiled module AST
- Throws:
CompilationFailedException- if parsing or conversion fails
-