Skip to main content



      Home
Home » Modeling » TMF (Xtext) » mismatched input '<EOF>' expecting 'configuration error type
mismatched input '<EOF>' expecting 'configuration error type [message #1792956] Thu, 26 July 2018 09:40 Go to next message
Eclipse UserFriend
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 09:45] by Moderator

Re: mismatched input '<EOF>' expecting 'configuration error type [message #1792959 is a reply to message #1792956] Thu, 26 July 2018 09:49 Go to previous messageGo to next message
Eclipse UserFriend
for me this sounds more like a utf-8/bom problem
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390308

=> did you debug whats actually in the beginning of the file? can you reproduce this with the greeting example?
Re: mismatched input '<EOF>' expecting 'configuration error type [message #1793006 is a reply to message #1792959] Fri, 27 July 2018 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

You're right. Is there any solution or workaround to it?

Thanks,
Parsa
Re: mismatched input '<EOF>' expecting 'configuration error type [message #1793010 is a reply to message #1793006] Fri, 27 July 2018 09:00 Go to previous message
Eclipse UserFriend
no i dont any.
Previous Topic:Content Assist not triggered by CTRL+SPACE inside the Orion web editor
Next Topic:Active Annotations: Import type references made in template strings defined in method
Goto Forum:
  


Current Time: Mon Jun 16 10:01:25 EDT 2025

Powered by FUDForum. Page generated in 0.09025 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top