UnsupportedOperationException when applying filters
I found a grammar and sentence that cause this exception when applying filters in Spoofax r23058:
org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:182)
at org.strategoxt.imp.runtime.parser.AbstractSGLRI.parse(AbstractSGLRI.java:106)
at org.strategoxt.imp.runtime.parser.SGLRParseController.doParse(SGLRParseController.java:352)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:287)
at org.strategoxt.imp.runtime.parser.SGLRParseController.parse(SGLRParseController.java:1)
at org.strategoxt.imp.runtime.dynamicloading.DynamicParseController.parse(DynamicParseController.java:168)
at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:86)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.spoofax.jsglr.client.FilterException: Runtime exception when applying filters
at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:244)
at org.spoofax.jsglr.client.SGLR.sglrParse(SGLR.java:318)
at org.spoofax.jsglr.client.SGLR.parse(SGLR.java:265)
at org.strategoxt.imp.runtime.parser.JSGLRI.doParse(JSGLRI.java:163)
… 7 more
Caused by: java.lang.UnsupportedOperationException
at org.spoofax.jsglr.client.ParseNode.getLabel(ParseNode.java:38)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:444)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.filterAmbiguities(Disambiguator.java:825)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:417)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.filterAmbiguities(Disambiguator.java:825)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:424)
at org.spoofax.jsglr.client.Disambiguator.filterAmbiguities(Disambiguator.java:825)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:424)
at org.spoofax.jsglr.client.Disambiguator.filterAmbiguities(Disambiguator.java:825)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:417)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:479)
at org.spoofax.jsglr.client.Disambiguator.filterTree(Disambiguator.java:432)
at org.spoofax.jsglr.client.Disambiguator.applyFilters(Disambiguator.java:238)
… 10 moreGrammar (add EntityLang layout definition):
context-free start-symbols
Startcontext-free syntax
String+ -> Start {cons(“Strings”)}
STRING -> String {cons(“String”)}lexical syntax
%% Lua comment/string syntax [=^n[ … ]=^n]
[=] -> EQ
[[] -> OPEN
[]] -> CLOSEOPEN ~[]* CLOSE -> BODY EQ BODY EQ -> BODY OPEN BODY CLOSE -> STRING %% Now we just need to reject [=^n[ ... ]=^n] ... ]=^m] %% (i.e. to get shortest match) STRING ~[]* CLOSE EQ* CLOSE -> STRING {reject}
Input sentence:
[=[ ]=]
[=[ ]=]
[=[ ]=]
[=[ ]=]With less than four STRINGs it works fine, but with four or more it throws this exception.
Maybe this isn’t intended to work at all though since this seems like pushing the boundaries of the reject construct :-)
Submitted by Tobi Vollebregt on 16 June 2011 at 22:09
Issue Log
Log in to post comments