protected boolean startsWithUnaryOperator(EObject obj) { if(obj instanceof XUnaryOperation) return true; if(obj instanceof XBinaryOperation) return startsWithUnaryOperator(((XBinaryOperation)obj).getLeftOperand()); if(obj instanceof XPostfixOperation) { return startsWithUnaryOperator(((XPostfixOperation)obj).getOperand()); } return false; }
protected boolean startsWithUnaryOperator(EObject obj) { if(obj instanceof XUnaryOperation) return true; if(obj instanceof XBinaryOperation) return startsWithUnaryOperator(((XBinaryOperation)obj).getLeftOperand()); if(obj instanceof XPostfixOperation) { return startsWithUnaryOperator(((XPostfixOperation)obj).getOperand()); } return false; }
/** Generate the given object. * * @param operation the postfix operator. * @param it the target for the generated content. * @param context the context. * @return the operation. */ protected XExpression _generate(XPostfixOperation operation, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); final String operator = getOperatorSymbol(operation); if (operator != null) { it.append("("); //$NON-NLS-1$ switch (operator) { case "++": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" += 1"); //$NON-NLS-1$ break; case "--": //$NON-NLS-1$ generate(operation.getOperand(), it, context); it.append(" -= 1"); //$NON-NLS-1$ break; default: throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator)); } it.append(")"); //$NON-NLS-1$ } return operation; }
public XExpression getSyntacticReceiver(XExpression expression) { if (expression instanceof XAbstractFeatureCall) { if (expression instanceof XFeatureCall) { return null; } if (expression instanceof XMemberFeatureCall) { return ((XMemberFeatureCall) expression).getMemberCallTarget(); } if (expression instanceof XAssignment) { return ((XAssignment) expression).getAssignable(); } if (expression instanceof XBinaryOperation) { return ((XBinaryOperation) expression).getLeftOperand(); } if (expression instanceof XUnaryOperation) { return ((XUnaryOperation) expression).getOperand(); } if (expression instanceof XPostfixOperation) { return ((XPostfixOperation) expression).getOperand(); } } return null; }
protected void _format(final XPostfixOperation expr, @Extension final IFormattableDocument doc) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.noSpace(); }; doc.prepend(this.textRegionExtensions.regionFor(expr).feature(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE), _function); doc.<XExpression>format(expr.getOperand()); }
feeder.accept(grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0(), semanticObject.getOperand()); feeder.accept(grammarAccess.getXPostfixOperationAccess().getFeatureJvmIdentifiableElementOpPostfixParserRuleCall_1_0_1_0_1(), semanticObject.eGet(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false)); feeder.finish();