Search in sources :

Example 1 with RichStringIf

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));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) RichStringIf(org.eclipse.xtend.core.xtend.RichStringIf)

Example 2 with 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);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) XBooleanLiteral(org.eclipse.xtext.xbase.XBooleanLiteral) RichString(org.eclipse.xtend.core.xtend.RichString) RichStringLiteral(org.eclipse.xtend.core.xtend.RichStringLiteral) RichStringIf(org.eclipse.xtend.core.xtend.RichStringIf) XBinaryOperation(org.eclipse.xtext.xbase.XBinaryOperation) RichStringElseIf(org.eclipse.xtend.core.xtend.RichStringElseIf) Test(org.junit.Test)

Example 3 with RichStringIf

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);
}
Also used : XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) XBooleanLiteral(org.eclipse.xtext.xbase.XBooleanLiteral) RichString(org.eclipse.xtend.core.xtend.RichString) RichStringLiteral(org.eclipse.xtend.core.xtend.RichStringLiteral) RichStringIf(org.eclipse.xtend.core.xtend.RichStringIf) Test(org.junit.Test)

Aggregations

RichStringIf (org.eclipse.xtend.core.xtend.RichStringIf)3 RichString (org.eclipse.xtend.core.xtend.RichString)2 RichStringLiteral (org.eclipse.xtend.core.xtend.RichStringLiteral)2 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)2 XBooleanLiteral (org.eclipse.xtext.xbase.XBooleanLiteral)2 Test (org.junit.Test)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 RichStringElseIf (org.eclipse.xtend.core.xtend.RichStringElseIf)1 XBinaryOperation (org.eclipse.xtext.xbase.XBinaryOperation)1