antlr / antlrworks Goto Github PK
View Code? Open in Web Editor NEWAntlrWorks tool for ANTLR
Home Page: http://www.antlr.org/works
AntlrWorks tool for ANTLR
Home Page: http://www.antlr.org/works
I have a simple grammar (cf. https://gist.github.com/4499299)
If I compile it manually with antlr-3.5-complete.jar and set up a manual test rig, everything works as expected.
However, if I use ANTLRworks 1.5, I check the grammar.. OK, I generate code.. OK I click on debug and it starts compiling and complains abour errors in the parser (cf. gist above).
I just downloaded antlworks 1.5.1 from http://www.antlr3.org/download/antlrworks-1.5.jar and tried to generate my grammar file. The good point of this version (compared to 1.5rc1), it generates the correct return type (as defined in the option ASTLabelType) for all sub-classes of ParserRuleReturnScope.
However, it generates an incomplete throws clause for the corresponding methods. The output in the console states:
[22:22:17] warning(24): template error: context [/outputFile /parser /genericParser /region__/genericParser__members /region__/genericParser__members /_sub488] 8:27 no such property or can't access: null.hasSynPred
As an example of such a wrong method signature:
public final TSPHPParser.compilationUnit_return compilationUnit() throws {
I could easily create a work around for this problem by adding the latest classes from the antlr-3.5.1-complete.jar to the antlrworks-1.5.jar
I suppose some classes are missing. I had a look into the src but couldn't really get along. Seems like the project is moving from ant to maven or something. Send me an email with some guiding and I would be glad to contribute to the project.
I'm using ANTLRWorks to test a grammar I came up with and one of the rules foresees usage of BULLET symbol โข, but when parse tree is being built it escapes it every time. I also tried other chars from extended ASCII table and they are omitted as well. It looks like ANTLRWorks issue.
Please see this thread for more details:
http://stackoverflow.com/questions/17073851/antlr3-does-not-match-extended-ascii-characters
This issue prevents GitHub from automatic closing the 1.x milestone
The same issue as:
antlr/antlr3#151
Please fix it
com.intellij.openapi.fileEditor.FileDocumentManager.addFileDocumentManagerListener(Lcom/intellij/openapi/fileEditor/FileDocumentManagerListener;)V
java.lang.NoSuchMethodError: com.intellij.openapi.fileEditor.FileDocumentManager.addFileDocumentManagerListener(Lcom/intellij/openapi/fileEditor/FileDocumentManagerListener;)V
at org.antlr.works.plugin.intellij.PIEditor.register(PIEditor.java:155)
at org.antlr.works.plugin.intellij.PIEditor.<init>(PIEditor.java:104)
at org.antlr.works.plugin.intellij.PIEditorProvider.createEditor(PIEditorProvider.java:49)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:860)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:653)
at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:666)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:959)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl3(FileEditorManagerImpl.java:786)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.a(FileEditorManagerImpl.java:768)
at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:149)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:768)
at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:699)
at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:155)
at com.intellij.codeInsight.navigation.NavigationUtil.a(NavigationUtil.java:213)
at com.intellij.codeInsight.navigation.NavigationUtil.openFileWithPsiElement(NavigationUtil.java:189)
at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:239)
at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:249)
at com.intellij.ide.projectView.impl.nodes.PsiFileNode.navigate(PsiFileNode.java:133)
at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:53)
at com.intellij.util.OpenSourceUtil.openSourcesFrom(OpenSourceUtil.java:31)
at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.processDoubleClick(EditSourceOnDoubleClickHandler.java:128)
at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.onDoubleClick(EditSourceOnDoubleClickHandler.java:120)
at com.intellij.ui.DoubleClickListener.onClick(DoubleClickListener.java:30)
at com.intellij.ui.ClickListener$1.mouseReleased(ClickListener.java:73)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6541)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:423)
at com.intellij.ide.dnd.aware.DnDAwareTree.processMouseEvent(DnDAwareTree.java:58)
at java.awt.Component.processEvent(Component.java:6306)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4897)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.j(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
this is how my simple grammar looks copied in text editor:
grammar TestExpr;
options {
output=AST;
ASTLabelType=CommonTree;
}
expr
: andExpr (('OR'|'|') andExpr)* EOF;
andExpr : notExpr(('AND'|','|'+') notExpr)*;
notExpr : ('NOT'|'-')? kpp;
kpp : keyword|phrase|proximity|'(' expr ')';
keyword
: CHAR;
phrase
: '"' keyword (PHRASE_SEPARATOR keyword)* '"';
proximity
: phrase '~' INT;
CHAR : ('A'..'Z') | ('a'..'z')+;
INT : '0'..'9'+;
NEWLINE : '\r'? '\n';
PHRASE_SEPARATOR : '\u2022';
WS : (' '|'\t'|'\n'|'\r')+ {skip();};
An issue that I think is present also in versions before 1.5 is:
Usually if you made any changes to the grammar or if the Lexer/Parser classes or __Test___input file are missing, ANTLRworks would regenerate and recompile them when asked to Debug...
However sometimes it does not. E.g. if you delete classes, it still will assume they are there and run into timeout when trying to debug.
Also the test input seems to be stored by ANTLRworks internally because it suggests the previous test input even if you delete the __Test___input file.
Once you run into this behaviour you have to shut down ANTLRworks and restart it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.