mismatched input '<EOF>' expecting 'configuration error type [message #1792956] |
Thu, 26 July 2018 13:40 |
Parsa Pourali Messages: 210 Registered: February 2014 |
Senior Member |
|
|
Hi,
I tried the code that is shown below to create an xtext resource/file. It seems to work fine but it shows an error when I close the eclipse runtime instance and rerun it. The error is "mismatched input '<EOF>' expecting 'configuration:'".
The file is correct by syntax and with a little bit of research I found that it is an encoding problem. Current encoding of the file is Cp1252. When I right click on the xtext file and change the encoding to whatever else (through the properties dialog box), the error goes away no matter what type of encoding I choose. So, do you also think that the error is for encoding??? or do you have any suggestion to refine the code below to force it create a well-encoded xtext file and avoid the error?
private static Resource createandSaveResource(String metadataPath) {
ResourceSet rs = new ResourceSetImpl();
Resource resource = rs.createResource(URI.createFileURI(metadataPath));
Metadata model = MetadataDSLFactory.eINSTANCE.createMetadata();
Configuration config = MetadataDSLFactory.eINSTANCE.createConfiguration();
model.setConfig(config);
resource.getContents().add(model);
try {
resource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return resource;
}
Thanks a lot,
Best,
Parsa
[Updated on: Thu, 26 July 2018 13:45] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 2.60577 seconds