mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Cosmetics.
This commit is contained in:
parent
3e81f0437c
commit
4316da89b5
9 changed files with 62 additions and 80 deletions
|
@ -21,7 +21,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICASTArrayDesignator extends ICASTDesignator {
|
public interface ICASTArrayDesignator extends ICASTDesignator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>SUBSCRIPT_EXPRESSION</code> represents the relationship between
|
* <code>SUBSCRIPT_EXPRESSION</code> represents the relationship between
|
||||||
* the designator and the subscript expression.
|
* the designator and the subscript expression.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.c;
|
package org.eclipse.cdt.core.dom.ast.c;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICASTDesignator extends IASTNode {
|
public interface ICASTDesignator extends IASTNode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.gnu.c;
|
package org.eclipse.cdt.core.dom.ast.gnu.c;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IGCCASTArrayRangeDesignator extends ICASTDesignator {
|
public interface IGCCASTArrayRangeDesignator extends ICASTDesignator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>SUSBCRIPT_FLOOR_EXPRESSION</code> represents the lower value in
|
* <code>SUSBCRIPT_FLOOR_EXPRESSION</code> represents the lower value in
|
||||||
* the range of expressions.
|
* the range of expressions.
|
||||||
|
|
|
@ -20,10 +20,10 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of array designators
|
* Implementation of array designator.
|
||||||
*/
|
*/
|
||||||
public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator, IASTAmbiguityParent {
|
public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator, IASTAmbiguityParent {
|
||||||
private IASTExpression exp;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public CASTArrayDesignator() {
|
public CASTArrayDesignator() {
|
||||||
}
|
}
|
||||||
|
@ -39,19 +39,20 @@ public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CASTArrayDesignator copy(CopyStyle style) {
|
public CASTArrayDesignator copy(CopyStyle style) {
|
||||||
CASTArrayDesignator copy = new CASTArrayDesignator(exp == null ? null : exp.copy(style));
|
CASTArrayDesignator copy =
|
||||||
|
new CASTArrayDesignator(expression == null ? null : expression.copy(style));
|
||||||
return copy(copy, style);
|
return copy(copy, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTExpression getSubscriptExpression() {
|
public IASTExpression getSubscriptExpression() {
|
||||||
return exp;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSubscriptExpression(IASTExpression value) {
|
public void setSubscriptExpression(IASTExpression value) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
exp = value;
|
expression = value;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
value.setParent(this);
|
value.setParent(this);
|
||||||
value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
|
value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
|
||||||
|
@ -67,7 +68,7 @@ public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exp != null && !exp.accept(action))
|
if (expression != null && !expression.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (action.shouldVisitDesignators && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
if (action.shouldVisitDesignators && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
||||||
|
@ -78,10 +79,10 @@ public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if (child == exp) {
|
if (child == expression) {
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
exp = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -20,12 +20,12 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of array range designators.
|
* Implementation of array range designator.
|
||||||
*/
|
*/
|
||||||
public class CASTArrayRangeDesignator extends ASTNode implements
|
public class CASTArrayRangeDesignator extends ASTNode
|
||||||
IGCCASTArrayRangeDesignator, IASTAmbiguityParent {
|
implements IGCCASTArrayRangeDesignator, IASTAmbiguityParent {
|
||||||
|
private IASTExpression floor;
|
||||||
private IASTExpression floor, ceiling;
|
private IASTExpression ceiling;
|
||||||
|
|
||||||
public CASTArrayRangeDesignator() {
|
public CASTArrayRangeDesignator() {
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class CASTArrayRangeDesignator extends ASTNode implements
|
||||||
public void setRangeFloor(IASTExpression expression) {
|
public void setRangeFloor(IASTExpression expression) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
floor = expression;
|
floor = expression;
|
||||||
if(expression != null) {
|
if (expression != null) {
|
||||||
expression.setParent(this);
|
expression.setParent(this);
|
||||||
expression.setPropertyInParent(SUBSCRIPT_FLOOR_EXPRESSION);
|
expression.setPropertyInParent(SUBSCRIPT_FLOOR_EXPRESSION);
|
||||||
}
|
}
|
||||||
|
@ -72,19 +72,19 @@ public class CASTArrayRangeDesignator extends ASTNode implements
|
||||||
public void setRangeCeiling(IASTExpression expression) {
|
public void setRangeCeiling(IASTExpression expression) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
ceiling = expression;
|
ceiling = expression;
|
||||||
if(expression != null) {
|
if (expression != null) {
|
||||||
expression.setParent(this);
|
expression.setParent(this);
|
||||||
expression.setPropertyInParent(SUBSCRIPT_CEILING_EXPRESSION);
|
expression.setPropertyInParent(SUBSCRIPT_CEILING_EXPRESSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitDesignators ) {
|
if (action.shouldVisitDesignators) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (floor != null && !floor.accept(action))
|
if (floor != null && !floor.accept(action))
|
||||||
|
@ -100,18 +100,15 @@ public class CASTArrayRangeDesignator extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == floor )
|
if (child == floor) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
floor = (IASTExpression) other;
|
floor = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
if( child == ceiling)
|
if (child == ceiling) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
ceiling = (IASTExpression) other;
|
ceiling = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -20,13 +20,11 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of field designators
|
* Implementation of field designator.
|
||||||
*/
|
*/
|
||||||
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator, IASTCompletionContext {
|
public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator, IASTCompletionContext {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
|
|
||||||
public CASTFieldDesignator() {
|
public CASTFieldDesignator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +59,12 @@ public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action) {
|
||||||
if (action.shouldVisitDesignators ) {
|
if (action.shouldVisitDesignators) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name != null && !name.accept(action))
|
if (name != null && !name.accept(action))
|
||||||
|
|
|
@ -238,7 +238,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
ICASTFieldDesignator fieldDesignator = getNodeFactory().newFieldDesignator(n);
|
ICASTFieldDesignator fieldDesignator = getNodeFactory().newFieldDesignator(n);
|
||||||
setRange(fieldDesignator, offset, calculateEndOffset(n));
|
setRange(fieldDesignator, offset, calculateEndOffset(n));
|
||||||
if (designatorList == null)
|
if (designatorList == null)
|
||||||
designatorList = new ArrayList<ICASTDesignator>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
designatorList = new ArrayList<>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
||||||
designatorList.add(fieldDesignator);
|
designatorList.add(fieldDesignator);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -252,14 +252,14 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
IGCCASTArrayRangeDesignator designator = getNodeFactory().newArrayRangeDesignatorGCC(constantExpression, constantExpression2);
|
IGCCASTArrayRangeDesignator designator = getNodeFactory().newArrayRangeDesignatorGCC(constantExpression, constantExpression2);
|
||||||
setRange(designator, offset, lastOffset);
|
setRange(designator, offset, lastOffset);
|
||||||
if (designatorList == null)
|
if (designatorList == null)
|
||||||
designatorList = new ArrayList<ICASTDesignator>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
designatorList = new ArrayList<>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
||||||
designatorList.add(designator);
|
designatorList.add(designator);
|
||||||
} else {
|
} else {
|
||||||
int lastOffset = consume(IToken.tRBRACKET).getEndOffset();
|
int lastOffset = consume(IToken.tRBRACKET).getEndOffset();
|
||||||
ICASTArrayDesignator designator = getNodeFactory().newArrayDesignator(constantExpression);
|
ICASTArrayDesignator designator = getNodeFactory().newArrayDesignator(constantExpression);
|
||||||
setRange(designator, offset, lastOffset);
|
setRange(designator, offset, lastOffset);
|
||||||
if (designatorList == null)
|
if (designatorList == null)
|
||||||
designatorList = new ArrayList<ICASTDesignator>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
designatorList = new ArrayList<>(DEFAULT_DESIGNATOR_LIST_SIZE);
|
||||||
designatorList.add(designator);
|
designatorList.add(designator);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -700,7 +700,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
IASTExpression expr= expression(ExprKind.eAssignment);
|
IASTExpression expr= expression(ExprKind.eAssignment);
|
||||||
if (argList == null) {
|
if (argList == null) {
|
||||||
argList= new ArrayList<IASTExpression>();
|
argList= new ArrayList<>();
|
||||||
}
|
}
|
||||||
argList.add(expr);
|
argList.add(expr);
|
||||||
}
|
}
|
||||||
|
@ -1379,7 +1379,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
final int startingOffset = LA(1).getOffset();
|
final int startingOffset = LA(1).getOffset();
|
||||||
int endOffset = startingOffset;
|
int endOffset = startingOffset;
|
||||||
|
|
||||||
List<IASTPointerOperator> pointerOps = new ArrayList<IASTPointerOperator>(DEFAULT_POINTEROPS_LIST_SIZE);
|
List<IASTPointerOperator> pointerOps = new ArrayList<>(DEFAULT_POINTEROPS_LIST_SIZE);
|
||||||
consumePointerOperators(pointerOps);
|
consumePointerOperators(pointerOps);
|
||||||
if (!pointerOps.isEmpty()) {
|
if (!pointerOps.isEmpty()) {
|
||||||
endOffset = calculateEndOffset(pointerOps.get(pointerOps.size() - 1));
|
endOffset = calculateEndOffset(pointerOps.get(pointerOps.size() - 1));
|
||||||
|
@ -1643,7 +1643,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
IASTParameterDeclaration pd = parameterDeclaration(paramOption);
|
IASTParameterDeclaration pd = parameterDeclaration(paramOption);
|
||||||
endOffset = calculateEndOffset(pd);
|
endOffset = calculateEndOffset(pd);
|
||||||
if (parameters == null)
|
if (parameters == null)
|
||||||
parameters = new ArrayList<IASTParameterDeclaration>(DEFAULT_PARAMETERS_LIST_SIZE);
|
parameters = new ArrayList<>(DEFAULT_PARAMETERS_LIST_SIZE);
|
||||||
parameters.add(pd);
|
parameters.add(pd);
|
||||||
seenParameter = true;
|
seenParameter = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1685,7 +1685,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
* Parse an array declarator starting at the square bracket.
|
* Parse an array declarator starting at the square bracket.
|
||||||
*/
|
*/
|
||||||
private IASTArrayDeclarator arrayDeclarator() throws EndOfFileException, BacktrackException {
|
private IASTArrayDeclarator arrayDeclarator() throws EndOfFileException, BacktrackException {
|
||||||
ArrayList<IASTArrayModifier> arrayMods = new ArrayList<IASTArrayModifier>(DEFAULT_POINTEROPS_LIST_SIZE);
|
ArrayList<IASTArrayModifier> arrayMods = new ArrayList<>(DEFAULT_POINTEROPS_LIST_SIZE);
|
||||||
int start= LA(1).getOffset();
|
int start= LA(1).getOffset();
|
||||||
consumeArrayModifiers(arrayMods);
|
consumeArrayModifiers(arrayMods);
|
||||||
if (arrayMods.isEmpty())
|
if (arrayMods.isEmpty())
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* Anders Dahlberg (Ericsson) - bug 84144
|
* Anders Dahlberg (Ericsson) - bug 84144
|
||||||
* Nathan Ridge
|
* Nathan Ridge
|
||||||
* Richard Eames
|
* Richard Eames
|
||||||
|
* Alexander Nyßen (itemis AG) - bug 475908
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -169,18 +170,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.NameOrTemplateIDVariants.Bra
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.NameOrTemplateIDVariants.Variant;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.NameOrTemplateIDVariants.Variant;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2005, 2015 IBM Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
|
||||||
* Alexander Nyßen (itemis AG) - bug 475908
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is our implementation of the IParser interface, serving as a parser for
|
* This is our implementation of the IParser interface, serving as a parser for
|
||||||
* GNU C and C++. From time to time we will make reference to the ANSI ISO
|
* GNU C and C++. From time to time we will make reference to the ANSI ISO
|
||||||
|
@ -246,7 +235,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap(
|
private Map<String, ContextSensitiveTokenType> createContextSensitiveTokenMap(
|
||||||
ICPPParserExtensionConfiguration config) {
|
ICPPParserExtensionConfiguration config) {
|
||||||
Map<String, ContextSensitiveTokenType> result = new HashMap<String, ContextSensitiveTokenType>();
|
Map<String, ContextSensitiveTokenType> result = new HashMap<>();
|
||||||
result.put(Keywords.OVERRIDE, ContextSensitiveTokenType.OVERRIDE);
|
result.put(Keywords.OVERRIDE, ContextSensitiveTokenType.OVERRIDE);
|
||||||
result.put(Keywords.FINAL, ContextSensitiveTokenType.FINAL);
|
result.put(Keywords.FINAL, ContextSensitiveTokenType.FINAL);
|
||||||
result.putAll(config.getAdditionalContextSensitiveKeywords());
|
result.putAll(config.getAdditionalContextSensitiveKeywords());
|
||||||
|
@ -438,7 +427,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
} else {
|
} else {
|
||||||
char[] nchars= nt.getCharImage();
|
char[] nchars= nt.getCharImage();
|
||||||
final int len= nchars.length;
|
final int len= nchars.length;
|
||||||
char[] image = new char[len+1];
|
char[] image = new char[len + 1];
|
||||||
image[0]= '~';
|
image[0]= '~';
|
||||||
System.arraycopy(nchars, 0, image, 1, len);
|
System.arraycopy(nchars, 0, image, 1, len);
|
||||||
name= getNodeFactory().newName(image);
|
name= getNodeFactory().newName(image);
|
||||||
|
@ -702,7 +691,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
IASTNode node= templateArgument(strat);
|
IASTNode node= templateArgument(strat);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list= new ArrayList<IASTNode>();
|
list= new ArrayList<>();
|
||||||
}
|
}
|
||||||
list.add(node);
|
list.add(node);
|
||||||
lt1= LT(1);
|
lt1= LT(1);
|
||||||
|
@ -2309,7 +2298,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
protected List<ICPPASTTemplateParameter> outerTemplateParameterList() throws BacktrackException, EndOfFileException {
|
protected List<ICPPASTTemplateParameter> outerTemplateParameterList() throws BacktrackException, EndOfFileException {
|
||||||
fTemplateParameterListStrategy= new TemplateIdStrategy();
|
fTemplateParameterListStrategy= new TemplateIdStrategy();
|
||||||
try {
|
try {
|
||||||
List<ICPPASTTemplateParameter> result = new ArrayList<ICPPASTTemplateParameter>(DEFAULT_PARM_LIST_SIZE);
|
List<ICPPASTTemplateParameter> result = new ArrayList<>(DEFAULT_PARM_LIST_SIZE);
|
||||||
IToken m= mark();
|
IToken m= mark();
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
@ -2400,7 +2389,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
consume();
|
consume();
|
||||||
consume(IToken.tLT);
|
consume(IToken.tLT);
|
||||||
List<ICPPASTTemplateParameter> tparList = templateParameterList(new ArrayList<ICPPASTTemplateParameter>());
|
List<ICPPASTTemplateParameter> tparList = templateParameterList(new ArrayList<>());
|
||||||
consume(IToken.tGT, IToken.tGT_in_SHIFTR);
|
consume(IToken.tGT, IToken.tGT_in_SHIFTR);
|
||||||
int endOffset = consume(IToken.t_class).getEndOffset();
|
int endOffset = consume(IToken.t_class).getEndOffset();
|
||||||
|
|
||||||
|
@ -2583,7 +2572,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
while (LTcatchEOF(1) == IToken.tLBRACKET && LTcatchEOF(2) == IToken.tLBRACKET) {
|
while (LTcatchEOF(1) == IToken.tLBRACKET && LTcatchEOF(2) == IToken.tLBRACKET) {
|
||||||
if (specifiers == null)
|
if (specifiers == null)
|
||||||
specifiers = new ArrayList<IASTAttributeSpecifier>();
|
specifiers = new ArrayList<>();
|
||||||
int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
|
int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
|
||||||
consumeOrEOC(IToken.tLBRACKET);
|
consumeOrEOC(IToken.tLBRACKET);
|
||||||
ICPPASTAttributeSpecifier attributeSpecifier = getNodeFactory().newAttributeSpecifier();
|
ICPPASTAttributeSpecifier attributeSpecifier = getNodeFactory().newAttributeSpecifier();
|
||||||
|
@ -2691,7 +2680,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
IASTDeclarator[] declarators= IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
IASTDeclarator[] declarators= IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||||
if (dtor != null) {
|
if (dtor != null) {
|
||||||
declarators= new IASTDeclarator[]{dtor};
|
declarators= new IASTDeclarator[] { dtor };
|
||||||
if (!declOption.fSingleDtor) {
|
if (!declOption.fSingleDtor) {
|
||||||
while (LTcatchEOF(1) == IToken.tCOMMA) {
|
while (LTcatchEOF(1) == IToken.tCOMMA) {
|
||||||
consume();
|
consume();
|
||||||
|
@ -2842,7 +2831,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
if (fdef instanceof ICPPASTFunctionWithTryBlock) {
|
if (fdef instanceof ICPPASTFunctionWithTryBlock) {
|
||||||
ICPPASTFunctionWithTryBlock tryblock= (ICPPASTFunctionWithTryBlock) fdef;
|
ICPPASTFunctionWithTryBlock tryblock= (ICPPASTFunctionWithTryBlock) fdef;
|
||||||
List<ICPPASTCatchHandler> handlers = new ArrayList<ICPPASTCatchHandler>(DEFAULT_CATCH_HANDLER_LIST_SIZE);
|
List<ICPPASTCatchHandler> handlers = new ArrayList<>(DEFAULT_CATCH_HANDLER_LIST_SIZE);
|
||||||
catchHandlerSequence(handlers);
|
catchHandlerSequence(handlers);
|
||||||
ICPPASTCatchHandler last= null;
|
ICPPASTCatchHandler last= null;
|
||||||
for (ICPPASTCatchHandler catchHandler : handlers) {
|
for (ICPPASTCatchHandler catchHandler : handlers) {
|
||||||
|
@ -3925,7 +3914,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
*/
|
*/
|
||||||
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException,
|
private List<IASTInitializerClause> initializerList(boolean allowSkipping) throws EndOfFileException,
|
||||||
BacktrackException {
|
BacktrackException {
|
||||||
List<IASTInitializerClause> result= new ArrayList<IASTInitializerClause>();
|
List<IASTInitializerClause> result= new ArrayList<>();
|
||||||
// List of initializer clauses
|
// List of initializer clauses
|
||||||
loop: while (true) {
|
loop: while (true) {
|
||||||
// Clause may be null, add to initializer anyways, such that the size can be computed.
|
// Clause may be null, add to initializer anyways, such that the size can be computed.
|
||||||
|
@ -4207,7 +4196,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
pointer.setRestrict(isRestrict);
|
pointer.setRestrict(isRestrict);
|
||||||
setRange(pointer, startOffset, endOffset);
|
setRange(pointer, startOffset, endOffset);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result= new ArrayList<IASTPointerOperator>(4);
|
result= new ArrayList<>(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes = CollectionUtils.merge(attributes, attributeSpecifierSeq());
|
attributes = CollectionUtils.merge(attributes, attributeSpecifierSeq());
|
||||||
|
@ -4470,7 +4459,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
* Parse an array declarator starting at the square bracket.
|
* Parse an array declarator starting at the square bracket.
|
||||||
*/
|
*/
|
||||||
private ICPPASTArrayDeclarator arrayDeclarator(DeclarationOptions option) throws EndOfFileException, BacktrackException {
|
private ICPPASTArrayDeclarator arrayDeclarator(DeclarationOptions option) throws EndOfFileException, BacktrackException {
|
||||||
ArrayList<IASTArrayModifier> arrayMods = new ArrayList<IASTArrayModifier>(4);
|
ArrayList<IASTArrayModifier> arrayMods = new ArrayList<>(4);
|
||||||
int start= LA(1).getOffset();
|
int start= LA(1).getOffset();
|
||||||
consumeArrayModifiers(option, arrayMods);
|
consumeArrayModifiers(option, arrayMods);
|
||||||
if (arrayMods.isEmpty())
|
if (arrayMods.isEmpty())
|
||||||
|
@ -4890,7 +4879,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
protected IASTStatement parseTryStatement() throws EndOfFileException, BacktrackException {
|
protected IASTStatement parseTryStatement() throws EndOfFileException, BacktrackException {
|
||||||
int startO = consume().getOffset();
|
int startO = consume().getOffset();
|
||||||
IASTStatement tryBlock = compoundStatement();
|
IASTStatement tryBlock = compoundStatement();
|
||||||
List<ICPPASTCatchHandler> catchHandlers = new ArrayList<ICPPASTCatchHandler>(DEFAULT_CATCH_HANDLER_LIST_SIZE);
|
List<ICPPASTCatchHandler> catchHandlers = new ArrayList<>(DEFAULT_CATCH_HANDLER_LIST_SIZE);
|
||||||
catchHandlerSequence(catchHandlers);
|
catchHandlerSequence(catchHandlers);
|
||||||
ICPPASTTryBlockStatement tryStatement = getNodeFactory().newTryBlockStatement(tryBlock);
|
ICPPASTTryBlockStatement tryStatement = getNodeFactory().newTryBlockStatement(tryBlock);
|
||||||
((ASTNode) tryStatement).setOffset(startO);
|
((ASTNode) tryStatement).setOffset(startO);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
import org.eclipse.cdt.ui.text.IColorManager;
|
import org.eclipse.cdt.ui.text.IColorManager;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput;
|
import org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput;
|
||||||
import org.eclipse.cdt.internal.ui.text.asm.AsmPartitionScanner;
|
import org.eclipse.cdt.internal.ui.text.asm.AsmPartitionScanner;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
|
@ -46,7 +47,6 @@ import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public final class CDTUITools {
|
public final class CDTUITools {
|
||||||
|
|
||||||
private CDTUITools() {
|
private CDTUITools() {
|
||||||
// prevent instantiation
|
// prevent instantiation
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue