mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Removed warnings.
This commit is contained in:
parent
9f21cf4d4a
commit
787b5dfcc3
8 changed files with 262 additions and 334 deletions
|
@ -385,15 +385,13 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createFieldASTNode(declarator, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, false);
|
||||
else
|
||||
if( declarator.hasFunctionBody() )
|
||||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createVariableASTNode(declarator, false);
|
||||
}
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, false);
|
||||
else
|
||||
if( declarator.hasFunctionBody() )
|
||||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createVariableASTNode(declarator, false);
|
||||
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -418,18 +416,12 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
if( isFunction)
|
||||
return createMethodASTNode(declarator, true);
|
||||
else
|
||||
return createFieldASTNode(declarator, true );
|
||||
return createFieldASTNode(declarator, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, true);
|
||||
else
|
||||
return createVariableASTNode(declarator, true);
|
||||
}
|
||||
|
||||
}
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, true);
|
||||
return createVariableASTNode(declarator, true);
|
||||
}
|
||||
|
||||
List convertedParms = createParameterList( declarator.getParameters() );
|
||||
IASTAbstractDeclaration abs = null;
|
||||
|
@ -450,18 +442,15 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
getStartingOffset(), getStartingLine(), d
|
||||
.getNameStartOffset(), d.getNameEndOffset(), d
|
||||
.getNameLine());
|
||||
else {
|
||||
if( isWithinClass )
|
||||
return astFactory.createField( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
|
||||
else
|
||||
return astFactory.createVariable( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
|
||||
}
|
||||
|
||||
if( isWithinClass )
|
||||
return astFactory.createField( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
|
||||
|
||||
return astFactory.createVariable( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new BacktrackException();
|
||||
}
|
||||
throw new BacktrackException();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -147,8 +147,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
public IToken consume(int type) throws EndOfFileException, BacktrackException {
|
||||
if (LT(1) == type)
|
||||
return consume();
|
||||
else
|
||||
throw backtrack;
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -565,16 +564,14 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
declarator.addPointerOperator(ASTPointerOperator.RESTRICT_POINTER);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( extension.isValidCVModifier( language, IToken.t_restrict ))
|
||||
{
|
||||
result = consume( IToken.t_restrict );
|
||||
declarator.addPointerOperator( extension.getPointerOperator(language, IToken.t_restrict ));
|
||||
break;
|
||||
}
|
||||
throw backtrack;
|
||||
}
|
||||
if( extension.isValidCVModifier( language, IToken.t_restrict ))
|
||||
{
|
||||
result = consume( IToken.t_restrict );
|
||||
declarator.addPointerOperator( extension.getPointerOperator(language, IToken.t_restrict ));
|
||||
break;
|
||||
}
|
||||
throw backtrack;
|
||||
|
||||
|
||||
default :
|
||||
if( extension.isValidCVModifier( language, LT(1)))
|
||||
|
@ -925,8 +922,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throw backtrack;
|
||||
}
|
||||
}
|
||||
else
|
||||
return firstExpression;
|
||||
return firstExpression;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1199,52 +1195,49 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
backup(mark);
|
||||
return firstExpression;
|
||||
}
|
||||
else
|
||||
{
|
||||
IASTExpression.Kind expressionKind = null;
|
||||
switch (t.getType())
|
||||
{
|
||||
case IToken.tGT :
|
||||
expressionKind =
|
||||
IASTExpression.Kind.RELATIONAL_GREATERTHAN;
|
||||
break;
|
||||
case IToken.tLT :
|
||||
expressionKind = IASTExpression.Kind.RELATIONAL_LESSTHAN;
|
||||
break;
|
||||
case IToken.tLTEQUAL :
|
||||
expressionKind =
|
||||
IASTExpression
|
||||
.Kind
|
||||
.RELATIONAL_LESSTHANEQUALTO;
|
||||
break;
|
||||
case IToken.tGTEQUAL :
|
||||
expressionKind =
|
||||
IASTExpression
|
||||
.Kind
|
||||
.RELATIONAL_GREATERTHANEQUALTO;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
astFactory.createExpression(
|
||||
scope,
|
||||
expressionKind,
|
||||
firstExpression,
|
||||
secondExpression,
|
||||
null,
|
||||
null,
|
||||
null, EMPTY_STRING, null);
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw backtrack;
|
||||
} catch (Exception e)
|
||||
{
|
||||
logException( "relationalExpression::createExpression()", e ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
IASTExpression.Kind expressionKind = null;
|
||||
switch (t.getType())
|
||||
{
|
||||
case IToken.tGT :
|
||||
expressionKind =
|
||||
IASTExpression.Kind.RELATIONAL_GREATERTHAN;
|
||||
break;
|
||||
case IToken.tLT :
|
||||
expressionKind = IASTExpression.Kind.RELATIONAL_LESSTHAN;
|
||||
break;
|
||||
case IToken.tLTEQUAL :
|
||||
expressionKind =
|
||||
IASTExpression
|
||||
.Kind
|
||||
.RELATIONAL_LESSTHANEQUALTO;
|
||||
break;
|
||||
case IToken.tGTEQUAL :
|
||||
expressionKind =
|
||||
IASTExpression
|
||||
.Kind
|
||||
.RELATIONAL_GREATERTHANEQUALTO;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
astFactory.createExpression(
|
||||
scope,
|
||||
expressionKind,
|
||||
firstExpression,
|
||||
secondExpression,
|
||||
null,
|
||||
null,
|
||||
null, EMPTY_STRING, null);
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw backtrack;
|
||||
} catch (Exception e)
|
||||
{
|
||||
logException( "relationalExpression::createExpression()", e ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
if( extension.isValidRelationalExpressionStart(language, LT(1)))
|
||||
|
@ -2548,15 +2541,10 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
try
|
||||
{
|
||||
if( t instanceof INumericToken )
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
IASTExpression.Kind.PRIMARY_INTEGER_LITERAL,
|
||||
((INumericToken)t).getIntegerValue(), isHex);
|
||||
}
|
||||
else
|
||||
{
|
||||
return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, null, null, null, null, t.getImage(), null );
|
||||
}
|
||||
return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, null, null, null, null, t.getImage(), null );
|
||||
}
|
||||
catch (ASTSemanticException e1)
|
||||
{
|
||||
|
|
|
@ -267,62 +267,53 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
astUD.acceptElement(requestor);
|
||||
return astUD;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw backtrack;
|
||||
}
|
||||
throw backtrack;
|
||||
}
|
||||
boolean typeName = false;
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.POST_USING );
|
||||
|
||||
if (LT(1) == IToken.t_typename)
|
||||
{
|
||||
typeName = true;
|
||||
consume(IToken.t_typename);
|
||||
}
|
||||
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.NAMESPACE_ONLY );
|
||||
ITokenDuple name = null;
|
||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
// optional :: and nested classes handled in name
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE, Key.EMPTY);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean typeName = false;
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.POST_USING );
|
||||
|
||||
if (LT(1) == IToken.t_typename)
|
||||
{
|
||||
typeName = true;
|
||||
consume(IToken.t_typename);
|
||||
|
||||
}
|
||||
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.NAMESPACE_ONLY );
|
||||
ITokenDuple name = null;
|
||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
// optional :: and nested classes handled in name
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE, Key.EMPTY);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw backtrack;
|
||||
}
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
{
|
||||
IToken last = consume(IToken.tSEMI);
|
||||
IASTUsingDeclaration declaration = null;
|
||||
try
|
||||
{
|
||||
declaration =
|
||||
astFactory.createUsingDeclaration(
|
||||
scope,
|
||||
typeName,
|
||||
name,
|
||||
firstToken.getOffset(),
|
||||
firstToken.getLineNumber(), last.getEndOffset(), last.getLineNumber());
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
logException( "usingClause:createUsingDeclaration", e1 ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
declaration.acceptElement( requestor );
|
||||
setCompletionValues(scope, getCompletionKindForDeclaration(scope, null), Key.DECLARATION );
|
||||
return declaration;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw backtrack;
|
||||
}
|
||||
throw backtrack;
|
||||
}
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
{
|
||||
IToken last = consume(IToken.tSEMI);
|
||||
IASTUsingDeclaration declaration = null;
|
||||
try
|
||||
{
|
||||
declaration =
|
||||
astFactory.createUsingDeclaration(
|
||||
scope,
|
||||
typeName,
|
||||
name,
|
||||
firstToken.getOffset(),
|
||||
firstToken.getLineNumber(), last.getEndOffset(), last.getLineNumber());
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
logException( "usingClause:createUsingDeclaration", e1 ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
declaration.acceptElement( requestor );
|
||||
setCompletionValues(scope, getCompletionKindForDeclaration(scope, null), Key.DECLARATION );
|
||||
return declaration;
|
||||
}
|
||||
throw backtrack;
|
||||
|
||||
}
|
||||
/**
|
||||
* Implements Linkage specification in the ANSI C++ grammar.
|
||||
|
@ -391,27 +382,27 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
linkage.exitScope( requestor );
|
||||
return linkage;
|
||||
}
|
||||
else // single declaration
|
||||
{
|
||||
IASTLinkageSpecification linkage;
|
||||
try
|
||||
{
|
||||
linkage =
|
||||
astFactory.createLinkageSpecification(
|
||||
scope,
|
||||
spec.getImage(),
|
||||
firstToken.getOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logException( "linkageSpecification_2:createLinkageSpecification", e ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
linkage.enterScope( requestor );
|
||||
declaration(linkage, null, null);
|
||||
linkage.exitScope( requestor );
|
||||
return linkage;
|
||||
// single declaration
|
||||
|
||||
IASTLinkageSpecification linkage;
|
||||
try
|
||||
{
|
||||
linkage =
|
||||
astFactory.createLinkageSpecification(
|
||||
scope,
|
||||
spec.getImage(),
|
||||
firstToken.getOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logException( "linkageSpecification_2:createLinkageSpecification", e ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
linkage.enterScope( requestor );
|
||||
declaration(linkage, null, null);
|
||||
linkage.exitScope( requestor );
|
||||
return linkage;
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -464,36 +455,34 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
return templateInstantiation;
|
||||
}
|
||||
else
|
||||
consume(IToken.tLT);
|
||||
if (LT(1) == IToken.tGT)
|
||||
{
|
||||
consume(IToken.tLT);
|
||||
if (LT(1) == IToken.tGT)
|
||||
consume(IToken.tGT);
|
||||
// explicit-specialization
|
||||
|
||||
IASTTemplateSpecialization templateSpecialization;
|
||||
try
|
||||
{
|
||||
consume(IToken.tGT);
|
||||
// explicit-specialization
|
||||
|
||||
IASTTemplateSpecialization templateSpecialization;
|
||||
try
|
||||
{
|
||||
templateSpecialization =
|
||||
astFactory.createTemplateSpecialization(
|
||||
scope,
|
||||
firstToken.getOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logException( "templateDeclaration:createTemplateSpecialization", e ); //$NON-NLS-1$
|
||||
backup( mark );
|
||||
throw backtrack;
|
||||
}
|
||||
templateSpecialization.enterScope(requestor);
|
||||
declaration(templateSpecialization, templateSpecialization, null);
|
||||
templateSpecialization.setEndingOffsetAndLineNumber(
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber());
|
||||
templateSpecialization.exitScope(requestor);
|
||||
return templateSpecialization;
|
||||
templateSpecialization =
|
||||
astFactory.createTemplateSpecialization(
|
||||
scope,
|
||||
firstToken.getOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logException( "templateDeclaration:createTemplateSpecialization", e ); //$NON-NLS-1$
|
||||
backup( mark );
|
||||
throw backtrack;
|
||||
}
|
||||
templateSpecialization.enterScope(requestor);
|
||||
declaration(templateSpecialization, templateSpecialization, null);
|
||||
templateSpecialization.setEndingOffsetAndLineNumber(
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber());
|
||||
templateSpecialization.exitScope(requestor);
|
||||
return templateSpecialization;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1110,52 +1099,47 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
return declaration;
|
||||
}
|
||||
else
|
||||
{
|
||||
IASTDeclaration declaration = (IASTDeclaration)i.next();
|
||||
endDeclaration( declaration );
|
||||
declaration.enterScope( requestor );
|
||||
IASTDeclaration declaration = (IASTDeclaration)i.next();
|
||||
endDeclaration( declaration );
|
||||
declaration.enterScope( requestor );
|
||||
|
||||
if ( !( declaration instanceof IASTScope ) )
|
||||
throw backtrack;
|
||||
if ( !( declaration instanceof IASTScope ) )
|
||||
throw backtrack;
|
||||
|
||||
handleFunctionBody((IASTScope)declaration );
|
||||
((IASTOffsetableElement)declaration).setEndingOffsetAndLineNumber(
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber());
|
||||
handleFunctionBody((IASTScope)declaration );
|
||||
((IASTOffsetableElement)declaration).setEndingOffsetAndLineNumber(
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber());
|
||||
|
||||
declaration.exitScope( requestor );
|
||||
declaration.exitScope( requestor );
|
||||
|
||||
if( hasFunctionTryBlock )
|
||||
catchHandlerSequence( scope );
|
||||
if( hasFunctionTryBlock )
|
||||
catchHandlerSequence( scope );
|
||||
|
||||
return declaration;
|
||||
return declaration;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if( sdw.getTypeSpecifier() != null )
|
||||
{
|
||||
IASTAbstractTypeSpecifierDeclaration declaration = astFactory.createTypeSpecDeclaration(
|
||||
sdw.getScope(),
|
||||
sdw.getTypeSpecifier(),
|
||||
ownerTemplate,
|
||||
sdw.getStartingOffset(),
|
||||
sdw.getStartingLine(), lastToken.getEndOffset(), lastToken.getLineNumber(),
|
||||
sdw.isFriend());
|
||||
declaration.acceptElement(requestor);
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
logException( "simpleDeclaration:createTypeSpecDeclaration", e1 ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
try
|
||||
{
|
||||
if( sdw.getTypeSpecifier() != null )
|
||||
{
|
||||
IASTAbstractTypeSpecifierDeclaration declaration = astFactory.createTypeSpecDeclaration(
|
||||
sdw.getScope(),
|
||||
sdw.getTypeSpecifier(),
|
||||
ownerTemplate,
|
||||
sdw.getStartingOffset(),
|
||||
sdw.getStartingLine(), lastToken.getEndOffset(), lastToken.getLineNumber(),
|
||||
sdw.isFriend());
|
||||
declaration.acceptElement(requestor);
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
logException( "simpleDeclaration:createTypeSpecDeclaration", e1 ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -3203,9 +3187,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
protected void handleClassSpecifier( IASTClassSpecifier classSpecifier ) throws EndOfFileException
|
||||
{
|
||||
cleanupLastToken();
|
||||
if( classSpecifier instanceof IASTOffsetableNamedElement )
|
||||
handleOffsetableNamedElement( classSpecifier );
|
||||
|
||||
handleOffsetableNamedElement( classSpecifier );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,14 +41,12 @@ public class ParserMessages {
|
|||
* @return
|
||||
*/
|
||||
public static String getString(String key) {
|
||||
if( resourceBundle == null ){
|
||||
if( resourceBundle == null )
|
||||
return '#' + key +'#';
|
||||
} else {
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -154,22 +154,25 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
|
|||
|
||||
// case 3: 1 is null
|
||||
if( currentMacro == null )
|
||||
{
|
||||
if( currentDeclaration.getStartingOffset() < currentInclusion.getStartingOffset() )
|
||||
return updateDeclarationIterator();
|
||||
else
|
||||
return updateInclusionIterator();
|
||||
return updateInclusionIterator();
|
||||
}
|
||||
|
||||
if( currentInclusion == null )
|
||||
{
|
||||
if( currentDeclaration.getStartingOffset() < currentMacro.getStartingOffset() )
|
||||
return updateDeclarationIterator();
|
||||
else
|
||||
return updateMacroIterator();
|
||||
return updateMacroIterator();
|
||||
}
|
||||
|
||||
if( currentDeclaration == null )
|
||||
{
|
||||
if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() )
|
||||
return updateInclusionIterator();
|
||||
else
|
||||
return updateMacroIterator();
|
||||
return updateMacroIterator();
|
||||
}
|
||||
|
||||
// case 4: none are null
|
||||
if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() &&
|
||||
|
|
|
@ -496,12 +496,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
iterator.next();
|
||||
return pst.getCompilationUnit();
|
||||
}
|
||||
else
|
||||
{
|
||||
return scopeToSymbol(currentScope);
|
||||
}
|
||||
|
||||
|
||||
return scopeToSymbol(currentScope);
|
||||
}
|
||||
protected IContainerSymbol scopeToSymbol(IASTScope currentScope)
|
||||
{
|
||||
|
@ -935,9 +930,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
ASTNode referenced = (definition != null) ? definition : declaration;
|
||||
if( referenced instanceof IASTMethod )
|
||||
|
||||
return new ASTMethodReference( offset, referenceElementName, (IASTMethod)referenced );
|
||||
else
|
||||
return new ASTFunctionReference( offset, referenceElementName, (IASTFunction)referenced );
|
||||
return new ASTFunctionReference( offset, referenceElementName, (IASTFunction)referenced );
|
||||
}
|
||||
else if( ( symbol.getType() == TypeInfo.t_type ) ||
|
||||
( symbol.getType() == TypeInfo.t_bool )||
|
||||
|
@ -1279,9 +1274,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
// assert lhsInfo != null : "Malformed Expression";
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return startingScope;
|
||||
}
|
||||
return startingScope;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -56,11 +56,8 @@ public class BranchTracker {
|
|||
|
||||
return taken;
|
||||
}
|
||||
else
|
||||
{
|
||||
branches.push( FALSE );
|
||||
return false;
|
||||
}
|
||||
branches.push( FALSE );
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean queryCurrentBranchForElif()
|
||||
|
|
|
@ -400,8 +400,7 @@ public class Scanner implements IScanner {
|
|||
// multiline comment
|
||||
if (skipOverMultilineComment())
|
||||
break;
|
||||
else
|
||||
c = getChar( true );
|
||||
c = getChar( true );
|
||||
continue;
|
||||
} else {
|
||||
// we are not in a comment
|
||||
|
@ -851,13 +850,8 @@ public class Scanner implements IScanner {
|
|||
{
|
||||
c = getChar();
|
||||
if( c == '#' )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetChar( c );
|
||||
}
|
||||
ungetChar( c );
|
||||
}
|
||||
|
||||
ungetChar( c );
|
||||
|
@ -922,11 +916,8 @@ public class Scanner implements IScanner {
|
|||
// consume \ \r \n and then continue
|
||||
return getChar(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// consume the \ \r and then continue
|
||||
return c;
|
||||
}
|
||||
// consume the \ \r and then continue
|
||||
return c;
|
||||
}
|
||||
|
||||
if (c == '\n')
|
||||
|
@ -1024,8 +1015,7 @@ public class Scanner implements IScanner {
|
|||
} else if( c == '.' ){
|
||||
if( getChar() == '.' )
|
||||
return newConstantToken( IToken.tELLIPSIS );
|
||||
else
|
||||
handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true );
|
||||
handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true );
|
||||
} else {
|
||||
ungetChar( c );
|
||||
return newConstantToken( IToken.tDOT );
|
||||
|
@ -1502,8 +1492,7 @@ public class Scanner implements IScanner {
|
|||
if( buff == null ) return null;
|
||||
continue; // back to top of loop
|
||||
}
|
||||
else
|
||||
ungetChar( next );
|
||||
ungetChar( next );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1540,12 +1529,9 @@ public class Scanner implements IScanner {
|
|||
|
||||
if (tokenTypeObject != null)
|
||||
return newConstantToken(((Integer) tokenTypeObject).intValue());
|
||||
else
|
||||
{
|
||||
if( scannerExtension.isExtensionKeyword( scannerData.getLanguage(), ident ) )
|
||||
return newExtensionToken( scannerExtension.createExtensionToken(scannerData, ident ));
|
||||
return newToken(IToken.tIDENTIFIER, ident);
|
||||
}
|
||||
if( scannerExtension.isExtensionKeyword( scannerData.getLanguage(), ident ) )
|
||||
return newExtensionToken( scannerExtension.createExtensionToken(scannerData, ident ));
|
||||
return newToken(IToken.tIDENTIFIER, ident);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2023,22 +2009,16 @@ public class Scanner implements IScanner {
|
|||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
token = processKeywordOrIdentifier( secondBuffer, pasting );
|
||||
if (token == null)
|
||||
{
|
||||
token = processKeywordOrIdentifier( secondBuffer, pasting );
|
||||
if (token == null)
|
||||
{
|
||||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
return token;
|
||||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetChar( next );
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, ucnBuffer.toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
}
|
||||
ungetChar( next );
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, ucnBuffer.toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
}
|
||||
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, new Character( (char)c ).toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
|
@ -2259,11 +2239,10 @@ public class Scanner implements IScanner {
|
|||
{
|
||||
return newToken( IToken.tSTRING, buff.toString());
|
||||
|
||||
} else {
|
||||
handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true );
|
||||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true );
|
||||
c = getChar();
|
||||
continue;
|
||||
|
||||
} else {
|
||||
switch (c) {
|
||||
|
@ -2776,15 +2755,14 @@ public class Scanner implements IScanner {
|
|||
if( c == '\n' ){
|
||||
c = getChar();
|
||||
continue;
|
||||
} else {
|
||||
StringBuffer potentialErrorMessage = new StringBuffer( POUND_DEFINE );
|
||||
ungetChar( c );
|
||||
potentialErrorMessage.append( buffer );
|
||||
potentialErrorMessage.append( '\\');
|
||||
potentialErrorMessage.append( (char)c );
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, potentialErrorMessage.toString(), beginning, false, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
StringBuffer potentialErrorMessage = new StringBuffer( POUND_DEFINE );
|
||||
ungetChar( c );
|
||||
potentialErrorMessage.append( buffer );
|
||||
potentialErrorMessage.append( '\\');
|
||||
potentialErrorMessage.append( (char)c );
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, potentialErrorMessage.toString(), beginning, false, true);
|
||||
return;
|
||||
} else if( c == '\r' || c == '\n' || c == NOCHAR ){
|
||||
StringBuffer potentialErrorMessage = new StringBuffer( POUND_DEFINE );
|
||||
potentialErrorMessage.append( buffer );
|
||||
|
@ -3110,31 +3088,31 @@ public class Scanner implements IScanner {
|
|||
if( index == -1 ){
|
||||
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, expansion.getName(), getCurrentOffset(), false, true );
|
||||
return;
|
||||
} else {
|
||||
buffer.append('\"');
|
||||
String value = (String)parameterValuesForStringizing.elementAt(index);
|
||||
char val [] = value.toCharArray();
|
||||
char ch;
|
||||
int length = value.length();
|
||||
for( int j = 0; j < length; j++ ){
|
||||
ch = val[j];
|
||||
if( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
|
||||
//Each occurance of whitespace becomes a single space character
|
||||
while( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
|
||||
ch = val[++j];
|
||||
}
|
||||
buffer.append(' ');
|
||||
}
|
||||
//a \ character is inserted before each " and \
|
||||
if( ch == '\"' || ch == '\\' ){
|
||||
buffer.append('\\');
|
||||
buffer.append(ch);
|
||||
} else {
|
||||
buffer.append(ch);
|
||||
}
|
||||
buffer.append('\"');
|
||||
String value = (String)parameterValuesForStringizing.elementAt(index);
|
||||
char val [] = value.toCharArray();
|
||||
char ch;
|
||||
int length = value.length();
|
||||
for( int j = 0; j < length; j++ ){
|
||||
ch = val[j];
|
||||
if( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
|
||||
//Each occurance of whitespace becomes a single space character
|
||||
while( ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' ){
|
||||
ch = val[++j];
|
||||
}
|
||||
buffer.append(' ');
|
||||
}
|
||||
//a \ character is inserted before each " and \
|
||||
if( ch == '\"' || ch == '\\' ){
|
||||
buffer.append('\\');
|
||||
buffer.append(ch);
|
||||
} else {
|
||||
buffer.append(ch);
|
||||
}
|
||||
buffer.append('\"');
|
||||
}
|
||||
buffer.append('\"');
|
||||
|
||||
} else {
|
||||
switch( t.getType() )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue