use of org.eclipse.xtend.core.xtend.RichStringIf in project xtext-xtend by eclipse.
the class IfConditionStartImpl method setRichStringIf.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRichStringIf(RichStringIf newRichStringIf) {
RichStringIf oldRichStringIf = richStringIf;
richStringIf = newRichStringIf;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProcessedRichStringPackage.IF_CONDITION_START__RICH_STRING_IF, oldRichStringIf, richStringIf));
}
use of org.eclipse.xtend.core.xtend.RichStringIf in project xtext-xtend by eclipse.
the class ParserTest method testRichStringIF_00.
@Test
public void testRichStringIF_00() throws Exception {
XtendFunction function = function("def foo() ''' foo �IF true� wurst �ELSEIF null==3� brot �ELSE� machine �ENDIF� bar '''");
final RichString richString = (RichString) function.getExpression();
assertTrue(richString.getExpressions().get(0) instanceof RichStringLiteral);
final RichStringIf rsIf = (RichStringIf) richString.getExpressions().get(1);
assertTrue(rsIf.getIf() instanceof XBooleanLiteral);
assertTrue(rsIf.getThen() instanceof RichString);
assertEquals(1, rsIf.getElseIfs().size());
RichStringElseIf elseIf = rsIf.getElseIfs().get(0);
assertTrue(elseIf.getIf() instanceof XBinaryOperation);
assertTrue(elseIf.getThen() instanceof RichString);
assertTrue(rsIf.getElse() instanceof RichString);
assertTrue(richString.getExpressions().get(2) instanceof RichStringLiteral);
}
use of org.eclipse.xtend.core.xtend.RichStringIf in project xtext-xtend by eclipse.
the class ParserTest method testRichStringIF_01.
@Test
public void testRichStringIF_01() throws Exception {
XtendFunction function = function("def foo() ''' foo �IF true� wurst �IF false� brot �ELSE� machine �ENDIF� bar �ENDIF�'''");
final RichString richString = (RichString) function.getExpression();
assertTrue(richString.getExpressions().get(0) instanceof RichStringLiteral);
final RichStringIf rsIf = (RichStringIf) richString.getExpressions().get(1);
assertTrue(rsIf.getIf() instanceof XBooleanLiteral);
final RichString then = (RichString) rsIf.getThen();
assertEquals(3, then.getExpressions().size());
RichStringIf innerIf = (RichStringIf) then.getExpressions().get(1);
assertTrue(innerIf.getIf() instanceof XBooleanLiteral);
assertTrue(innerIf.getElse() instanceof RichString);
assertTrue(rsIf.getElse() == null);
assertTrue(richString.getExpressions().get(2) instanceof RichStringLiteral);
}
Aggregations