Java Code Examples for org.eclipse.jdt.internal.compiler.ast.ASTNode#ParenthesizedSHIFT

The following examples show how to use org.eclipse.jdt.internal.compiler.ast.ASTNode#ParenthesizedSHIFT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BinaryExpressionFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean buildFragments(Expression expression) {
	if (((expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) != 0) {
		addRealFragment(expression);
		return false;
	}
	return true;
}
 
Example 2
Source File: BinaryExpressionFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean visit(
	AND_AND_Expression and_and_Expression,
	BlockScope scope) {

	if (((and_and_Expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) != 0) {
		addRealFragment(and_and_Expression);
	} else {
		and_and_Expression.left.traverse(this, scope);
		this.operatorsList.add(new Integer(TerminalTokens.TokenNameAND_AND));
		and_and_Expression.right.traverse(this, scope);
	}
	return false;
}
 
Example 3
Source File: BinaryExpressionFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean visit(StringLiteralConcatenation stringLiteral, BlockScope scope) {
	if (((stringLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) != 0) {
		addRealFragment(stringLiteral);
	} else {
		for (int i = 0, max = stringLiteral.counter; i < max; i++) {
			addRealFragment(stringLiteral.literals[i]);
			if (i < max - 1) {
				this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
			}
		}
	}
	return false;
}
 
Example 4
Source File: BinaryExpressionFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
	if (((or_or_Expression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) != 0) {
		addRealFragment(or_or_Expression);
	} else {
		or_or_Expression.left.traverse(this, scope);
		this.operatorsList.add(new Integer(TerminalTokens.TokenNameOR_OR));
		or_or_Expression.right.traverse(this, scope);
	}
	return false;
}
 
Example 5
Source File: CascadingMethodInvocationFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean visit(MessageSend messageSend, BlockScope scope) {
	if ((messageSend.receiver.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT == 0) {
		if (messageSend.receiver instanceof MessageSend) {
			this.fragmentsList.add(0, messageSend);
			messageSend.receiver.traverse(this, scope);
			return false;
		}
		this.fragmentsList.add(0, messageSend);
		this.fragmentsList.add(1, messageSend);
	} else {
		this.fragmentsList.add(0, messageSend);
		this.fragmentsList.add(1, messageSend);
	}
	return false;
}
 
Example 6
Source File: BinaryExpressionFragmentBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
	if (binaryExpression instanceof CombinedBinaryExpression) {
		CombinedBinaryExpression expression = (CombinedBinaryExpression) binaryExpression;
		if (expression.referencesTable != null) {
			return this.visit(expression, scope);
		}
	}
	final int numberOfParens = (binaryExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
	if (numberOfParens > 0) {
		addRealFragment(binaryExpression);
	} else {
		switch((binaryExpression.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT) {
			case OperatorIds.PLUS :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNamePLUS));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.MINUS :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameMINUS));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.MULTIPLY :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameMULTIPLY));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.REMAINDER :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameREMAINDER));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.XOR :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameXOR));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.DIVIDE :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameDIVIDE));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.OR :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameOR));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			case OperatorIds.AND :
				if (buildFragments(binaryExpression)) {
					binaryExpression.left.traverse(this, scope);
					this.operatorsList.add(new Integer(TerminalTokens.TokenNameAND));
					binaryExpression.right.traverse(this, scope);
				}
				return false;
			default:
				addRealFragment(binaryExpression);
		}
	}
	return false;
}