mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 07:25:23 +02:00
Cosmetics.
This commit is contained in:
parent
e6bec45296
commit
bb53b9e92f
2 changed files with 13 additions and 10 deletions
|
@ -920,20 +920,22 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
|
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE || !isActiveCode()) {
|
||||||
skipOverCompoundStatement(true);
|
skipOverCompoundStatement(true);
|
||||||
} else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
|
} else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
|
||||||
if (scanner.isOnTopContext())
|
if (scanner.isOnTopContext()) {
|
||||||
compoundStatement();
|
compoundStatement();
|
||||||
else
|
} else {
|
||||||
skipOverCompoundStatement(true);
|
skipOverCompoundStatement(true);
|
||||||
} else if (mode == ParserMode.COMPLETE_PARSE)
|
}
|
||||||
|
} else if (mode == ParserMode.COMPLETE_PARSE) {
|
||||||
compoundStatement = compoundStatement();
|
compoundStatement = compoundStatement();
|
||||||
|
}
|
||||||
|
|
||||||
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||||
IGNUASTCompoundStatementExpression resultExpression = nodeFactory.newGNUCompoundStatementExpression(compoundStatement);
|
IGNUASTCompoundStatementExpression resultExpression =
|
||||||
|
nodeFactory.newGNUCompoundStatementExpression(compoundStatement);
|
||||||
((ASTNode) resultExpression).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
|
((ASTNode) resultExpression).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
|
||||||
return resultExpression;
|
return resultExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models a cast expression followed by an operator. Can be linked into a chain.
|
* Models a cast expression followed by an operator. Can be linked into a chain.
|
||||||
* This is done right to left, such that a tree of variants can be built.
|
* This is done right to left, such that a tree of variants can be built.
|
||||||
|
@ -946,7 +948,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
IASTInitializerClause fExpression;
|
IASTInitializerClause fExpression;
|
||||||
final CastAmbiguityMarker fAmbiguityMarker;
|
final CastAmbiguityMarker fAmbiguityMarker;
|
||||||
|
|
||||||
public BinaryOperator(BinaryOperator nextOp, IASTInitializerClause expression, int operatorToken, int leftPrecedence, int rightPrecedence) {
|
public BinaryOperator(BinaryOperator nextOp, IASTInitializerClause expression, int operatorToken,
|
||||||
|
int leftPrecedence, int rightPrecedence) {
|
||||||
fNext= nextOp;
|
fNext= nextOp;
|
||||||
fOperatorToken= operatorToken;
|
fOperatorToken= operatorToken;
|
||||||
fLeftPrecedence= leftPrecedence;
|
fLeftPrecedence= leftPrecedence;
|
||||||
|
@ -1014,7 +1017,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
negative= operator.fNext.fExpression;
|
negative= operator.fNext.fExpression;
|
||||||
operator.fNext= operator.fNext.fNext;
|
operator.fNext= operator.fNext.fNext;
|
||||||
}
|
}
|
||||||
IASTConditionalExpression conditionalEx = nodeFactory.newConditionalExpession(left, (IASTExpression) right, (IASTExpression) negative);
|
IASTConditionalExpression conditionalEx =
|
||||||
|
nodeFactory.newConditionalExpession(left, (IASTExpression) right, (IASTExpression) negative);
|
||||||
setRange(conditionalEx, left);
|
setRange(conditionalEx, left);
|
||||||
if (negative != null) {
|
if (negative != null) {
|
||||||
adjustLength(conditionalEx, negative);
|
adjustLength(conditionalEx, negative);
|
||||||
|
|
|
@ -12,8 +12,6 @@ package org.eclipse.cdt.core.dom.lrparser.action.gnu;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lpg.lpgjavaruntime.IToken;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -25,6 +23,8 @@ import org.eclipse.cdt.core.dom.lrparser.action.ScopedStack;
|
||||||
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
|
import org.eclipse.cdt.core.dom.lrparser.action.TokenMap;
|
||||||
import org.eclipse.cdt.internal.core.dom.lrparser.gcc.GCCParsersym;
|
import org.eclipse.cdt.internal.core.dom.lrparser.gcc.GCCParsersym;
|
||||||
|
|
||||||
|
import lpg.lpgjavaruntime.IToken;
|
||||||
|
|
||||||
public class GNUBuildASTParserAction extends AbstractParserAction {
|
public class GNUBuildASTParserAction extends AbstractParserAction {
|
||||||
|
|
||||||
private final INodeFactory nodeFactory;
|
private final INodeFactory nodeFactory;
|
||||||
|
@ -84,7 +84,6 @@ public class GNUBuildASTParserAction extends AbstractParserAction {
|
||||||
astStack.push(asm);
|
astStack.push(asm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* primary_expression
|
* primary_expression
|
||||||
* ::= '(' compound_statement ')'
|
* ::= '(' compound_statement ')'
|
||||||
|
|
Loading…
Add table
Reference in a new issue