ParseFacet added for project without parse table, leads to exception when build()ing
Starting with the Spoofax Core 2.1.0-SNAPSHOT around 2016-09-20 (+/- a day), executing this Java code to load the Green-Marl frontend and backend language components:
Collection<ILanguageComponent> greenMarlComponents = new ArrayList<>(); FileObject frontendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/"); FileObject backendLocation = spoofax.resourceService.resolve("zip:" + backendLocationString + "!/"); Iterable<ILanguageDiscoveryRequest> requests = spoofax.languageDiscoveryService.request(frontendLocation); spoofax.languageDiscoveryService.discover(requests).forEach(greenMarlComponents::add); requests = spoofax.languageDiscoveryService.request(backendLocation); spoofax.languageDiscoveryService.discover(requests).forEach(greenMarlComponents::add);
ParseFacets. One for the frontend (which is fine and expected) and one for the backend (which is not expected, since the project’s ESV files don’t declare any parse table). With Spoofax Core 2.0.0, only a
ParseFacetfor the frontend is created.
ParseFacets later leads to an exception when calling
spoofax.builder.build(input, new NullProgressReporter(), new CancellationToken());
Exception in thread "main" org.metaborg.core.MetaborgRuntimeException: Multiple facets of type class org.metaborg.core.syntax.ParseFacet found, while only a single facet is supported at org.metaborg.core.language.LanguageImplementation.facet(LanguageImplementation.java:103) at org.metaborg.core.syntax.SyntaxService.parser(SyntaxService.java:49) at org.metaborg.core.syntax.SyntaxService.parse(SyntaxService.java:31) at org.metaborg.core.build.Builder.parse(Builder.java:311) at org.metaborg.core.build.Builder.updateLanguageResources(Builder.java:222) at org.metaborg.core.build.Builder.build(Builder.java:188) ...
My current workaround is to depend on Spoofax Core 2.0.0.Submitted by Daniel Lehmann on 26 September 2016 at 18:51
These two lines have the same RHS:
FileObject frontendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/"); FileObject backendLocation = spoofax.resourceService.resolve("zip:" + frontendLocationString + "!/");
Is this intentional?
Sorry, this was a typo when editing this issue. My failing code has different RHS. (Edited the issue here to reflect that).
Please try updating Spoofax and adding to the yaml file of the backend:
language: sdf: enabled: false
That should disable generating the SyntaxFacet, the ParseFacet, and the parse table altogether for that project.
Thanks Eduardo, with your addition to the metaborg.yaml file Spoofax Core 2.1.0-SNAPSHOT no longer adds a ParseFacet for the backend.
To better understand the issue: Was the behavior of Spoofax Core correct before (i.e. not creating a SyntaxFacet or ParseFacet) or is it now (and am I now always expected to disable SDF in the metaborg.yaml, when I don’t want the ParseFacet)?
We changed the behaviour in nightly. You have to explicitly disable SDF to not get those facets.
Log in to post comments