|
Re: Trying to generate DSL files using Java [message #1777787 is a reply to message #1777723] |
Mon, 04 December 2017 15:58 |
|
can you please provide a complete hello would example?
Injector injector = new ChartStandaloneSetup().createInjectorAndDoEMFRegistration();
ResourceSet rs = injector.getInstance(ResourceSet.class);
Resource r = rs.createResource(URI.createURI("charts/test2.chart"));
r.getContents().add(myChart);
try {
r.save(null);
} catch (IOException e) {
e.printStackTrace();
}
should have worked (when this is te only thing you do)
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Mon, 04 December 2017 15:59] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Trying to generate DSL files using Java [message #1842081 is a reply to message #1842080] |
Tue, 08 June 2021 17:00 |
|
alternatively you can try to adapt serialization to deal with your very strange grammar
serializer = {
generateStub = true
}
public class MyDslSemanticSequencer extends AbstractMyDslSemanticSequencer {
@Inject MyDslGrammarAccess grammarAcess;
@Override
protected void sequence_Cstic(ISerializationContext context, Cstic semanticObject) {
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAcess.getCsticAccess().getNameIDTerminalRuleCall_1_0(), semanticObject.getName());
if (semanticObject.getDesc() != null) {
feeder.accept(grammarAcess.getCsticAccess().getDescNameKeyword_3_0_0(), semanticObject.getDesc());
feeder.accept(grammarAcess.getCsticAccess().getNameSTRINGTerminalRuleCall_3_1_0(), semanticObject.getName());
}
feeder.finish();
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04796 seconds