[antlr-interest] Antlr Error Message

Behdad Forghani behdad.forghani at samsarasol.com
Thu Mar 19 11:50:15 PDT 2009


I fixed the problem. I was making to alternatives as the root of the
tree. I think one of the sides had more than one node. The problem was
in the rule:
type:
(^builtinType | ^referencedType) constraint?;
I rewrote it as:
type:
(builtinType | referencedType) constraint?->^(TYPE ^(BUILTIN_TYPE
builtinType) ^(REFERENCED_TYPE referencedType) constraint?);

Since I am going to do the first pass with Antlr, I do not mind the
extra tokens.


On Thu, 2009-03-19 at 14:00 -0400, Behdad Forghani wrote:
> Hello,
> 
> Has anybody seen this error before?
> Exception in thread "main" java.lang.RuntimeException: more than one
> node as root (TODO: make exception hierarchy)
> 	at
> org.antlr.runtime.tree.BaseTreeAdaptor.becomeRoot(BaseTreeAdaptor.java:150)
> 
> The first rule of the grammar is:
> moduleDefinitions :
> 	moduleDefinition+;
> 
> So, I do not think I have more than one root node.
> 
> In AntlrWorks I get a different error:
>  javax.swing.text.BadLocationException: Position not represented by view
> 	at javax.swing.text.CompositeView.modelToView(CompositeView.java:258)
> 	at javax.swing.text.BoxView.modelToView(BoxView.java:467)
> 	at javax.swing.plaf.basic.BasicTextUI
> $RootView.modelToView(BasicTextUI.java:1497)
> 	at
> javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1035)
> 	at
> javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1010)
> 	at
> javax.swing.text.JTextComponent.modelToView(JTextComponent.java:1400)
> 	at org.antlr.works.debugger.input.DBInputProcessorToken$1.run(Unknown
> Source)
> 	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
> 	at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> 	at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
> 	at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> 	at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> 
> 
> Thanks
> 



More information about the antlr-interest mailing list