use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testExpression1.
@Test
public void testExpression1() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("5 a + b");
_builder.newLine();
String _trim = _builder.toString().trim();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("0 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Add Root");
_builder_1.newLine();
_builder_1.append("0 1 S \"5\" Root:\'5\'");
_builder_1.newLine();
_builder_1.append("1 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Named\'a\' Expression:{Add.left=} path:Add/left");
_builder_1.newLine();
_builder_1.append("2 1 S \"a\" Primary:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Named\'a\' Expression:{Add.left=} path:Add/left");
_builder_1.newLine();
_builder_1.append("3 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("4 1 S \"+\" Expression:\'+\'");
_builder_1.newLine();
_builder_1.append("5 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Named\'b\' Expression:right=Primary path:Add/right");
_builder_1.newLine();
_builder_1.append("6 1 S \"b\" Primary:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Named\'b\' Expression:right=Primary path:Add/right");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Add Root");
_builder_1.newLine();
_builder_1.append("7 0 H");
_builder_1.newLine();
this.operator_tripleEquals(_trim, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testExpression2.
@Test
public void testExpression2() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("5 (a + b) + c");
_builder.newLine();
String _trim = _builder.toString().trim();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(" ");
_builder_1.append("0 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Add Root");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("0 1 S \"5\" Root:\'5\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("1 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Add Expression:{Add.left=} path:Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("2 1 S \"(\" Parenthesized:\'(\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("3 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Named\'a\' Expression:{Add.left=} path:Add/left=Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("3 1 S \"a\" Primary:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Named\'a\' Expression:{Add.left=} path:Add/left=Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("4 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("5 1 S \"+\" Expression:\'+\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("6 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Named\'b\' Expression:right=Primary path:Add/right=Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("7 1 S \"b\" Primary:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Named\'b\' Expression:right=Primary path:Add/right=Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("8 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("8 1 S \")\" Parenthesized:\')\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Add Expression:{Add.left=} path:Add/left");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("9 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("10 1 S \"+\" Expression:\'+\'");
_builder_1.newLine();
_builder_1.append("11 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Named\'c\' Expression:right=Primary path:Add/right");
_builder_1.newLine();
_builder_1.append("12 1 S \"c\" Primary:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Named\'c\' Expression:right=Primary path:Add/right");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Add Root");
_builder_1.newLine();
_builder_1.append("13 0 H");
_builder_1.newLine();
this.operator_tripleEquals(_trim, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression in project xtext-core by eclipse.
the class AddImpl method basicSetLeft.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(Expression newLeft, NotificationChain msgs) {
Expression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RegionaccesstestlanguagePackage.ADD__LEFT, oldLeft, newLeft);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression in project xtext-core by eclipse.
the class AddImpl method basicSetRight.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRight(Expression newRight, NotificationChain msgs) {
Expression oldRight = right;
right = newRight;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RegionaccesstestlanguagePackage.ADD__RIGHT, oldRight, newRight);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForKeywordPairs.
@Test
public void regionForKeywordPairs() {
@Extension final RegionAccessTestLanguageGrammarAccess.ParenthesizedElements rule = this._regionAccessTestLanguageGrammarAccess.getParenthesizedAccess();
StringConcatenation _builder = new StringConcatenation();
_builder.append("5 (foo)");
final Expression expr = this.<Expression>parseAs(_builder, Expression.class);
final ISemanticRegionsFinder finder = this.toAccess(expr).regionForEObject(expr).getRegionFor();
final String actual1 = this.pairsToString(finder.keywordPairs("(", ")"));
final String actual2 = this.pairsToString(finder.keywordPairs(rule.getLeftParenthesisKeyword_0(), rule.getRightParenthesisKeyword_2()));
final String expected = "(foo)";
Assert.assertEquals(expected, actual1);
Assert.assertEquals(expected, actual2);
}
Aggregations