Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Serializing & case-insensitive languages (java.lang.RuntimeException: Could not serialize EObjec
Serializing & case-insensitive languages (java.lang.RuntimeException: Could not serialize EObjec [message #1730502] Tue, 26 April 2016 12:02 Go to next message
Gerd  Wütherich is currently offline Gerd WütherichFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

currently I'm developing a xtext based cypher (neo4j) editor (xtext version 2.9.2). Fortunately I was able to solve nearly all issues I run into (google is my friend), but now I have to deal with an issue where I'm a bit lost...

The problem is that formatting several cypher queries throws exceptions like the following one (I use formatter2):

java.lang.RuntimeException: Could not serialize EObject via backtracking.
	Constraint: Expression1_Expression3_ExpressionNodeLabelsAndPropertyLookup_BoolConstant returns BoolConstant: ((value='TRUE' | value='FALSE') nodeLabelList+=NodeLabel* expression3Parts+=Expression3Part*);
	Values: value(1)
	Semantic Object: Cypher.statement->SingleQuery.clauses[0]->Match.pattern->Pattern.patterns[0]->PatternElement.nodepattern->NodePattern.properties->MapLiteral.entries[0]->MapLiteralEntry.value->BoolConstant
	URI: __synthetic0.cypher
	Context: Expression returns BoolConstant
		at org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic$ExceptionThrowingAcceptor.accept(ISerializationDiagnostic.java:131)
		at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:480)
		at de.gerdwuetherich.opencypher.serializer.OpenCypherSemanticSequencer.sequence_Expression1_Expression3_ExpressionNodeLabelsAndPropertyLookup(OpenCypherSemanticSequencer.java:1699)
		at de.gerdwuetherich.opencypher.serializer.OpenCypherSemanticSequencer.sequence(OpenCypherSemanticSequencer.java:281)


After some investigation I found out that it might has to do with the "case-insensitiveness". As keywords in cypher are case-insensitive, I set the parserGenerator options to 'ignoreCase = true' (which works perfectly fine).

However, if i parse and format a cypher query like
MATCH (a{abstract=TRUE} RETURN a;
(BoolConstant is 'TRUE'), everything works fine.

When I change the query to
MATCH (a{abstract=true} RETURN a;
(BoolConstant is 'true'), the exception above occurs.

Do I miss something? Do I have to specify the case-insensitive property for other generators as well? Currently I have no idea how to get rid of the exception...

kind regards
Gerd
Re: Serializing & case-insensitive languages (java.lang.RuntimeException: Could not serialize EO [message #1730507 is a reply to message #1730502] Tue, 26 April 2016 12:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
can you please file a bug for that.

you may fix org.eclipse.xtext.serializer.tokens.KeywordSerializer.isValid(EObject, Keyword, Object, Acceptor) yourself as workaround


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Serializing & case-insensitive languages (java.lang.RuntimeException: Could not serialize EO [message #1730536 is a reply to message #1730507] Tue, 26 April 2016 14:34 Go to previous message
Gerd  Wütherich is currently offline Gerd WütherichFriend
Messages: 12
Registered: July 2009
Junior Member
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=492456

Thank you for the fast reply, the workaround and your fantastic work in general!
Previous Topic:CDT-like Hovers
Next Topic:Altering/Restricting Xtext DSL Entry and Exit Rule
Goto Forum:
  


Current Time: Thu Apr 25 15:54:14 GMT 2024

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

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

Back to the top