Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ignoreCase for Serializer 2.0
ignoreCase for Serializer 2.0 [message #1066170] Mon, 01 July 2013 11:11
Jens Kuenzer is currently offline Jens KuenzerFriend
Messages: 29
Registered: October 2009
Junior Member
Hi,

I think I found a solution to use serializer 2.0 for case insensitive language
But I am not sure if this is the correct way to go as the class is marked as restricted.

The backtracking semantic serializer refuses to use the correct grammar because the keyword does not match case. This can be fixed by replaceing the KeywordSerializer by a case insensitive one:

public class IgnoreCaseKeywordSerializer extends KeywordSerializer {

    @Override
    public boolean isValid(EObject context, Keyword keyword, Object value, Acceptor errorAcceptor) {
        return keyword.getValue().equalsIgnoreCase((String)value);
    }
    
}

and add this to the languages RuntimeModule:
    public Class<? extends org.eclipse.xtext.serializer.tokens.IKeywordSerializer> bindIKeywordSerializer() {
        return com.ibm.vlsi.xtext.serializer.IgnoreCaseKeywordSerializer.class;
    }

Previous Topic:Resource 'xxx' does not exist
Next Topic:restriction/clear of index
Goto Forum:
  


Current Time: Fri Apr 26 16:22:12 GMT 2024

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

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

Back to the top