groovy-eclipse icon indicating copy to clipboard operation
groovy-eclipse copied to clipboard

Implement error recovery for antlr4-based Parrot Parser

Open eric-milles opened this issue 5 years ago • 4 comments
trafficstars

eric-milles avatar Dec 30 '19 01:12 eric-milles

Now that Groovy 4 is GA and has dropped antlr2 support this needs to be completed sooner rather than later.

Spitfire1900 avatar Mar 05 '22 19:03 Spitfire1900

@Spitfire1900 This project still provides the antlr2 parser for Groovy 4. You may also use the antlr4 parser, it's just not enabled by default. If you have antlr4 knowledge that would help move this ticket along, I'm ready and available to review design proposals.

eric-milles avatar Mar 06 '22 16:03 eric-milles

My users also like to use new language features like Java-style Lambda syntax, but without error recovery, the use of the editor is very problematic for my users.

efc-mw avatar May 23 '22 13:05 efc-mw

For those whom are on Groovy 3 and want to disable the parrot parser in builds this is how you can implement it in Gradle.

build.gradle

tasks.withType(GroovyCompile) {
    groovyOptions.configurationScript = file("$projectDir/antlr2.groovy")
}

antlr2.groovy

import static org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder.*
import static org.codehaus.groovy.control.ParserPluginFactory.antlr2

import org.codehaus.groovy.control.CompilerConfiguration

withConfig (configuration) { 
	(configuration as CompilerConfiguration).pluginFactory = antlr2()
}

Spitfire1900 avatar Jun 09 '23 12:06 Spitfire1900