Discussion of future of antlr4ide #186
Comments
For 1) or 3) I am not sure this is much different from what we have now. For 2) I have made some progress on my branch The current version is using an antlr generated grammar to retrieve the tokens. There is no optimization right now so the full grammar is scanned by each keystroke (cough.. cough..). The syntax highlighting and outlineview works, but properties, folding, tool generation has not been implemented. I should warn that the highlighting is setup for effect and will not win any beauty contest. That said, I really like this approach to Eclipse Editor. In fact, this editor is trivially extended to any antlr grammar. |
One thing that is really nice about using an implementation closer to native eclipse API it is relatively easy to enhance the editor with specific content from the grammars. |
In the discussions regarding java vs xtend I am still trying to figuring out what xtend provides over using the Eclipse API directly from Java. Take the AntlrConsole implementation as an illustration. In Java: package org.github.antlr4ide.console;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleFactory;
import org.eclipse.ui.console.IOConsole;
public class AntlrConsoleFactory implements IConsoleFactory {
public final static String ANTLR_CONSOLE = "Antlr Console";
public final static String ANTLR_CONSOLE_IMAGE = "console.png";
@Override
public void openConsole() {
// check if Antlr Console is already added:
IOConsole antlrConsole = getConsole();
ConsolePlugin.getDefault().getConsoleManager().showConsoleView( antlrConsole );
}
public IOConsole getConsole() {
for(IConsole console:ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
if(console.getName().equals(ANTLR_CONSOLE)) { return (IOConsole) console; }
}
// If not found add Antlr Console to list
IOConsole antlrConsole = new IOConsole(ANTLR_CONSOLE, ConsolePlugin.getImageDescriptor(ANTLR_CONSOLE_IMAGE));
ConsolePlugin.getDefault().getConsoleManager().addConsoles( new IConsole[] { antlrConsole } );
return antlrConsole;
}
} Same in xtend: package com.github.jknack.antlr4ide.ui.console
import org.eclipse.ui.console.IConsoleFactory
import org.eclipse.ui.console.IOConsole
import org.eclipse.ui.console.ConsolePlugin
import com.google.inject.Inject
import org.eclipse.xtext.ui.IImageHelper.IImageDescriptorHelper
class AntlrConsoleFactory implements IConsoleFactory {
public static val ANTLR_CONSOLE = "ANTLR Console"
@Inject
static IImageDescriptorHelper imageHelper
override openConsole() {
val manager = ConsolePlugin.^default.consoleManager
manager.showConsoleView(console)
}
def static getConsole() {
val manager = ConsolePlugin.^default.consoleManager
val existing = manager.consoles
for (console : existing) {
if (ANTLR_CONSOLE == console.name)
return console as IOConsole
}
val console = new IOConsole(ANTLR_CONSOLE, imageHelper.getImageDescriptor("console.png"))
manager.addConsoles(#[console])
return console
}
} For this case I am not seeing the benefit of using xtend. |
Yeah, your Java Code is more readable than the Xtend one. Also the Java imports are simple and clear. And you are not locked into a certain framework (except for the Eclipse API, which does not really count here ;-)). |
This is moving forward please join the fun |
I have opened this issue to discuss the future of antlr4ide development. Feel free to provide feedback and comments. Right now there is a lack of development. Antlr4ide has been converted to a community project but still lacks to attract new contributors. Open issues are already open for a while and the code in the master branch would require some major changes (e.g, converting .xtend files to Java classes as described in #162). Also the Xtext framework which is used under the hood is sometimes hard to understand. And I think it is a pitty that a project with ANTLR in its name is not using a "pure" ANTLR grammar for its work. So right now I see three roads to go. I will list them below together with some of their drawbacks that came up to my mind so far:
The text was updated successfully, but these errors were encountered: