Created
March 14, 2016 21:05
-
-
Save kthoms/0933c3720ab9725b84c4 to your computer and use it in GitHub Desktop.
A custom implementation of org.eclipse.xtext.xbase.scoping.featurecalls.OperatorMapping that adds alternative to keywords '&&' and '||'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.eclipse.xtext.example.domainmodel; | |
import static org.eclipse.xtext.naming.QualifiedName.*; | |
import javax.inject.Singleton; | |
import org.eclipse.xtext.naming.QualifiedName; | |
import org.eclipse.xtext.xbase.scoping.featurecalls.OperatorMapping; | |
@Singleton | |
public class OperatorMappingCustom extends OperatorMapping { | |
public static final QualifiedName AND_2 = create("AND"); | |
public static final QualifiedName OR_2 = create("OR"); | |
@Override | |
public QualifiedName getMethodName(QualifiedName operator) { | |
if (AND_2.equals(operator)) { | |
return getMethodName(AND); | |
} | |
if (OR_2.equals(operator)) { | |
return getMethodName(OR); | |
} | |
return super.getMethodName(operator); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment