diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java index 44318861942..8b4d2131073 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java @@ -563,10 +563,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { } /** - * Parse an identifier. + * Parses an identifier. * - * @throws BacktrackException - * request a backtrack + * @throws BacktrackException request a backtrack */ protected abstract IASTName identifier() throws EndOfFileException, BacktrackException; @@ -1242,7 +1241,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { } IASTCastExpression result = buildCastExpression(IASTCastExpression.op_cast, typeId, rhs, startingOffset, calculateEndOffset(rhs)); - if (!unaryFailed && couldBeFunctionCall && rhs instanceof IASTCastExpression == false) { + if (!unaryFailed && couldBeFunctionCall && !(rhs instanceof IASTCastExpression)) { IToken markEnd= mark(); backup(mark); try { @@ -2164,27 +2163,25 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { return cs; } - protected int figureEndOffset(IASTDeclSpecifier declSpec, IASTDeclarator[] declarators) { if (declarators.length == 0) return calculateEndOffset(declSpec); return calculateEndOffset(declarators[declarators.length - 1]); } - protected int figureEndOffset(IASTDeclSpecifier declSpecifier, IASTDeclarator declarator) { if (declarator == null || ((ASTNode) declarator).getLength() == 0) return calculateEndOffset(declSpecifier); return calculateEndOffset(declarator); } - protected void throwBacktrack(IToken token) throws BacktrackException { throwBacktrack(token.getOffset(), token.getLength()); } protected IASTExpression parseTypeidInParenthesisOrUnaryExpression(boolean exprIsLimitedToParenthesis, - int offset, int typeExprKind, int unaryExprKind, CastExprCtx ctx, ITemplateIdStrategy strat) throws BacktrackException, EndOfFileException { + int offset, int typeExprKind, int unaryExprKind, CastExprCtx ctx, ITemplateIdStrategy strat) + throws BacktrackException, EndOfFileException { IASTTypeId typeid; IASTExpression expr= null; IToken typeidLA= null; @@ -2315,7 +2312,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { } /** - * Accept a sequence of __attribute__ or __declspec + * Accepts a sequence of __attribute__ or __declspec. * * @param allowAttrib if true accept any number of __attribute__ * @param allowDeclspec if true accept any number of __declspec @@ -2416,7 +2413,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { * @throws EndOfFileException */ protected void handleOtherDeclSpecModifier() throws BacktrackException, EndOfFileException { - // default action: consume keyword plus optional parenthesised "something" + // default action: consume keyword plus optional parenthesized "something" consume(); IToken token = LA(1); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java index 2819243d5d6..d104fb63984 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java @@ -6,10 +6,10 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * John Camelon (IBM Rational Software) - Initial API and implementation - * Markus Schorn (Wind River Systems) - * Ed Swartz (Nokia) - * Mike Kucera (IBM) - bug #206952 + * John Camelon (IBM Rational Software) - Initial API and implementation + * Markus Schorn (Wind River Systems) + * Ed Swartz (Nokia) + * Mike Kucera (IBM) - bug #206952 *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.c; @@ -415,7 +415,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { final IASTDeclarator outerDtor= declarators[0]; final IASTDeclarator fdtor= ASTQueries.findTypeRelevantDeclarator(outerDtor); - if (fdtor instanceof IASTFunctionDeclarator == false) + if (!(fdtor instanceof IASTFunctionDeclarator)) throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset); IASTFunctionDefinition funcDefinition = nodeFactory.newFunctionDefinition(declSpec, (IASTFunctionDeclarator) fdtor, null); @@ -465,8 +465,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { } private IASTExpression expression(final ExprKind kind) throws EndOfFileException, BacktrackException { - final boolean allowComma= kind==ExprKind.eExpression; - boolean allowAssignment= kind !=ExprKind.eConstant; + final boolean allowComma= kind == ExprKind.eExpression; + boolean allowAssignment= kind != ExprKind.eConstant; int lt1; int conditionCount= 0; BinaryOperator lastOperator= null; @@ -479,7 +479,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { // ? : // Precedence: 25 is lower than precedence of logical or; 0 is lower than precedence of expression lastOperator= new BinaryOperator(lastOperator, lastExpression, lt1, 25, 0); - if (LT(2) == IToken.tCOLON) { + if (LT(2) == IToken.tCOLON) { // Gnu extension: The expression after '?' can be omitted. consume(); // Consume operator lastExpression= null; // Next cast expression is just null @@ -1491,7 +1491,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { int startOffset= last.getOffset(); // check for K&R C parameters (0 means it's not K&R C) - if (fPreventKnrCheck==0 && supportKnRC) { + if (fPreventKnrCheck == 0 && supportKnRC) { fPreventKnrCheck++; try { final int numKnRCParms = countKnRCParms(); @@ -1597,7 +1597,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { } private IASTSimpleDeclaration checkKnrParameterDeclaration(IASTDeclaration decl, final IASTName[] parmNames) { - if (decl instanceof IASTSimpleDeclaration == false) + if (!(decl instanceof IASTSimpleDeclaration)) return null; IASTSimpleDeclaration declaration= ((IASTSimpleDeclaration) decl); @@ -1839,7 +1839,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { return parseDeclarationOrExpressionStatement(); } - } @Override @@ -1863,7 +1862,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { previousWasIdentifier = false; } else if (LT(1) == IToken.tIDENTIFIER) { consume(); - if (previousWasIdentifier == true) { + if (previousWasIdentifier) { backup(mark); return 0; // i.e. KnR C won't have int f(typedef x) // char @@ -2011,9 +2010,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { if (if_statement != null) { if_statement.setElseClause(new_if_statement); - ((ASTNode) if_statement) - .setLength(calculateEndOffset(new_if_statement) - - ((ASTNode) if_statement).getOffset()); + ((ASTNode) if_statement).setLength(calculateEndOffset(new_if_statement) + - ((ASTNode) if_statement).getOffset()); } if (result == null && if_statement != null) result = if_statement; @@ -2027,9 +2025,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { new_if_statement.setElseClause(elseStatement); if (if_statement != null) { if_statement.setElseClause(new_if_statement); - ((ASTNode) if_statement) - .setLength(calculateEndOffset(new_if_statement) - - ((ASTNode) if_statement).getOffset()); + ((ASTNode) if_statement).setLength(calculateEndOffset(new_if_statement) + - ((ASTNode) if_statement).getOffset()); } else { if (result == null) result = new_if_statement; @@ -2037,12 +2034,10 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { } } else { if( thenClause != null ) - ((ASTNode) new_if_statement) - .setLength(calculateEndOffset(thenClause) - start); + ((ASTNode) new_if_statement).setLength(calculateEndOffset(thenClause) - start); if (if_statement != null) { if_statement.setElseClause(new_if_statement); - ((ASTNode) new_if_statement) - .setLength(calculateEndOffset(new_if_statement) - start); + ((ASTNode) new_if_statement).setLength(calculateEndOffset(new_if_statement) - start); } if (result == null && if_statement != null) result = if_statement; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java index f0a3aa88b97..9459ab9e636 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java @@ -2454,7 +2454,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { IASTDeclarator outerDtor) throws EndOfFileException, BacktrackException { final IASTDeclarator dtor= ASTQueries.findTypeRelevantDeclarator(outerDtor); - if (dtor instanceof ICPPASTFunctionDeclarator == false) + if (!(dtor instanceof ICPPASTFunctionDeclarator)) throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);