Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:40 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 197
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

Re: mismatched input '<EOF>' expecting 'configuration error type [message #1792959 is a reply to message #1792956] Thu, 26 July 2018 13:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
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?


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: mismatched input '<EOF>' expecting 'configuration error type [message #1793006 is a reply to message #1792959] Fri, 27 July 2018 12:26 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 197
Registered: February 2014
Senior Member
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 13:00 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12388
Registered: July 2009
Senior Member
no i dont any.

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: Sat Nov 17 07:27:45 GMT 2018

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

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

Back to the top