mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core<BR>
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59179<BR> Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59143<BR> org.eclipse.cdt.core.tests<BR> Updated test clients for IExpressionParser interface changes. <BR> Added QuickParseASTTests.testBug59179().
This commit is contained in:
parent
0634c0b3a2
commit
1a5788e0dc
16 changed files with 284 additions and 225 deletions
|
@ -1,3 +1,7 @@
|
|||
2004-04-22 John Camelon
|
||||
Updated test clients for IExpressionParser interface changes.
|
||||
Added QuickParseASTTests.testBug59179().
|
||||
|
||||
2004-04-22 Andrew Niefer
|
||||
- added parser/CompleteParseASTTemplateTest.test_14_7_3__12_ExplicitSpecializationOverloadedFunction()
|
||||
- added parser/CompleteParseASTTemplateTest.testPartialSpecializationDefinitions()
|
||||
|
|
|
@ -731,7 +731,7 @@ public class CompletionParseTest extends CompleteParseBaseTest {
|
|||
String stringToCompleteAfter = ( i == 0 ) ? "::" : "::A";
|
||||
IASTCompletionNode node = parse( code, code.indexOf( stringToCompleteAfter) + stringToCompleteAfter.length() );
|
||||
|
||||
validateCompletionNode(node, ( i == 0 ? "" : "A"), IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE, getCompilationUnit() );
|
||||
validateCompletionNode(node, ( i == 0 ? "" : "A"), IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE, getCompilationUnit(), false );
|
||||
|
||||
ILookupResult result = node.getCompletionScope().lookup( node.getCompletionPrefix(),
|
||||
new IASTNode.LookupKind[]{ IASTNode.LookupKind.ALL },
|
||||
|
@ -772,13 +772,17 @@ public class CompletionParseTest extends CompleteParseBaseTest {
|
|||
|
||||
/**
|
||||
* @param node
|
||||
* @param hasKeywords TODO
|
||||
*/
|
||||
protected void validateCompletionNode(IASTCompletionNode node, String prefix, CompletionKind kind, IASTNode context ) {
|
||||
protected void validateCompletionNode(IASTCompletionNode node, String prefix, CompletionKind kind, IASTNode context, boolean hasKeywords ) {
|
||||
assertNotNull( node );
|
||||
assertEquals( node.getCompletionPrefix(), prefix);
|
||||
assertEquals( node.getCompletionKind(), kind );
|
||||
assertEquals( node.getCompletionContext(), context );
|
||||
assertFalse( node.getKeywords().hasNext() );
|
||||
if( hasKeywords )
|
||||
assertTrue( node.getKeywords().hasNext() );
|
||||
else
|
||||
assertFalse( node.getKeywords().hasNext() );
|
||||
}
|
||||
|
||||
public void testCompletionInFunctionBodyQualifiedName() throws Exception
|
||||
|
@ -811,7 +815,7 @@ public class CompletionParseTest extends CompleteParseBaseTest {
|
|||
assertNotNull( namespaceDefinition );
|
||||
validateCompletionNode( node,
|
||||
( j == 0 ) ? "" : "D",
|
||||
IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE, namespaceDefinition );
|
||||
IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE, namespaceDefinition, false );
|
||||
|
||||
ILookupResult result = node.getCompletionScope().lookup( node.getCompletionPrefix(),
|
||||
new IASTNode.LookupKind[]{ IASTNode.LookupKind.ALL },
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ExprEvalTest extends TestCase {
|
|||
|
||||
final NullSourceElementRequestor nullCallback = new NullSourceElementRequestor();
|
||||
IExpressionParser parser = InternalParserUtil.createExpressionParser(ParserFactory.createScanner( new StringReader( code ), getClass().getName(), new ScannerInfo(), null, ParserLanguage.CPP, nullCallback, new NullLogService(), null ), ParserLanguage.CPP, null );
|
||||
IASTExpression expression = parser.expression(null,null);
|
||||
IASTExpression expression = parser.expression(null,null, null);
|
||||
assertEquals(expectedValue, expression.evaluateExpression());
|
||||
}
|
||||
|
||||
|
|
|
@ -2213,5 +2213,11 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
{
|
||||
parse("int c = a >? b;");
|
||||
}
|
||||
|
||||
public void testBug59179() throws Exception
|
||||
{
|
||||
Iterator i = parse( "class __decl main{ int main; };", true, false ).getDeclarations();
|
||||
assertFalse( i.hasNext() );
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
2004-04-22 John Camelon
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59179
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59143
|
||||
|
||||
2004-04-22 Andrew Niefer
|
||||
- modify how ASTTemplateDeclaration.getOwnedDeclaration works
|
||||
- fix bug in TemplateEngine.selectTemplateFunctions()
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
import org.eclipse.cdt.internal.core.parser.DeclarationWrapper;
|
||||
import org.eclipse.cdt.internal.core.parser.IParserData;
|
||||
import org.eclipse.cdt.internal.core.parser.Parser;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -29,10 +31,10 @@ public interface IParserExtension {
|
|||
public ASTPointerOperator getPointerOperator( ParserLanguage language, int tokenType );
|
||||
|
||||
public boolean isValidUnaryExpressionStart( int tokenType );
|
||||
public IASTExpression parseUnaryExpression( IASTScope scope, IParserData data, CompletionKind kind );
|
||||
public IASTExpression parseUnaryExpression( IASTScope scope, IParserData data, CompletionKind kind, Key key );
|
||||
|
||||
public boolean isValidRelationalExpressionStart( ParserLanguage language, int tokenType );
|
||||
public IASTExpression parseRelationalExpression( IASTScope scope, IParserData data, CompletionKind kind, IASTExpression lhsExpression );
|
||||
public IASTExpression parseRelationalExpression( IASTScope scope, IParserData data, CompletionKind kind, Key key, IASTExpression lhsExpression );
|
||||
/**
|
||||
* @param i
|
||||
* @return
|
||||
|
@ -49,7 +51,8 @@ public interface IParserExtension {
|
|||
* @param parser
|
||||
* @param flags
|
||||
* @param sdw
|
||||
* @param key TODO
|
||||
* @return TODO
|
||||
*/
|
||||
public IDeclSpecifierExtensionResult handleDeclSpecifierSequence(IParserData parser, Parser.Flags flags, DeclarationWrapper sdw, CompletionKind kind );
|
||||
public IDeclSpecifierExtensionResult parseDeclSpecifierSequence(IParserData parser, Parser.Flags flags, DeclarationWrapper sdw, CompletionKind kind, Key key );
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class CompletionParser extends ContextualParser implements IParser {
|
|||
else
|
||||
kind = CompletionKind.VARIABLE_TYPE;
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
protected void catchHandlerSequence(IASTScope scope)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
|
@ -142,7 +142,7 @@ public class CompletionParser extends ContextualParser implements IParser {
|
|||
if( LT(1) == IToken.tELLIPSIS )
|
||||
consume( IToken.tELLIPSIS );
|
||||
else
|
||||
simpleDeclarationStrategyUnion( scope, null, CompletionKind.EXCEPTION_REFERENCE); // was exceptionDeclaration
|
||||
simpleDeclarationStrategyUnion( scope, null, CompletionKind.EXCEPTION_REFERENCE, Key.DECLARATION); // was exceptionDeclaration
|
||||
consume(IToken.tRPAREN);
|
||||
|
||||
catchBlockCompoundStatement(scope);
|
||||
|
|
|
@ -155,10 +155,10 @@ public class ContextualParser extends CompleteParser {
|
|||
|
||||
|
||||
|
||||
protected void setCompletionValues( IASTScope scope, CompletionKind kind, IToken first, IToken last ) throws EndOfFileException{
|
||||
protected void setCompletionValues( IASTScope scope, CompletionKind kind, IToken first, IToken last, Key key ) throws EndOfFileException{
|
||||
setCompletionScope( scope );
|
||||
setCompletionKind( kind );
|
||||
setCompletionKeywords( Key.EMPTY );
|
||||
setCompletionKeywords(key);
|
||||
ITokenDuple duple = new TokenDuple( first, last );
|
||||
try {
|
||||
setCompletionContext( astFactory.lookupSymbolInContext( scope, duple ) );
|
||||
|
@ -229,4 +229,16 @@ public class ContextualParser extends CompleteParser {
|
|||
else
|
||||
skipOverCompoundStatement();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.ExpressionParser#setCompletionValuesNoContext(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind, org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key)
|
||||
*/
|
||||
protected void setCompletionValuesNoContext(IASTScope scope,
|
||||
CompletionKind kind, Key key) throws EndOfFileException {
|
||||
setCompletionScope(scope);
|
||||
setCompletionKeywords(key);
|
||||
setCompletionKind(kind);
|
||||
checkEndOfFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.BacktrackException;
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
|
||||
|
@ -382,6 +383,8 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
if( isFunction)
|
||||
return createMethodASTNode(declarator, false);
|
||||
else
|
||||
if( declarator.hasFunctionBody() )
|
||||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createFieldASTNode(declarator, false );
|
||||
}
|
||||
else
|
||||
|
@ -389,6 +392,8 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, false);
|
||||
else
|
||||
if( declarator.hasFunctionBody() )
|
||||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createVariableASTNode(declarator, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
if( ! completedArg ){
|
||||
try{
|
||||
expression = assignmentExpression( scope, CompletionKind.VARIABLE_TYPE );
|
||||
expression = assignmentExpression( scope, CompletionKind.VARIABLE_TYPE, Key.EXPRESSION );
|
||||
if( expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_EMPTY ){
|
||||
throw backtrack;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
if( !completedArg ){
|
||||
try{
|
||||
ITokenDuple nameDuple = name( scope, null );
|
||||
ITokenDuple nameDuple = name( scope, null, Key.EMPTY );
|
||||
expression = astFactory.createExpression( scope, IASTExpression.Kind.ID_EXPRESSION,
|
||||
null, null, null, null, nameDuple, EMPTY_STRING, null);
|
||||
list.add( expression );
|
||||
|
@ -369,7 +369,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @throws BacktrackException request a backtrack
|
||||
*/
|
||||
protected IToken templateId(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
ITokenDuple duple = name(scope, kind );
|
||||
ITokenDuple duple = name(scope, kind, Key.EMPTY );
|
||||
//IToken last = consumeTemplateParameters(duple.getLastToken());
|
||||
return duple.getLastToken();//last;
|
||||
}
|
||||
|
@ -384,9 +384,10 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* : IDENTIFER
|
||||
* : template-id
|
||||
*
|
||||
* @param key TODO
|
||||
* @throws BacktrackException request a backtrack
|
||||
*/
|
||||
protected ITokenDuple name(IASTScope scope, IASTCompletionNode.CompletionKind kind ) throws BacktrackException, EndOfFileException {
|
||||
protected ITokenDuple name(IASTScope scope, IASTCompletionNode.CompletionKind kind, Key key ) throws BacktrackException, EndOfFileException {
|
||||
|
||||
IToken first = LA(1);
|
||||
IToken last = null;
|
||||
|
@ -414,9 +415,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
if( startsWithColonColon )
|
||||
setCompletionValues( scope, kind, getCompliationUnit() );
|
||||
else if( prev != null )
|
||||
setCompletionValues(scope, kind, first, prev );
|
||||
setCompletionValues(scope, kind, first, prev, Key.EMPTY );
|
||||
else
|
||||
setCompletionValues(scope, kind );
|
||||
setCompletionValuesNoContext(scope, kind, key );
|
||||
|
||||
last = consumeTemplateArguments(scope, last, argumentList);
|
||||
if( last.getType() == IToken.tGT )
|
||||
|
@ -432,7 +433,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
{
|
||||
IToken prev = last;
|
||||
last = consume(IToken.tCOLONCOLON);
|
||||
setCompletionValues( scope, kind, first, prev );
|
||||
setCompletionValues( scope, kind, first, prev, Key.EMPTY );
|
||||
|
||||
if (queryLookaheadCapability() && LT(1) == IToken.t_template)
|
||||
consume();
|
||||
|
@ -448,7 +449,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tIDENTIFIER :
|
||||
prev = last;
|
||||
last = consume();
|
||||
setCompletionValues( scope, kind, first, prev );
|
||||
setCompletionValues( scope, kind, first, prev, Key.EMPTY );
|
||||
last = consumeTemplateArguments(scope, last, argumentList);
|
||||
if( last.getType() == IToken.tGT )
|
||||
hasTemplateId = true;
|
||||
|
@ -461,6 +462,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scope
|
||||
* @param kind
|
||||
* @param key
|
||||
*/
|
||||
protected void setCompletionValuesNoContext(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException {
|
||||
}
|
||||
/**
|
||||
* @param tokenDuple
|
||||
*/
|
||||
|
@ -586,7 +594,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IASTExpression exp = null;
|
||||
if (LT(1) != IToken.tRBRACKET)
|
||||
{
|
||||
exp = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
exp = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
}
|
||||
consume(IToken.tRBRACKET);
|
||||
IASTArrayModifier arrayMod;
|
||||
|
@ -686,7 +694,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
{
|
||||
try
|
||||
{
|
||||
nameDuple = name(d.getScope(), CompletionKind.USER_SPECIFIED_NAME );
|
||||
nameDuple = name(d.getScope(), CompletionKind.USER_SPECIFIED_NAME, Key.EMPTY );
|
||||
}
|
||||
catch( BacktrackException bt )
|
||||
{
|
||||
|
@ -724,16 +732,16 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression constantExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
return conditionalExpression(scope,kind);
|
||||
protected IASTExpression constantExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
return conditionalExpression(scope,kind,key);
|
||||
}
|
||||
|
||||
public IASTExpression expression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,kind);
|
||||
public IASTExpression expression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,kind,key);
|
||||
while (LT(1) == IToken.tCOMMA)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = assignmentExpression(scope,kind);
|
||||
IASTExpression secondExpression = assignmentExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
assignmentExpression =
|
||||
|
@ -762,12 +770,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression assignmentExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression assignmentExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
setCompletionValues(scope, kind, Key.EXPRESSION );
|
||||
if (LT(1) == IToken.t_throw) {
|
||||
return throwExpression(scope);
|
||||
return throwExpression(scope,key);
|
||||
}
|
||||
IASTExpression conditionalExpression = conditionalExpression(scope,kind);
|
||||
IASTExpression conditionalExpression = conditionalExpression(scope,kind,key);
|
||||
// if the condition not taken, try assignment operators
|
||||
if (conditionalExpression != null
|
||||
&& conditionalExpression.getExpressionKind()
|
||||
|
@ -778,57 +786,57 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_NORMAL,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tSTARASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MULT,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tDIVASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_DIV,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tMODASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MOD,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tPLUSASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_PLUS,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tMINUSASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_MINUS,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tSHIFTRASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_RSHIFT,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tSHIFTLASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_LSHIFT,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tAMPERASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_AND,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tXORASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_XOR,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
case IToken.tBITORASSIGN :
|
||||
return assignmentOperatorExpression(
|
||||
scope,
|
||||
IASTExpression.Kind.ASSIGNMENTEXPRESSION_OR,
|
||||
conditionalExpression, kind);
|
||||
conditionalExpression, kind,key);
|
||||
}
|
||||
return conditionalExpression;
|
||||
}
|
||||
|
@ -837,13 +845,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression throwExpression(IASTScope scope) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression throwExpression(IASTScope scope, Key key) throws EndOfFileException, BacktrackException {
|
||||
consume(IToken.t_throw);
|
||||
setCompletionValues( scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
IASTExpression throwExpression = null;
|
||||
try
|
||||
{
|
||||
throwExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
throwExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
}
|
||||
catch (BacktrackException b)
|
||||
{
|
||||
|
@ -874,14 +882,14 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @return
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression conditionalExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = logicalOrExpression(scope,kind);
|
||||
protected IASTExpression conditionalExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = logicalOrExpression(scope,kind,key);
|
||||
if (LT(1) == IToken.tQUESTION)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = expression(scope,kind);
|
||||
IASTExpression secondExpression = expression(scope,kind, key);
|
||||
consume(IToken.tCOLON);
|
||||
IASTExpression thirdExpression = assignmentExpression(scope,kind);
|
||||
IASTExpression thirdExpression = assignmentExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
|
@ -910,12 +918,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression logicalOrExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = logicalAndExpression(scope,kind);
|
||||
protected IASTExpression logicalOrExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = logicalAndExpression(scope,kind,key);
|
||||
while (LT(1) == IToken.tOR)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = logicalAndExpression(scope,kind);
|
||||
IASTExpression secondExpression = logicalAndExpression(scope,kind,key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -945,12 +953,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression logicalAndExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = inclusiveOrExpression( scope,kind );
|
||||
protected IASTExpression logicalAndExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = inclusiveOrExpression( scope,kind,key );
|
||||
while (LT(1) == IToken.tAND)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = inclusiveOrExpression( scope,kind );
|
||||
IASTExpression secondExpression = inclusiveOrExpression( scope,kind,key );
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
|
@ -979,12 +987,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression inclusiveOrExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = exclusiveOrExpression(scope,kind);
|
||||
protected IASTExpression inclusiveOrExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = exclusiveOrExpression(scope,kind,key);
|
||||
while (LT(1) == IToken.tBITOR)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = exclusiveOrExpression(scope,kind);
|
||||
IASTExpression secondExpression = exclusiveOrExpression(scope,kind,key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1014,13 +1022,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression exclusiveOrExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = andExpression( scope,kind );
|
||||
protected IASTExpression exclusiveOrExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = andExpression( scope,kind, key );
|
||||
while (LT(1) == IToken.tXOR)
|
||||
{
|
||||
consume();
|
||||
|
||||
IASTExpression secondExpression = andExpression( scope,kind );
|
||||
IASTExpression secondExpression = andExpression( scope,kind, key );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1050,12 +1058,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression andExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = equalityExpression(scope,kind);
|
||||
protected IASTExpression andExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = equalityExpression(scope,kind, key);
|
||||
while (LT(1) == IToken.tAMPER)
|
||||
{
|
||||
consume();
|
||||
IASTExpression secondExpression = equalityExpression(scope,kind);
|
||||
IASTExpression secondExpression = equalityExpression(scope,kind, key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1106,8 +1114,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression equalityExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = relationalExpression(scope,kind);
|
||||
protected IASTExpression equalityExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = relationalExpression(scope,kind,key);
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1116,7 +1124,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tNOTEQUAL :
|
||||
IToken t = consume();
|
||||
IASTExpression secondExpression =
|
||||
relationalExpression(scope,kind);
|
||||
relationalExpression(scope,kind,key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1151,8 +1159,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression relationalExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = shiftExpression(scope,kind);
|
||||
protected IASTExpression relationalExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = shiftExpression(scope,kind, key);
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1168,7 +1176,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IToken next = LA(1);
|
||||
IASTExpression secondExpression =
|
||||
shiftExpression(scope,kind);
|
||||
shiftExpression(scope,kind, key);
|
||||
if (next == LA(1))
|
||||
{
|
||||
// we did not consume anything
|
||||
|
@ -1226,7 +1234,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
default :
|
||||
if( extension.isValidRelationalExpressionStart(language, LT(1)))
|
||||
{
|
||||
IASTExpression extensionExpression = extension.parseRelationalExpression(scope, this, kind, firstExpression );
|
||||
IASTExpression extensionExpression = extension.parseRelationalExpression(scope, this, kind, key, firstExpression );
|
||||
if( extensionExpression != null ) return extensionExpression;
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -1238,8 +1246,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
public IASTExpression shiftExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = additiveExpression(scope,kind);
|
||||
public IASTExpression shiftExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = additiveExpression(scope,kind,key);
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1248,7 +1256,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tSHIFTR :
|
||||
IToken t = consume();
|
||||
IASTExpression secondExpression =
|
||||
additiveExpression(scope,kind);
|
||||
additiveExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
|
@ -1282,8 +1290,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression additiveExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = multiplicativeExpression( scope, kind );
|
||||
protected IASTExpression additiveExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = multiplicativeExpression( scope, kind, key );
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1292,7 +1300,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tMINUS :
|
||||
IToken t = consume();
|
||||
IASTExpression secondExpression =
|
||||
multiplicativeExpression(scope,kind);
|
||||
multiplicativeExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
|
@ -1326,8 +1334,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression multiplicativeExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = pmExpression(scope,kind);
|
||||
protected IASTExpression multiplicativeExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException {
|
||||
IASTExpression firstExpression = pmExpression(scope,kind,key);
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1336,7 +1344,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tDIV :
|
||||
case IToken.tMOD :
|
||||
IToken t = consume();
|
||||
IASTExpression secondExpression = pmExpression(scope,kind);
|
||||
IASTExpression secondExpression = pmExpression(scope,kind,key);
|
||||
IASTExpression.Kind expressionKind = null;
|
||||
switch (t.getType())
|
||||
{
|
||||
|
@ -1381,8 +1389,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression pmExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = castExpression(scope,kind);
|
||||
protected IASTExpression pmExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = castExpression(scope,kind,key);
|
||||
for (;;)
|
||||
{
|
||||
switch (LT(1))
|
||||
|
@ -1391,7 +1399,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tARROWSTAR :
|
||||
IToken t = consume();
|
||||
IASTExpression secondExpression =
|
||||
castExpression(scope,kind);
|
||||
castExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
firstExpression =
|
||||
|
@ -1426,7 +1434,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* : unaryExpression
|
||||
* | "(" typeId ")" castExpression
|
||||
*/
|
||||
protected IASTExpression castExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression castExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
// TO DO: we need proper symbol checkint to ensure type name
|
||||
if (LT(1) == IToken.tLPAREN)
|
||||
{
|
||||
|
@ -1441,7 +1449,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
typeId = typeId(scope, false, ((kind == CompletionKind.SINGLE_NAME_REFERENCE )? kind : CompletionKind.TYPE_REFERENCE));
|
||||
consume(IToken.tRPAREN);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); popped = true;}
|
||||
IASTExpression castExpression = castExpression(scope,kind);
|
||||
IASTExpression castExpression = castExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
|
@ -1468,7 +1476,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
if( templateIdScopes != null && !popped ){ templateIdScopes.pop(); }
|
||||
}
|
||||
}
|
||||
return unaryExpression(scope,kind);
|
||||
return unaryExpression(scope,kind, key);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1498,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
{
|
||||
try
|
||||
{
|
||||
name = name(scope, completionKind );
|
||||
name = name(scope, completionKind, Key.EMPTY );
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
break;
|
||||
}
|
||||
|
@ -1537,7 +1545,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tIDENTIFIER :
|
||||
if( encounteredType ) break simpleMods;
|
||||
encounteredType = true;
|
||||
name = name(scope, completionKind );
|
||||
name = name(scope, completionKind, Key.EMPTY );
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
break;
|
||||
|
||||
|
@ -1621,7 +1629,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
consume();
|
||||
try
|
||||
{
|
||||
name = name(scope, completionKind );
|
||||
name = name(scope, completionKind, Key.EMPTY );
|
||||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
} catch( BacktrackException b )
|
||||
{
|
||||
|
@ -1674,7 +1682,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression deleteExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression deleteExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
if (LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
// global scope
|
||||
|
@ -1691,7 +1699,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
consume(IToken.tRBRACKET);
|
||||
vectored = true;
|
||||
}
|
||||
IASTExpression castExpression = castExpression(scope,kind);
|
||||
IASTExpression castExpression = castExpression(scope,kind,key);
|
||||
try
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
|
@ -1731,7 +1739,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* directnewdeclarator [ constantexpression ]
|
||||
* newinitializer: ( expressionlist? )
|
||||
*/
|
||||
protected IASTExpression newExpression(IASTScope scope) throws BacktrackException, EndOfFileException {
|
||||
protected IASTExpression newExpression(IASTScope scope, Key key) throws BacktrackException, EndOfFileException {
|
||||
setCompletionValues(scope, CompletionKind.NEW_TYPE_REFERENCE, Key.EMPTY);
|
||||
if (LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
|
@ -1757,7 +1765,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
// Try to consume placement list
|
||||
// Note: since expressionList and expression are the same...
|
||||
backtrackMarker = mark();
|
||||
newPlacementExpressions.add(expression(scope, CompletionKind.SINGLE_NAME_REFERENCE));
|
||||
newPlacementExpressions.add(expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, key));
|
||||
consume(IToken.tRPAREN);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); } //pop 1st Parent
|
||||
placementParseFailure = false;
|
||||
|
@ -1883,7 +1891,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLBRACKET ) ); }
|
||||
|
||||
newTypeIdExpressions.add(assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE));
|
||||
newTypeIdExpressions.add(assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE,key));
|
||||
consume(IToken.tRBRACKET);
|
||||
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
|
@ -1897,7 +1905,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||
|
||||
if ( queryLookaheadCapability() && (LT(1) != IToken.tRPAREN))
|
||||
newInitializerExpressions.add(expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE));
|
||||
newInitializerExpressions.add(expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE, key));
|
||||
|
||||
setCurrentFunctionName( EMPTY_STRING );
|
||||
consume(IToken.tRPAREN);
|
||||
|
@ -1932,41 +1940,41 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
public IASTExpression unaryExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
public IASTExpression unaryExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
switch (LT(1))
|
||||
{
|
||||
case IToken.tSTAR :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_STAR_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_STAR_CASTEXPRESSION,kind,key);
|
||||
case IToken.tAMPER :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_AMPSND_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_AMPSND_CASTEXPRESSION,kind,key);
|
||||
case IToken.tPLUS :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_PLUS_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_PLUS_CASTEXPRESSION,kind,key);
|
||||
case IToken.tMINUS :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_MINUS_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_MINUS_CASTEXPRESSION,kind,key);
|
||||
case IToken.tNOT :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_NOT_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_NOT_CASTEXPRESSION,kind,key);
|
||||
case IToken.tCOMPL :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_TILDE_CASTEXPRESSION,kind);
|
||||
IASTExpression.Kind.UNARY_TILDE_CASTEXPRESSION,kind,key);
|
||||
case IToken.tINCR :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_INCREMENT,kind);
|
||||
IASTExpression.Kind.UNARY_INCREMENT,kind,key);
|
||||
case IToken.tDECR :
|
||||
consume();
|
||||
return unaryOperatorCastExpression(scope,
|
||||
IASTExpression.Kind.UNARY_DECREMENT,kind);
|
||||
IASTExpression.Kind.UNARY_DECREMENT,kind,key);
|
||||
case IToken.t_sizeof :
|
||||
consume(IToken.t_sizeof);
|
||||
IToken mark = LA(1);
|
||||
|
@ -1983,12 +1991,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
catch (BacktrackException bt)
|
||||
{
|
||||
backup(mark);
|
||||
unaryExpression = unaryExpression(scope,kind);
|
||||
unaryExpression = unaryExpression(scope,kind, key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unaryExpression = unaryExpression(scope,kind);
|
||||
unaryExpression = unaryExpression(scope,kind, key);
|
||||
}
|
||||
if (d != null & unaryExpression == null)
|
||||
try
|
||||
|
@ -2033,29 +2041,29 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
else
|
||||
throw backtrack;
|
||||
case IToken.t_new :
|
||||
return newExpression(scope);
|
||||
return newExpression(scope,key);
|
||||
case IToken.t_delete :
|
||||
return deleteExpression(scope,kind);
|
||||
return deleteExpression(scope,kind,key);
|
||||
case IToken.tCOLONCOLON :
|
||||
if( queryLookaheadCapability(2))
|
||||
{
|
||||
switch (LT(2))
|
||||
{
|
||||
case IToken.t_new :
|
||||
return newExpression(scope);
|
||||
return newExpression(scope,key);
|
||||
case IToken.t_delete :
|
||||
return deleteExpression(scope,kind);
|
||||
return deleteExpression(scope,kind,key);
|
||||
default :
|
||||
return postfixExpression(scope,kind);
|
||||
return postfixExpression(scope,kind,key);
|
||||
}
|
||||
}
|
||||
default :
|
||||
if( extension.isValidUnaryExpressionStart( LT(1)))
|
||||
{
|
||||
IASTExpression extensionExpression = extension.parseUnaryExpression(scope,this,kind);
|
||||
IASTExpression extensionExpression = extension.parseUnaryExpression(scope,this,kind, key);
|
||||
if( extensionExpression != null ) return extensionExpression;
|
||||
}
|
||||
return postfixExpression(scope,kind);
|
||||
return postfixExpression(scope,kind,key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2071,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression postfixExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression postfixExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression firstExpression = null;
|
||||
boolean isTemplate = false;
|
||||
|
||||
|
@ -2072,7 +2080,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
{
|
||||
case IToken.t_typename :
|
||||
consume(IToken.t_typename);
|
||||
ITokenDuple nestedName = name(scope, CompletionKind.TYPE_REFERENCE);
|
||||
ITokenDuple nestedName = name(scope, CompletionKind.TYPE_REFERENCE, Key.EMPTY);
|
||||
boolean templateTokenConsumed = false;
|
||||
if( LT(1) == IToken.t_template )
|
||||
{
|
||||
|
@ -2093,7 +2101,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
consume( IToken.tLPAREN );
|
||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||
IASTExpression expressionList = expression( scope, CompletionKind.TYPE_REFERENCE );
|
||||
IASTExpression expressionList = expression( scope, CompletionKind.TYPE_REFERENCE, key );
|
||||
consume( IToken.tRPAREN );
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
try {
|
||||
|
@ -2119,72 +2127,72 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.t_char :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_CHAR,key);
|
||||
break;
|
||||
case IToken.t_wchar_t :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_WCHART);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_WCHART,key);
|
||||
break;
|
||||
case IToken.t_bool :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_BOOL);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_BOOL,key);
|
||||
break;
|
||||
case IToken.t_short :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_SHORT);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_SHORT,key);
|
||||
break;
|
||||
case IToken.t_int :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_INT);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_INT,key);
|
||||
break;
|
||||
case IToken.t_long :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_LONG);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_LONG,key);
|
||||
break;
|
||||
case IToken.t_signed :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_SIGNED);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_SIGNED,key);
|
||||
break;
|
||||
case IToken.t_unsigned :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_UNSIGNED);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_UNSIGNED,key);
|
||||
break;
|
||||
case IToken.t_float :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_FLOAT);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_FLOAT,key);
|
||||
break;
|
||||
case IToken.t_double :
|
||||
firstExpression =
|
||||
simpleTypeConstructorExpression( scope,
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_DOUBLE);
|
||||
IASTExpression.Kind.POSTFIX_SIMPLETYPE_DOUBLE,key);
|
||||
break;
|
||||
case IToken.t_dynamic_cast :
|
||||
firstExpression =
|
||||
specialCastExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_DYNAMIC_CAST);
|
||||
IASTExpression.Kind.POSTFIX_DYNAMIC_CAST,key);
|
||||
break;
|
||||
case IToken.t_static_cast :
|
||||
firstExpression =
|
||||
specialCastExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_STATIC_CAST);
|
||||
IASTExpression.Kind.POSTFIX_STATIC_CAST,key);
|
||||
break;
|
||||
case IToken.t_reinterpret_cast :
|
||||
firstExpression =
|
||||
specialCastExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_REINTERPRET_CAST);
|
||||
IASTExpression.Kind.POSTFIX_REINTERPRET_CAST,key);
|
||||
break;
|
||||
case IToken.t_const_cast :
|
||||
firstExpression =
|
||||
specialCastExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_CONST_CAST);
|
||||
IASTExpression.Kind.POSTFIX_CONST_CAST,key);
|
||||
break;
|
||||
case IToken.t_typeid :
|
||||
consume();
|
||||
|
@ -2200,7 +2208,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
catch (BacktrackException b)
|
||||
{
|
||||
isTypeId = false;
|
||||
lhs = expression(scope, CompletionKind.TYPE_REFERENCE);
|
||||
lhs = expression(scope, CompletionKind.TYPE_REFERENCE, key);
|
||||
}
|
||||
consume(IToken.tRPAREN);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
|
@ -2229,7 +2237,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
break;
|
||||
default :
|
||||
firstExpression = primaryExpression(scope, kind);
|
||||
firstExpression = primaryExpression(scope, kind, key);
|
||||
}
|
||||
IASTExpression secondExpression = null;
|
||||
for (;;)
|
||||
|
@ -2240,7 +2248,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
// array access
|
||||
consume(IToken.tLBRACKET);
|
||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLBRACKET ) ); }
|
||||
secondExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
secondExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
consume(IToken.tRBRACKET);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
try
|
||||
|
@ -2283,7 +2291,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||
setCompletionValues(scope, CompletionKind.FUNCTION_REFERENCE, context );
|
||||
secondExpression = expression(scope, CompletionKind.FUNCTION_REFERENCE);
|
||||
secondExpression = expression(scope, CompletionKind.FUNCTION_REFERENCE, key);
|
||||
setCurrentFunctionName( EMPTY_STRING );
|
||||
consume(IToken.tRPAREN);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
|
@ -2370,7 +2378,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate );
|
||||
|
||||
secondExpression = primaryExpression(scope, CompletionKind.MEMBER_REFERENCE);
|
||||
secondExpression = primaryExpression(scope, CompletionKind.MEMBER_REFERENCE, key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -2408,7 +2416,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
|
||||
setCompletionValues(scope, CompletionKind.MEMBER_REFERENCE, KeywordSets.Key.EMPTY, firstExpression, isTemplate );
|
||||
secondExpression = primaryExpression(scope, CompletionKind.MEMBER_REFERENCE);
|
||||
secondExpression = primaryExpression(scope, CompletionKind.MEMBER_REFERENCE, key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -2466,11 +2474,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
LA(1);
|
||||
}
|
||||
|
||||
protected IASTExpression simpleTypeConstructorExpression(IASTScope scope, Kind type ) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression simpleTypeConstructorExpression(IASTScope scope, Kind type, Key key ) throws EndOfFileException, BacktrackException {
|
||||
String typeName = consume().getImage();
|
||||
consume(IToken.tLPAREN);
|
||||
setCurrentFunctionName( typeName );
|
||||
IASTExpression inside = expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE);
|
||||
IASTExpression inside = expression(scope, CompletionKind.CONSTRUCTOR_REFERENCE, key);
|
||||
setCurrentFunctionName( EMPTY_STRING );
|
||||
consume(IToken.tRPAREN);
|
||||
try
|
||||
|
@ -2499,7 +2507,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
* @param expression
|
||||
* @throws BacktrackException
|
||||
*/
|
||||
protected IASTExpression primaryExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression primaryExpression(IASTScope scope, CompletionKind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IToken t = null;
|
||||
switch (LT(1))
|
||||
{
|
||||
|
@ -2633,7 +2641,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tLPAREN :
|
||||
consume();
|
||||
if( templateIdScopes != null ){ templateIdScopes.push( new Integer( IToken.tLPAREN ) ); }
|
||||
IASTExpression lhs = expression(scope, kind);
|
||||
IASTExpression lhs = expression(scope, kind, key);
|
||||
consume(IToken.tRPAREN);
|
||||
if( templateIdScopes != null ){ templateIdScopes.pop(); }
|
||||
try
|
||||
|
@ -2663,7 +2671,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken mark = mark();
|
||||
try
|
||||
{
|
||||
duple = name(scope, kind);
|
||||
duple = name(scope, kind, key);
|
||||
}
|
||||
catch( BacktrackException bt )
|
||||
{
|
||||
|
@ -2787,9 +2795,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throw new EndOfFileException();
|
||||
}
|
||||
|
||||
protected IASTExpression assignmentOperatorExpression(IASTScope scope, IASTExpression.Kind kind, IASTExpression lhs, CompletionKind completionKind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression assignmentOperatorExpression(IASTScope scope, IASTExpression.Kind kind, IASTExpression lhs, CompletionKind completionKind, Key key) throws EndOfFileException, BacktrackException {
|
||||
consume();
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,completionKind);
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,completionKind, key);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -2821,12 +2829,12 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
protected void setCompletionValues(IASTScope scope, CompletionKind kind, Key key, IASTExpression firstExpression, boolean isTemplate) throws EndOfFileException {
|
||||
}
|
||||
|
||||
protected void setCompletionValues( IASTScope scope, CompletionKind kind, IToken first, IToken last ) throws EndOfFileException {
|
||||
protected void setCompletionValues( IASTScope scope, CompletionKind kind, IToken first, IToken last, Key key ) throws EndOfFileException {
|
||||
}
|
||||
|
||||
|
||||
protected IASTExpression unaryOperatorCastExpression(IASTScope scope, IASTExpression.Kind kind, CompletionKind completionKind) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression castExpression = castExpression(scope,completionKind);
|
||||
protected IASTExpression unaryOperatorCastExpression(IASTScope scope, IASTExpression.Kind kind, CompletionKind completionKind, Key key) throws EndOfFileException, BacktrackException {
|
||||
IASTExpression castExpression = castExpression(scope,completionKind,key);
|
||||
try
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
|
@ -2848,13 +2856,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
}
|
||||
|
||||
protected IASTExpression specialCastExpression(IASTScope scope, IASTExpression.Kind kind) throws EndOfFileException, BacktrackException {
|
||||
protected IASTExpression specialCastExpression(IASTScope scope, IASTExpression.Kind kind, Key key) throws EndOfFileException, BacktrackException {
|
||||
consume();
|
||||
consume(IToken.tLT);
|
||||
IASTTypeId duple = typeId(scope, false, CompletionKind.TYPE_REFERENCE);
|
||||
consume(IToken.tGT);
|
||||
consume(IToken.tLPAREN);
|
||||
IASTExpression lhs = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression lhs = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
consume(IToken.tRPAREN);
|
||||
try
|
||||
{
|
||||
|
|
|
@ -30,6 +30,9 @@ import org.eclipse.cdt.core.parser.ast.gcc.IASTGCCSimpleTypeSpecifier;
|
|||
import org.eclipse.cdt.core.parser.extension.IParserExtension;
|
||||
import org.eclipse.cdt.internal.core.parser.Parser.Flags;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.complete.gcc.ASTGCCSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -75,14 +78,14 @@ public class GCCParserExtension implements IParserExtension {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.extension.IParserExtension#parseUnaryExpression(org.eclipse.cdt.internal.core.parser.IParserData)
|
||||
*/
|
||||
public IASTExpression parseUnaryExpression(IASTScope scope, IParserData data, IASTCompletionNode.CompletionKind kind) {
|
||||
public IASTExpression parseUnaryExpression(IASTScope scope, IParserData data, IASTCompletionNode.CompletionKind kind, KeywordSets.Key key) {
|
||||
try {
|
||||
switch( data.LT(1))
|
||||
{
|
||||
case IGCCToken.t___alignof__:
|
||||
return performUnaryExpression( data, scope, kind, UnaryExpressionKind.ALIGNOF );
|
||||
return performUnaryExpression( data, scope, kind, key, UnaryExpressionKind.ALIGNOF );
|
||||
case IGCCToken.t_typeof:
|
||||
return performUnaryExpression( data, scope, kind, UnaryExpressionKind.TYPEOF );
|
||||
return performUnaryExpression( data, scope, kind, key, UnaryExpressionKind.TYPEOF );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -110,10 +113,11 @@ public class GCCParserExtension implements IParserExtension {
|
|||
* @param data
|
||||
* @param scope
|
||||
* @param kind
|
||||
* @param key TODO
|
||||
* @param type TODO
|
||||
* @return
|
||||
*/
|
||||
protected IASTExpression performUnaryExpression(IParserData data, IASTScope scope, CompletionKind kind, UnaryExpressionKind type) {
|
||||
protected IASTExpression performUnaryExpression(IParserData data, IASTScope scope, CompletionKind kind, KeywordSets.Key key, UnaryExpressionKind type) {
|
||||
IToken startingPoint = null;
|
||||
try
|
||||
{
|
||||
|
@ -145,12 +149,12 @@ public class GCCParserExtension implements IParserExtension {
|
|||
{
|
||||
data.backup(mark);
|
||||
d = null;
|
||||
unaryExpression = data.unaryExpression(scope,kind);
|
||||
unaryExpression = data.unaryExpression(scope,kind, key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unaryExpression = data.unaryExpression(scope,kind);
|
||||
unaryExpression = data.unaryExpression(scope,kind, key);
|
||||
}
|
||||
if (d != null & unaryExpression == null)
|
||||
try
|
||||
|
@ -237,7 +241,7 @@ public class GCCParserExtension implements IParserExtension {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.extension.IParserExtension#handleDeclSpecifierSequence(org.eclipse.cdt.internal.core.parser.IParserData, org.eclipse.cdt.core.model.Flags, org.eclipse.cdt.internal.core.parser.DeclarationWrapper)
|
||||
*/
|
||||
public IDeclSpecifierExtensionResult handleDeclSpecifierSequence(IParserData data, Parser.Flags flags, DeclarationWrapper sdw, CompletionKind kind) {
|
||||
public IDeclSpecifierExtensionResult parseDeclSpecifierSequence(IParserData data, Parser.Flags flags, DeclarationWrapper sdw, CompletionKind kind, Key key) {
|
||||
IToken startingPoint = null;
|
||||
try
|
||||
{
|
||||
|
@ -252,7 +256,7 @@ public class GCCParserExtension implements IParserExtension {
|
|||
switch( data.LT(1))
|
||||
{
|
||||
case IGCCToken.t_typeof:
|
||||
IASTExpression typeOfExpression = performUnaryExpression( data, sdw.getScope(), kind, UnaryExpressionKind.TYPEOF );
|
||||
IASTExpression typeOfExpression = performUnaryExpression( data, sdw.getScope(), kind, key, UnaryExpressionKind.TYPEOF );
|
||||
if( typeOfExpression != null )
|
||||
{
|
||||
sdw.setSimpleType( IASTGCCSimpleTypeSpecifier.Type.TYPEOF );
|
||||
|
@ -332,7 +336,7 @@ public class GCCParserExtension implements IParserExtension {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.extension.IParserExtension#parseRelationalExpression(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.internal.core.parser.IParserData, org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind)
|
||||
*/
|
||||
public IASTExpression parseRelationalExpression(IASTScope scope, IParserData data, CompletionKind kind, IASTExpression lhsExpression) {
|
||||
public IASTExpression parseRelationalExpression(IASTScope scope, IParserData data, CompletionKind kind, KeywordSets.Key key, IASTExpression lhsExpression) {
|
||||
if( data.getParserLanguage() == ParserLanguage.C ) return null;
|
||||
IToken mark = null;
|
||||
try {
|
||||
|
@ -359,7 +363,7 @@ public class GCCParserExtension implements IParserExtension {
|
|||
}
|
||||
|
||||
IToken next = data.LA(1);
|
||||
IASTExpression secondExpression = data.shiftExpression(scope,kind);
|
||||
IASTExpression secondExpression = data.shiftExpression(scope,kind, key);
|
||||
if (next == data.LA(1))
|
||||
{
|
||||
// we did not consume anything
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.parser.IFilenameProvider;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -25,12 +26,12 @@ public interface IExpressionParser extends IFilenameProvider {
|
|||
/**
|
||||
* Request a parse from a pre-configured parser to parse an expression.
|
||||
*
|
||||
* @param key TODO
|
||||
* @param expression Optional parameter representing an expression object that
|
||||
* your particular IParserCallback instance would appreciate
|
||||
*
|
||||
* your particular IParserCallback instance would appreciate
|
||||
* @throws BacktrackException thrown if the Scanner/Stream provided does not yield a valid
|
||||
* expression
|
||||
*/
|
||||
public IASTExpression expression(IASTScope scope, IASTCompletionNode.CompletionKind kind) throws BacktrackException, EndOfFileException;
|
||||
public IASTExpression expression(IASTScope scope, IASTCompletionNode.CompletionKind kind, Key key) throws BacktrackException, EndOfFileException;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||
import org.eclipse.cdt.internal.core.parser.token.KeywordSets.Key;
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
|
@ -92,9 +94,10 @@ public interface IParserData {
|
|||
/**
|
||||
* @param scope
|
||||
* @param kind
|
||||
* @param key TODO
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression unaryExpression(IASTScope scope, CompletionKind kind) throws EndOfFileException, BacktrackException;
|
||||
public IASTExpression unaryExpression(IASTScope scope, CompletionKind kind, KeywordSets.Key key) throws EndOfFileException, BacktrackException;
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
@ -106,7 +109,8 @@ public interface IParserData {
|
|||
/**
|
||||
* @param scope
|
||||
* @param kind
|
||||
* @param key TODO
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression shiftExpression(IASTScope scope, CompletionKind kind) throws BacktrackException, EndOfFileException;
|
||||
public IASTExpression shiftExpression(IASTScope scope, CompletionKind kind, Key key) throws BacktrackException, EndOfFileException;
|
||||
}
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.core.parser.IScanner;
|
|||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
|
||||
import org.eclipse.cdt.core.parser.ParseError;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
|
@ -244,7 +243,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// optional :: and nested classes handled in name
|
||||
ITokenDuple duple = null;
|
||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
duple = name(scope, CompletionKind.NAMESPACE_REFERENCE);
|
||||
duple = name(scope, CompletionKind.NAMESPACE_REFERENCE, Key.EMPTY);
|
||||
else
|
||||
throw backtrack;
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
|
@ -286,7 +285,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
{
|
||||
// optional :: and nested classes handled in name
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE);
|
||||
name = name(scope, CompletionKind.TYPE_REFERENCE, Key.EMPTY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -762,7 +761,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
return;
|
||||
}
|
||||
default :
|
||||
simpleDeclarationStrategyUnion(scope, ownerTemplate, overideKind );
|
||||
simpleDeclarationStrategyUnion(scope, ownerTemplate, overideKind, Key.DECLARATION );
|
||||
}
|
||||
setCompletionValues(scope, kind, Key.DECLARATION );
|
||||
}
|
||||
|
@ -777,7 +776,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
protected void simpleDeclarationStrategyUnion(
|
||||
IASTScope scope,
|
||||
IASTTemplate ownerTemplate, CompletionKind overide)
|
||||
IASTTemplate ownerTemplate, CompletionKind overrideKind, Key overrideKey)
|
||||
throws EndOfFileException, BacktrackException
|
||||
{
|
||||
IToken mark = mark();
|
||||
|
@ -787,7 +786,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
simpleDeclaration(
|
||||
SimpleDeclarationStrategy.TRY_CONSTRUCTOR,
|
||||
scope,
|
||||
ownerTemplate, overide, false);
|
||||
ownerTemplate, overrideKind, false, overrideKey);
|
||||
// try it first with the original strategy
|
||||
}
|
||||
catch (BacktrackException bt)
|
||||
|
@ -800,7 +799,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
simpleDeclaration(
|
||||
SimpleDeclarationStrategy.TRY_FUNCTION,
|
||||
scope,
|
||||
ownerTemplate, overide, false);
|
||||
ownerTemplate, overrideKind, false, overrideKey);
|
||||
}
|
||||
catch( BacktrackException bt2 )
|
||||
{
|
||||
|
@ -811,7 +810,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
simpleDeclaration(
|
||||
SimpleDeclarationStrategy.TRY_VARIABLE,
|
||||
scope,
|
||||
ownerTemplate, overide, false);
|
||||
ownerTemplate, overrideKind, false, overrideKey);
|
||||
}
|
||||
catch( BacktrackException b3 )
|
||||
{
|
||||
|
@ -908,7 +907,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if( identifier == null )
|
||||
throw backtrack;
|
||||
|
||||
ITokenDuple duple = name(scope, CompletionKind.NAMESPACE_REFERENCE);
|
||||
ITokenDuple duple = name(scope, CompletionKind.NAMESPACE_REFERENCE, Key.EMPTY);
|
||||
consume( IToken.tSEMI );
|
||||
setCompletionValues(scope, kind, Key.DECLARATION );
|
||||
try
|
||||
|
@ -948,7 +947,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
protected void simpleDeclaration(
|
||||
SimpleDeclarationStrategy strategy,
|
||||
IASTScope scope,
|
||||
IASTTemplate ownerTemplate, CompletionKind overideKind, boolean fromCatchHandler)
|
||||
IASTTemplate ownerTemplate, CompletionKind overideKind, boolean fromCatchHandler, Key overrideKey)
|
||||
throws BacktrackException, EndOfFileException
|
||||
{
|
||||
IToken firstToken = LA(1);
|
||||
|
@ -959,7 +958,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
CompletionKind completionKindForDeclaration = getCompletionKindForDeclaration(scope, overideKind);
|
||||
setCompletionValues( scope, completionKindForDeclaration, Key.DECL_SPECIFIER_SEQUENCE );
|
||||
declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR, completionKindForDeclaration );
|
||||
declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR, completionKindForDeclaration, overrideKey );
|
||||
if (sdw.getTypeSpecifier() == null && sdw.getSimpleType() != IASTSimpleTypeSpecifier.Type.UNSPECIFIED )
|
||||
try
|
||||
{
|
||||
|
@ -1088,16 +1087,20 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
astFactory.createTypeSpecDeclaration(
|
||||
sdw.getScope(),
|
||||
sdw.getTypeSpecifier(),
|
||||
ownerTemplate,
|
||||
sdw.getStartingOffset(),
|
||||
sdw.getStartingLine(), lastToken.getEndOffset(), lastToken.getLineNumber(),
|
||||
sdw.isFriend())
|
||||
.acceptElement(requestor);
|
||||
if( sdw.getTypeSpecifier() != null )
|
||||
{
|
||||
astFactory.createTypeSpecDeclaration(
|
||||
sdw.getScope(),
|
||||
sdw.getTypeSpecifier(),
|
||||
ownerTemplate,
|
||||
sdw.getStartingOffset(),
|
||||
sdw.getStartingLine(), lastToken.getEndOffset(), lastToken.getLineNumber(),
|
||||
sdw.isFriend())
|
||||
.acceptElement(requestor);
|
||||
}
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
|
@ -1107,7 +1110,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
|
||||
}
|
||||
protected abstract void handleFunctionBody(IASTScope scope) throws BacktrackException, EndOfFileException;
|
||||
|
||||
|
||||
protected abstract void handleFunctionBody(IASTScope scope) throws BacktrackException, EndOfFileException;
|
||||
|
||||
protected void skipOverCompoundStatement() throws BacktrackException, EndOfFileException
|
||||
{
|
||||
|
@ -1152,12 +1157,12 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
|
||||
|
||||
ITokenDuple duple = name(scope, CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
ITokenDuple duple = name(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EMPTY );
|
||||
|
||||
consume(IToken.tLPAREN);
|
||||
IASTExpression expressionList = null;
|
||||
|
||||
expressionList = expression(d.getDeclarationWrapper().getScope(), CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
expressionList = expression(d.getDeclarationWrapper().getScope(), CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
|
||||
consume(IToken.tRPAREN);
|
||||
|
||||
|
@ -1199,7 +1204,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
DeclarationWrapper sdw =
|
||||
new DeclarationWrapper(scope, current.getOffset(), current.getLineNumber(), null);
|
||||
declSpecifierSeq(sdw, true, false, CompletionKind.ARGUMENT_TYPE);
|
||||
declSpecifierSeq(sdw, true, false, CompletionKind.ARGUMENT_TYPE, Key.DECL_SPECIFIER_SEQUENCE );
|
||||
if (sdw.getTypeSpecifier() == null
|
||||
&& sdw.getSimpleType()
|
||||
!= IASTSimpleTypeSpecifier.Type.UNSPECIFIED)
|
||||
|
@ -1303,7 +1308,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
/**
|
||||
* @param flags input flags that are used to make our decision
|
||||
* @return whether or not this looks like a constructor (true or false)
|
||||
* @return whether or not this looks like a constructor (true or false)
|
||||
* @throws EndOfFileException we could encounter EOF while looking ahead
|
||||
*/
|
||||
private boolean lookAheadForConstructorOrConversion(Flags flags, DeclarationWrapper sdw, CompletionKind kind )
|
||||
|
@ -1325,6 +1330,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
backup( mark );
|
||||
return false;
|
||||
}
|
||||
catch ( EndOfFileException eof )
|
||||
{
|
||||
backup( mark );
|
||||
return false;
|
||||
}
|
||||
|
||||
ITokenDuple duple = d.getNameDuple();
|
||||
if( duple == null )
|
||||
|
@ -1366,7 +1376,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
private boolean lookAheadForDeclarator(Flags flags) throws EndOfFileException
|
||||
{
|
||||
return flags.haveEncounteredTypename()
|
||||
&& ((LT(2) != IToken.tIDENTIFIER
|
||||
&& ( (LT(2) != IToken.tIDENTIFIER
|
||||
|| (LT(3) != IToken.tLPAREN && LT(3) != IToken.tASSIGN))
|
||||
&& !LA(2).isPointer());
|
||||
}
|
||||
|
@ -1397,7 +1407,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
protected void declSpecifierSeq(
|
||||
DeclarationWrapper sdw,
|
||||
boolean parm,
|
||||
boolean tryConstructor, CompletionKind kind )
|
||||
boolean tryConstructor, CompletionKind kind, Key key )
|
||||
throws BacktrackException, EndOfFileException
|
||||
{
|
||||
Flags flags = new Flags(parm, tryConstructor);
|
||||
|
@ -1576,7 +1586,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume(IToken.t_typename );
|
||||
IToken first = LA(1);
|
||||
IToken last = null;
|
||||
last = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE).getLastToken();
|
||||
last = name(sdw.getScope(), CompletionKind.TYPE_REFERENCE, Key.EMPTY).getLastToken();
|
||||
if (LT(1) == IToken.t_template)
|
||||
{
|
||||
consume(IToken.t_template);
|
||||
|
@ -1623,8 +1633,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope(), kind );
|
||||
setCompletionValues(sdw.getScope(), kind, key );
|
||||
ITokenDuple d = name(sdw.getScope(), kind, key );
|
||||
sdw.setTypeName(d);
|
||||
sdw.setSimpleType( IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME );
|
||||
flags.setEncounteredTypename(true);
|
||||
|
@ -1661,7 +1671,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
default :
|
||||
if( extension.canHandleDeclSpecifierSequence( LT(1)))
|
||||
{
|
||||
IParserExtension.IDeclSpecifierExtensionResult declSpecExtResult = extension.handleDeclSpecifierSequence( this, flags, sdw, kind );
|
||||
IParserExtension.IDeclSpecifierExtensionResult declSpecExtResult = extension.parseDeclSpecifierSequence( this, flags, sdw, kind, key );
|
||||
if( declSpecExtResult != null )
|
||||
{
|
||||
flags = declSpecExtResult.getFlags();
|
||||
|
@ -1716,7 +1726,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
throw backtrack;
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope(), completionKind);
|
||||
ITokenDuple d = name(sdw.getScope(), completionKind, Key.EMPTY);
|
||||
IASTTypeSpecifier elaboratedTypeSpec = null;
|
||||
final boolean isForewardDecl = ( LT(1) == IToken.tSEMI );
|
||||
|
||||
|
@ -1800,7 +1810,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume(IToken.tLPAREN); // EAT IT!
|
||||
setCompletionValues(scope,CompletionKind.SINGLE_NAME_REFERENCE,Key.EMPTY);
|
||||
IASTExpression astExpression = null;
|
||||
astExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
astExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
setCompletionValues(scope,CompletionKind.NO_SUCH_KIND,Key.EMPTY);
|
||||
consume(IToken.tRPAREN);
|
||||
d.setConstructorExpression(astExpression);
|
||||
|
@ -1872,7 +1882,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// assignmentExpression
|
||||
try
|
||||
{
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
try
|
||||
{
|
||||
return astFactory.createInitializerClause(
|
||||
|
@ -1952,7 +1962,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
try
|
||||
{
|
||||
IASTExpression assignmentExpression =
|
||||
assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
assignmentExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -2001,7 +2011,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
else if( LT(1) == IToken.tLBRACKET )
|
||||
{
|
||||
consume( IToken.tLBRACKET );
|
||||
constantExpression = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
constantExpression = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
consume( IToken.tRBRACKET );
|
||||
kind = IASTDesignator.DesignatorKind.SUBSCRIPT;
|
||||
}
|
||||
|
@ -2076,7 +2086,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
if( ! astFactory.queryIsTypeName( parameterScope, name(parameterScope, CompletionKind.TYPE_REFERENCE ) ) )
|
||||
if( ! astFactory.queryIsTypeName( parameterScope, name(parameterScope, CompletionKind.TYPE_REFERENCE, Key.EMPTY ) ) )
|
||||
failed = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -2232,7 +2242,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
continue;
|
||||
case IToken.tCOLON :
|
||||
consume(IToken.tCOLON);
|
||||
IASTExpression exp = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression exp = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
d.setBitFieldExpression(exp);
|
||||
default :
|
||||
break;
|
||||
|
@ -2258,7 +2268,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
ITokenDuple duple = name(d.getDeclarationWrapper().getScope(), kind );
|
||||
ITokenDuple duple = name(d.getDeclarationWrapper().getScope(), kind, Key.EMPTY );
|
||||
d.setName(duple);
|
||||
|
||||
}
|
||||
|
@ -2375,7 +2385,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (LT(1) == IToken.tASSIGN)
|
||||
{
|
||||
consume(IToken.tASSIGN);
|
||||
initialValue = constantExpression(sdw.getScope(), CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
initialValue = constantExpression(sdw.getScope(), CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
}
|
||||
|
||||
if (LT(1) == IToken.tRBRACE)
|
||||
|
@ -2485,7 +2495,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
setCompletionValues(sdw.getScope(), completionKind, Key.EMPTY );
|
||||
// class name
|
||||
if (LT(1) == IToken.tIDENTIFIER)
|
||||
duple = name( sdw.getScope(), completionKind );
|
||||
duple = name( sdw.getScope(), completionKind, Key.EMPTY );
|
||||
if (duple != null && !duple.isIdentifier())
|
||||
nameType = ClassNameType.TEMPLATE;
|
||||
if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE)
|
||||
|
@ -2634,7 +2644,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
case IToken.tCOLONCOLON :
|
||||
case IToken.tIDENTIFIER :
|
||||
nameDuple = name(astClassSpec.getOwnerScope(), CompletionKind.CLASS_REFERENCE );
|
||||
nameDuple = name(astClassSpec.getOwnerScope(), CompletionKind.CLASS_REFERENCE, Key.EMPTY );
|
||||
break;
|
||||
case IToken.tCOMMA :
|
||||
try
|
||||
|
@ -2705,7 +2715,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
case IToken.t_case :
|
||||
consume(IToken.t_case);
|
||||
IASTExpression constant_expression = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression constant_expression = constantExpression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
constant_expression.acceptElement(requestor);
|
||||
consume(IToken.tCOLON);
|
||||
statement(scope);
|
||||
|
@ -2773,7 +2783,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume(IToken.tSEMI);
|
||||
if (LT(1) != IToken.tRPAREN)
|
||||
{
|
||||
IASTExpression finalExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression finalExpression = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.DECLARATION);
|
||||
finalExpression.acceptElement(requestor);
|
||||
}
|
||||
consume(IToken.tRPAREN);
|
||||
|
@ -2791,7 +2801,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume();
|
||||
if (LT(1) != IToken.tSEMI)
|
||||
{
|
||||
IASTExpression retVal = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression retVal = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION);
|
||||
retVal.acceptElement(requestor);
|
||||
}
|
||||
consume(IToken.tSEMI);
|
||||
|
@ -2813,26 +2823,20 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// can be many things:
|
||||
// label
|
||||
|
||||
try
|
||||
{
|
||||
if (LT(1) == IToken.tIDENTIFIER && LT(2) == IToken.tCOLON)
|
||||
{
|
||||
consume(IToken.tIDENTIFIER);
|
||||
consume(IToken.tCOLON);
|
||||
statement(scope);
|
||||
return;
|
||||
}
|
||||
}catch( OffsetLimitReachedException olre )
|
||||
{
|
||||
// ok
|
||||
}
|
||||
if (queryLookaheadCapability(2) && LT(1) == IToken.tIDENTIFIER && LT(2) == IToken.tCOLON)
|
||||
{
|
||||
consume(IToken.tIDENTIFIER);
|
||||
consume(IToken.tCOLON);
|
||||
statement(scope);
|
||||
return;
|
||||
}
|
||||
// expressionStatement
|
||||
// Note: the function style cast ambiguity is handled in expression
|
||||
// Since it only happens when we are in a statement
|
||||
IToken mark = mark();
|
||||
try
|
||||
{
|
||||
IASTExpression expressionStatement = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE);
|
||||
IASTExpression expressionStatement = expression(scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.STATEMENT);
|
||||
consume(IToken.tSEMI);
|
||||
expressionStatement.acceptElement( requestor );
|
||||
return;
|
||||
|
@ -2858,7 +2862,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if( LT(1) == IToken.tELLIPSIS )
|
||||
consume( IToken.tELLIPSIS );
|
||||
else
|
||||
simpleDeclaration( SimpleDeclarationStrategy.TRY_VARIABLE, scope, null, CompletionKind.EXCEPTION_REFERENCE, true); // was exceptionDeclaration
|
||||
simpleDeclaration( SimpleDeclarationStrategy.TRY_VARIABLE, scope, null, CompletionKind.EXCEPTION_REFERENCE, true, Key.DECL_SPECIFIER_SEQUENCE );
|
||||
consume(IToken.tRPAREN);
|
||||
|
||||
catchBlockCompoundStatement(scope);
|
||||
|
@ -2896,7 +2900,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
*/
|
||||
protected void condition( IASTScope scope ) throws BacktrackException, EndOfFileException
|
||||
{
|
||||
IASTExpression someExpression = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
IASTExpression someExpression = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.EXPRESSION );
|
||||
someExpression.acceptElement(requestor);
|
||||
//TODO type-specifier-seq declarator = assignment expression
|
||||
}
|
||||
|
@ -2909,7 +2913,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
IToken mark = mark();
|
||||
try
|
||||
{
|
||||
IASTExpression e = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE );
|
||||
IASTExpression e = expression( scope, CompletionKind.SINGLE_NAME_REFERENCE, Key.DECLARATION );
|
||||
e.acceptElement(requestor);
|
||||
|
||||
consume( IToken.tSEMI );
|
||||
|
@ -2919,7 +2923,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
backup( mark );
|
||||
try
|
||||
{
|
||||
simpleDeclarationStrategyUnion(scope,null, null);
|
||||
simpleDeclarationStrategyUnion(scope,null, null,null);
|
||||
}
|
||||
catch( BacktrackException b )
|
||||
{
|
||||
|
|
|
@ -2432,7 +2432,7 @@ public class Scanner implements IScanner {
|
|||
|
||||
parser = InternalParserUtil.createExpressionParser(trial, scannerData.getLanguage(), NULL_LOG_SERVICE);
|
||||
try {
|
||||
IASTExpression exp = parser.expression(null, null);
|
||||
IASTExpression exp = parser.expression(null, null, null);
|
||||
if( exp.evaluateExpression() == 0 )
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
@ -189,7 +189,7 @@ public class KeywordSets {
|
|||
private static final Set STATEMENT_CPP;
|
||||
static
|
||||
{
|
||||
STATEMENT_CPP = new TreeSet( STATEMENT_C );
|
||||
STATEMENT_CPP = new TreeSet( DECLARATION_CPP );
|
||||
STATEMENT_CPP.add( Keywords.TRY );
|
||||
//TODO finish this
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue