mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=65623
This commit is contained in:
parent
b8c65f150f
commit
36ec31dca2
9 changed files with 425 additions and 189 deletions
|
@ -10,13 +10,16 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.IParser;
|
||||
import org.eclipse.cdt.core.parser.IQuickParseCallback;
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.NullLogService;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserFactoryError;
|
||||
|
@ -32,6 +35,7 @@ import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -39,22 +43,39 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
*/
|
||||
public class BaseASTTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ProblemCallback extends QuickParseCallback implements
|
||||
ISourceElementRequestor {
|
||||
|
||||
List problems = new ArrayList();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
||||
*/
|
||||
public boolean acceptProblem(IProblem problem) {
|
||||
problems.add( problem );
|
||||
return super.acceptProblem( problem );
|
||||
}
|
||||
}
|
||||
public BaseASTTest( String a )
|
||||
{
|
||||
super( a );
|
||||
}
|
||||
|
||||
protected IQuickParseCallback quickParseCallback;
|
||||
protected ProblemCallback quickParseCallback;
|
||||
protected IParser parser;
|
||||
|
||||
protected IASTCompilationUnit parse( String code, boolean quick, boolean throwExceptionOnError, ParserLanguage lang ) throws ParserException, ParserFactoryError
|
||||
{
|
||||
ParserMode mode = quick ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE;
|
||||
quickParseCallback = ParserFactory.createQuickParseCallback();
|
||||
quickParseCallback = new ProblemCallback();
|
||||
parser = ParserFactory.createParser( ParserFactory.createScanner( new CodeReader(code.toCharArray()), new ScannerInfo(), mode, lang, quickParseCallback, new NullLogService(), null), quickParseCallback, mode, lang, null ); //$NON-NLS-1$
|
||||
if( ! parser.parse() && throwExceptionOnError )
|
||||
throw new ParserException("Parse failure"); //$NON-NLS-1$
|
||||
return quickParseCallback.getCompilationUnit();
|
||||
return ((QuickParseCallback)quickParseCallback).getCompilationUnit();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ParserFactoryError;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class CompleteParseProblemTest extends CompleteParseBaseTest {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CompleteParseProblemTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public CompleteParseProblemTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testBadClassName() throws Exception
|
||||
{
|
||||
validateInvalidClassName("12345"); //$NON-NLS-1$
|
||||
validateInvalidClassName("*"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ParserException
|
||||
* @throws ParserFactoryError
|
||||
*/
|
||||
protected void validateInvalidClassName( String name ) throws ParserException, ParserFactoryError {
|
||||
StringBuffer buffer = new StringBuffer( "class "); //$NON-NLS-1$
|
||||
|
||||
buffer.append( name );
|
||||
buffer.append( " { };"); //$NON-NLS-1$
|
||||
String code = buffer.toString();
|
||||
parse( code, false );
|
||||
assertFalse( callback.problems.isEmpty() );
|
||||
assertEquals( callback.problems.size(), 1 );
|
||||
IProblem p = (IProblem) callback.problems.get( 0 );
|
||||
assertTrue( p.checkCategory( IProblem.SYNTAX_RELATED ));
|
||||
assertEquals( p.getID(), IProblem.SYNTAX_ERROR );
|
||||
assertEquals( p.getSourceStart(), code.indexOf( name )); //$NON-NLS-1$
|
||||
assertEquals( p.getSourceEnd(), code.indexOf( name ) + name.length() ); //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -35,10 +35,12 @@ public class ParserTestSuite extends TestCase {
|
|||
suite.addTestSuite(CModelElementsTests.class);
|
||||
suite.addTestSuite(StructuralCModelElementsTests.class);
|
||||
suite.addTestSuite(CompletionParseTest.class);
|
||||
suite.addTestSuite(QuickParseProblemTests.class);
|
||||
// suite.addTestSuite(MacroTests.class);
|
||||
suite.addTestSuite( PreprocessorConditionalTest.class );
|
||||
suite.addTestSuite( QuickParseASTQualifiedNameTest.class);
|
||||
suite.addTestSuite( CompleteParseASTTest.class );
|
||||
suite.addTestSuite( CompleteParseProblemTest.class );
|
||||
suite.addTestSuite( SelectionParseTest.class );
|
||||
suite.addTestSuite( CompleteParseASTExpressionTest.class );
|
||||
suite.addTestSuite( CompleteParseASTSymbolIteratorTest.class );
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class QuickParseProblemTests extends BaseASTTest {
|
||||
|
||||
/**
|
||||
* @param a
|
||||
*/
|
||||
public QuickParseProblemTests(String a) {
|
||||
super(a);
|
||||
}
|
||||
|
||||
public void testBadClassName() throws Exception
|
||||
{
|
||||
String code = "class 12345 { };";//$NON-NLS-1$
|
||||
parse( code, true, false );
|
||||
assertFalse( quickParseCallback.problems.isEmpty() );
|
||||
assertEquals( quickParseCallback.problems.size(), 1 );
|
||||
IProblem p = (IProblem) quickParseCallback.problems.get( 0 );
|
||||
assertTrue( p.checkCategory( IProblem.SYNTAX_RELATED ));
|
||||
assertEquals( p.getID(), IProblem.SYNTAX_ERROR );
|
||||
assertEquals( p.getSourceStart(), code.indexOf( "12345")); //$NON-NLS-1$
|
||||
assertEquals( p.getSourceEnd(), code.indexOf( "12345") + 5 ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,6 +20,7 @@ public class BacktrackException extends Exception
|
|||
private IProblem problem;
|
||||
private int startOffset;
|
||||
private int endOffset;
|
||||
private int lineNumber;
|
||||
|
||||
/**
|
||||
* @param p
|
||||
|
@ -48,10 +49,11 @@ public class BacktrackException extends Exception
|
|||
* @param startingOffset
|
||||
* @param endingOffset
|
||||
*/
|
||||
public void initialize(int startingOffset, int endingOffset) {
|
||||
public void initialize(int startingOffset, int endingOffset, int line) {
|
||||
reset();
|
||||
startOffset = startingOffset;
|
||||
endOffset = endingOffset;
|
||||
lineNumber = line;
|
||||
}
|
||||
/**
|
||||
* @return Returns the offset.
|
||||
|
@ -65,4 +67,11 @@ public class BacktrackException extends Exception
|
|||
public final int getEndOffset() {
|
||||
return endOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getLineNumber() {
|
||||
return lineNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,8 @@ public class CompletionParser extends ContextualParser implements IParser {
|
|||
throws EndOfFileException, BacktrackException {
|
||||
if( LT(1) != IToken.t_catch )
|
||||
{
|
||||
throwBacktrack(LA(1).getOffset()); // error, need at least one of these
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(la.getOffset(), la.getEndOffset(), la.getLineNumber()); // error, need at least one of these
|
||||
}
|
||||
while (LT(1) == IToken.t_catch)
|
||||
{
|
||||
|
|
|
@ -63,12 +63,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throw backtrack;
|
||||
}
|
||||
|
||||
protected final void throwBacktrack( int startingOffset ) throws BacktrackException {
|
||||
++backtrackCount;
|
||||
if( lastToken != null )
|
||||
backtrack.initialize( startingOffset, lastToken.getEndOffset() );
|
||||
else
|
||||
backtrack.initialize( startingOffset, startingOffset );
|
||||
protected final void throwBacktrack( int startingOffset, int endingOffset, int lineNumber ) throws BacktrackException {
|
||||
++backtrackCount;
|
||||
backtrack.initialize( startingOffset, ( endingOffset == 0 ) ? startingOffset + 1 : endingOffset, lineNumber );
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
|
@ -163,7 +160,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
BacktrackException {
|
||||
if (LT(1) == type)
|
||||
return consume();
|
||||
throwBacktrack(LA(1).getOffset());
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(la.getOffset(), la.getEndOffset(), la.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -269,7 +267,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} while (!scopes.empty()
|
||||
&& (top == IToken.tGT || top == IToken.tLT));
|
||||
if (top != IToken.tLBRACKET)
|
||||
throwBacktrack(startingOffset );
|
||||
throwBacktrack(startingOffset, last.getEndOffset(), last.getLineNumber());
|
||||
|
||||
break;
|
||||
case IToken.tRPAREN :
|
||||
|
@ -278,7 +276,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} while (!scopes.empty()
|
||||
&& (top == IToken.tGT || top == IToken.tLT));
|
||||
if (top != IToken.tLPAREN)
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, last.getEndOffset(), last.getLineNumber());
|
||||
|
||||
break;
|
||||
case IToken.tLT :
|
||||
|
@ -295,7 +293,10 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
protected List templateArgumentList(IASTScope scope,
|
||||
IASTCompletionNode.CompletionKind kind) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
IToken start = LA(1);
|
||||
int startingOffset = start.getOffset();
|
||||
int startingLineNumber = start.getOffset();
|
||||
start = null;
|
||||
IASTExpression expression = null;
|
||||
List list = new LinkedList();
|
||||
|
||||
|
@ -328,11 +329,15 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
if (!completedArg) {
|
||||
try {
|
||||
IToken la = LA(1);
|
||||
int so = la.getOffset();
|
||||
int ln= la.getLineNumber();
|
||||
expression = assignmentExpression(scope,
|
||||
CompletionKind.VARIABLE_TYPE,
|
||||
KeywordSetKey.EXPRESSION);
|
||||
|
||||
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_EMPTY) {
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(so, ( lastToken != null ) ? lastToken.getEndOffset() : 0, ln);
|
||||
}
|
||||
list.add(expression);
|
||||
completedArg = true;
|
||||
|
@ -378,7 +383,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
if (failed) {
|
||||
if (expression != null)
|
||||
expression.freeReferences(astFactory.getReferenceManager());
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, 0, startingLineNumber );
|
||||
}
|
||||
|
||||
return list;
|
||||
|
@ -459,8 +464,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
break;
|
||||
|
||||
default :
|
||||
IToken l = LA(1);
|
||||
backup(mark);
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), l.getEndOffset(), first.getLineNumber());
|
||||
}
|
||||
|
||||
while (LT(1) == IToken.tCOLONCOLON) {
|
||||
|
@ -477,8 +483,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
switch (LT(1)) {
|
||||
case IToken.t_operator :
|
||||
IToken l = LA(1);
|
||||
backup(mark);
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), l.getEndOffset(), first.getLineNumber());
|
||||
case IToken.tIDENTIFIER :
|
||||
prev = last;
|
||||
last = consume();
|
||||
|
@ -620,7 +627,8 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
language, IToken.t_restrict));
|
||||
break;
|
||||
}
|
||||
throwBacktrack(startingOffset);
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(startingOffset, la.getEndOffset(), la.getLineNumber());
|
||||
|
||||
default :
|
||||
if (extension.isValidCVModifier(language, LT(1))) {
|
||||
|
@ -651,7 +659,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
arrayMod = astFactory.createArrayModifier(exp);
|
||||
} catch (Exception e) {
|
||||
logException("consumeArrayModifiers::createArrayModifier()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, last.getEndOffset(), last.getLineNumber());
|
||||
}
|
||||
d.addArrayModifier(arrayMod);
|
||||
}
|
||||
|
@ -683,7 +691,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} else if (LA(1).isOperator())
|
||||
toSend = consume();
|
||||
else
|
||||
throwBacktrack(operatorToken.getOffset());
|
||||
throwBacktrack(operatorToken.getOffset(), toSend != null ? toSend.getEndOffset() : 0, operatorToken.getLineNumber() );
|
||||
} else {
|
||||
// must be a conversion function
|
||||
typeId(d.getDeclarationWrapper().getScope(), true,
|
||||
|
@ -795,7 +803,9 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
|
||||
public IASTExpression expression(IASTScope scope, CompletionKind kind,
|
||||
KeywordSetKey key) throws BacktrackException, EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
IToken la = LA(1);
|
||||
int startingOffset = la.getOffset();
|
||||
int ln = la.getLineNumber();
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope, kind,
|
||||
key);
|
||||
while (LT(1) == IToken.tCOMMA) {
|
||||
|
@ -804,6 +814,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IASTExpression secondExpression = assignmentExpression(scope, kind,
|
||||
key);
|
||||
setParameterListExpression(null);
|
||||
int endOffset = lastToken != null ? lastToken.getEndOffset() : 0 ;
|
||||
try {
|
||||
assignmentExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.EXPRESSIONLIST,
|
||||
|
@ -813,7 +824,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("expression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, ln);
|
||||
}
|
||||
}
|
||||
return assignmentExpression;
|
||||
|
@ -906,6 +917,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
} catch (BacktrackException b) {
|
||||
}
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.THROWEXPRESSION, throwExpression, null,
|
||||
|
@ -914,7 +926,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("throwExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(throwToken.getOffset());
|
||||
throwBacktrack(throwToken.getOffset(), endOffset, throwToken.getLineNumber() );
|
||||
|
||||
}
|
||||
return null;
|
||||
|
@ -928,14 +940,18 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
protected IASTExpression conditionalExpression(IASTScope scope,
|
||||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
IToken la = LA(1);
|
||||
int startingOffset = la.getOffset();
|
||||
int ln = la.getLineNumber();
|
||||
la = null;
|
||||
IASTExpression firstExpression = logicalOrExpression(scope, kind, key);
|
||||
if (LT(1) == IToken.tQUESTION) {
|
||||
consume();
|
||||
consume(IToken.tQUESTION);
|
||||
IASTExpression secondExpression = expression(scope, kind, key);
|
||||
consume(IToken.tCOLON);
|
||||
IASTExpression thirdExpression = assignmentExpression(scope, kind,
|
||||
key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.CONDITIONALEXPRESSION,
|
||||
|
@ -945,7 +961,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("conditionalExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, ln);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -959,12 +975,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = logicalAndExpression(scope, kind, key);
|
||||
while (LT(1) == IToken.tOR) {
|
||||
consume();
|
||||
consume(IToken.tOR);
|
||||
IASTExpression secondExpression = logicalAndExpression(scope, kind,
|
||||
key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.LOGICALOREXPRESSION,
|
||||
|
@ -974,7 +991,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("logicalOrExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -988,11 +1005,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = inclusiveOrExpression(scope, kind, key);
|
||||
while (LT(1) == IToken.tAND) {
|
||||
consume();
|
||||
consume(IToken.tAND);
|
||||
IASTExpression secondExpression = inclusiveOrExpression(scope,
|
||||
kind, key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.LOGICALANDEXPRESSION,
|
||||
|
@ -1002,7 +1021,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("logicalAndExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -1016,12 +1035,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = exclusiveOrExpression(scope, kind, key);
|
||||
while (LT(1) == IToken.tBITOR) {
|
||||
consume();
|
||||
IASTExpression secondExpression = exclusiveOrExpression(scope,
|
||||
kind, key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.INCLUSIVEOREXPRESSION,
|
||||
|
@ -1031,7 +1051,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("inclusiveOrExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -1045,12 +1065,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = andExpression(scope, kind, key);
|
||||
while (LT(1) == IToken.tXOR) {
|
||||
consume();
|
||||
|
||||
IASTExpression secondExpression = andExpression(scope, kind, key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.EXCLUSIVEOREXPRESSION,
|
||||
|
@ -1060,7 +1081,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("exclusiveORExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -1074,12 +1095,13 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = equalityExpression(scope, kind, key);
|
||||
while (LT(1) == IToken.tAMPER) {
|
||||
consume();
|
||||
IASTExpression secondExpression = equalityExpression(scope, kind,
|
||||
key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.ANDEXPRESSION, firstExpression,
|
||||
|
@ -1088,7 +1110,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("andExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
return firstExpression;
|
||||
|
@ -1122,6 +1144,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = relationalExpression(scope, kind, key);
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1130,7 +1153,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IASTExpression secondExpression = relationalExpression(
|
||||
scope, kind, key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope, (t
|
||||
.getType() == IToken.tEQUAL)
|
||||
|
@ -1143,7 +1166,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"equalityExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1160,6 +1183,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = shiftExpression(scope, kind, key);
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1196,6 +1220,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
expressionKind = IASTExpression.Kind.RELATIONAL_GREATERTHANEQUALTO;
|
||||
break;
|
||||
}
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
expressionKind, firstExpression,
|
||||
|
@ -1206,7 +1231,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"relationalExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1230,6 +1255,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
public IASTExpression shiftExpression(IASTScope scope, CompletionKind kind,
|
||||
KeywordSetKey key) throws BacktrackException, EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = additiveExpression(scope, kind, key);
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1238,6 +1264,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IASTExpression secondExpression = additiveExpression(scope,
|
||||
kind, key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
((t.getType() == IToken.tSHIFTL)
|
||||
|
@ -1249,7 +1276,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("shiftExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1266,6 +1293,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = multiplicativeExpression(scope, kind,
|
||||
key);
|
||||
for (;;) {
|
||||
|
@ -1275,6 +1303,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IASTExpression secondExpression = multiplicativeExpression(
|
||||
scope, kind, key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
((t.getType() == IToken.tPLUS)
|
||||
|
@ -1287,7 +1316,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"additiveExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1304,6 +1333,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws BacktrackException,
|
||||
EndOfFileException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = pmExpression(scope, kind, key);
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1325,6 +1355,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
expressionKind = IASTExpression.Kind.MULTIPLICATIVE_MODULUS;
|
||||
break;
|
||||
}
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
expressionKind, firstExpression,
|
||||
|
@ -1337,7 +1368,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"multiplicativeExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1353,6 +1384,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
protected IASTExpression pmExpression(IASTScope scope, CompletionKind kind,
|
||||
KeywordSetKey key) throws EndOfFileException, BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = castExpression(scope, kind, key);
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1361,6 +1393,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IASTExpression secondExpression = castExpression(scope,
|
||||
kind, key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
((t.getType() == IToken.tDOTSTAR)
|
||||
|
@ -1372,7 +1405,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("pmExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -1392,6 +1425,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
// TO DO: we need proper symbol checkint to ensure type name
|
||||
if (LT(1) == IToken.tLPAREN) {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IToken mark = mark();
|
||||
consume();
|
||||
if (templateIdScopes != null) {
|
||||
|
@ -1423,6 +1457,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
typeId.freeReferences(astFactory.getReferenceManager());
|
||||
return unaryExpression(scope, kind, key);
|
||||
}
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
mark = null; // clean up mark so that we can garbage collect
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
|
@ -1432,7 +1467,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("castExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
} catch (BacktrackException b) {
|
||||
if (templateIdScopes != null && !popped) {
|
||||
|
@ -1606,14 +1641,15 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
kind = IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME;
|
||||
} catch (BacktrackException b) {
|
||||
backup(mark);
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(b);
|
||||
}
|
||||
}
|
||||
|
||||
} while (false);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (kind == null)
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
|
||||
TypeId id = getTypeIdInstance(scope);
|
||||
IToken last = lastToken;
|
||||
|
@ -1633,6 +1669,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
last = temp;
|
||||
}
|
||||
|
||||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
String signature = "";//$NON-NLS-1$
|
||||
if (last != null)
|
||||
|
@ -1651,7 +1688,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("typeId::createTypeId()", e); //$NON-NLS-1$
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1672,6 +1709,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
if (LT(1) == IToken.tCOLONCOLON) {
|
||||
// global scope
|
||||
consume(IToken.tCOLONCOLON);
|
||||
|
@ -1687,6 +1725,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
vectored = true;
|
||||
}
|
||||
IASTExpression castExpression = castExpression(scope, kind, key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope, (vectored
|
||||
? IASTExpression.Kind.DELETE_VECTORCASTEXPRESSION
|
||||
|
@ -1696,7 +1735,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("deleteExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1722,6 +1761,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
setCompletionValues(scope, CompletionKind.NEW_TYPE_REFERENCE,
|
||||
KeywordSetKey.EMPTY);
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
if (LT(1) == IToken.tCOLONCOLON) {
|
||||
// global scope
|
||||
consume(IToken.tCOLONCOLON);
|
||||
|
@ -1821,6 +1861,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
// Worst-case scenario - this cannot be resolved w/o more semantic information.
|
||||
// Luckily, we don't need to know what was that - we only know that
|
||||
// new-expression ends here.
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
setCompletionValues(scope,
|
||||
CompletionKind.NO_SUCH_KIND,
|
||||
|
@ -1837,7 +1878,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"newExpression_1::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
} catch (BacktrackException e) {
|
||||
|
@ -1895,6 +1936,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND,
|
||||
KeywordSetKey.EMPTY);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.NEW_TYPEID, null, null, null, typeId,
|
||||
|
@ -1906,7 +1948,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
return null;
|
||||
} catch (Exception e) {
|
||||
logException("newExpression_2::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1924,6 +1966,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
public IASTExpression unaryExpression(IASTScope scope, CompletionKind kind,
|
||||
KeywordSetKey key) throws EndOfFileException, BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
switch (LT(1)) {
|
||||
case IToken.tSTAR :
|
||||
consume();
|
||||
|
@ -1980,6 +2023,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} else {
|
||||
unaryExpression = unaryExpression(scope, kind, key);
|
||||
}
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (unaryExpression == null)
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
|
@ -1989,7 +2033,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("unaryExpression_1::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
|
@ -2000,7 +2044,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e1.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("unaryExpression_1::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
case IToken.t_new :
|
||||
return newExpression(scope, key);
|
||||
|
@ -2036,6 +2080,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
CompletionKind kind, KeywordSetKey key) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression firstExpression = null;
|
||||
boolean isTemplate = false;
|
||||
|
||||
|
@ -2058,10 +2103,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
IASTExpression expressionList = expression(scope,
|
||||
CompletionKind.TYPE_REFERENCE, key);
|
||||
consume(IToken.tRPAREN);
|
||||
int endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
if (templateIdScopes != null) {
|
||||
templateIdScopes.pop();
|
||||
}
|
||||
|
||||
try {
|
||||
firstExpression = astFactory
|
||||
.createExpression(
|
||||
|
@ -2075,7 +2121,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(ase.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("postfixExpression_1::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
// simple-type-specifier ( assignment-expression , .. )
|
||||
|
@ -2150,7 +2196,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
isTypeId = false;
|
||||
lhs = expression(scope, CompletionKind.TYPE_REFERENCE, key);
|
||||
}
|
||||
consume(IToken.tRPAREN);
|
||||
endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
if (templateIdScopes != null) {
|
||||
templateIdScopes.pop();
|
||||
}
|
||||
|
@ -2167,7 +2213,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e6.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("postfixExpression_2::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -2184,7 +2230,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
}
|
||||
secondExpression = expression(scope,
|
||||
CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
consume(IToken.tRBRACKET);
|
||||
int endOffset = consume(IToken.tRBRACKET).getEndOffset();
|
||||
if (templateIdScopes != null) {
|
||||
templateIdScopes.pop();
|
||||
}
|
||||
|
@ -2198,7 +2244,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_3::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
case IToken.tLPAREN :
|
||||
|
@ -2228,7 +2274,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
secondExpression = expression(scope,
|
||||
CompletionKind.FUNCTION_REFERENCE, key);
|
||||
setCurrentFunctionName(EMPTY_STRING);
|
||||
consume(IToken.tRPAREN);
|
||||
endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
if (templateIdScopes != null) {
|
||||
templateIdScopes.pop();
|
||||
}
|
||||
|
@ -2242,11 +2288,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_4::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
case IToken.tINCR :
|
||||
consume(IToken.tINCR);
|
||||
endOffset = consume(IToken.tINCR).getEndOffset();
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_INCREMENT,
|
||||
|
@ -2257,11 +2303,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_5::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
case IToken.tDECR :
|
||||
consume();
|
||||
endOffset = consume().getEndOffset();
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.POSTFIX_DECREMENT,
|
||||
|
@ -2272,7 +2318,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_6::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
case IToken.tDOT :
|
||||
|
@ -2294,6 +2340,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
memberCompletionKind);
|
||||
secondExpression = primaryExpression(scope,
|
||||
CompletionKind.MEMBER_REFERENCE, key);
|
||||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (secondExpression != null
|
||||
&& secondExpression.getExpressionKind() == Kind.ID_EXPRESSION
|
||||
&& secondExpression.getIdExpression().indexOf('~') != -1)
|
||||
|
@ -2309,7 +2356,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_7::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
case IToken.tARROW :
|
||||
|
@ -2331,7 +2378,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
arrowCompletionKind);
|
||||
secondExpression = primaryExpression(scope,
|
||||
CompletionKind.MEMBER_REFERENCE, key);
|
||||
|
||||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (secondExpression != null
|
||||
&& secondExpression.getExpressionKind() == Kind.ID_EXPRESSION
|
||||
&& secondExpression.getIdExpression().indexOf('~') != -1)
|
||||
|
@ -2346,7 +2393,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"postfixExpression_8::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
@ -2383,13 +2430,14 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
Kind type, KeywordSetKey key) throws EndOfFileException,
|
||||
BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
String typeName = consume().getImage();
|
||||
consume(IToken.tLPAREN);
|
||||
setCurrentFunctionName(typeName);
|
||||
IASTExpression inside = expression(scope,
|
||||
CompletionKind.CONSTRUCTOR_REFERENCE, key);
|
||||
setCurrentFunctionName(EMPTY_STRING);
|
||||
consume(IToken.tRPAREN);
|
||||
int endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
try {
|
||||
return astFactory.createExpression(scope, type, inside, null, null,
|
||||
null, null, EMPTY_STRING, null);
|
||||
|
@ -2398,7 +2446,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"simpleTypeConstructorExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -2423,7 +2471,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e1.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_1::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
case IToken.tFLOATINGPT :
|
||||
t = consume();
|
||||
|
@ -2435,7 +2483,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e2.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_2::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
case IToken.tSTRING :
|
||||
case IToken.tLSTRING :
|
||||
|
@ -2448,7 +2496,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e5.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_3::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
|
||||
case IToken.t_false :
|
||||
|
@ -2462,7 +2510,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e3.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_4::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
|
||||
case IToken.tCHAR :
|
||||
|
@ -2477,7 +2525,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e4.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_5::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
|
||||
case IToken.t_this :
|
||||
|
@ -2490,7 +2538,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e7.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_6::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
case IToken.tLPAREN :
|
||||
t = consume();
|
||||
|
@ -2498,7 +2546,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
templateIdScopes.push(new Integer(IToken.tLPAREN));
|
||||
}
|
||||
IASTExpression lhs = expression(scope, kind, key);
|
||||
consume(IToken.tRPAREN);
|
||||
int endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
if (templateIdScopes != null) {
|
||||
templateIdScopes.pop();
|
||||
}
|
||||
|
@ -2510,7 +2558,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e6.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_7::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), endOffset, t.getLineNumber() );
|
||||
}
|
||||
case IToken.tIDENTIFIER :
|
||||
case IToken.tCOLONCOLON :
|
||||
|
@ -2518,6 +2566,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
case IToken.tCOMPL :
|
||||
ITokenDuple duple = null;
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
try {
|
||||
duple = name(scope, kind, key);
|
||||
} catch (BacktrackException bt) {
|
||||
|
@ -2541,7 +2590,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
operatorId(d, start, null, kind);
|
||||
else {
|
||||
backup(mark);
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, end.getEndOffset(), end.getLineNumber());
|
||||
}
|
||||
} else if (LT(1) == IToken.t_operator)
|
||||
operatorId(d, null, null, kind);
|
||||
|
@ -2549,6 +2598,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
duple = d.getNameDuple();
|
||||
}
|
||||
|
||||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope,
|
||||
IASTExpression.Kind.ID_EXPRESSION, null, null,
|
||||
|
@ -2557,10 +2607,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e8.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_8::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
default :
|
||||
startingOffset = LA(1).getOffset();
|
||||
line = LA(1).getLineNumber();
|
||||
if (!queryLookaheadCapability(2)) {
|
||||
if (LA(1).canBeAPrefix()) {
|
||||
consume();
|
||||
|
@ -2577,7 +2628,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
return null;
|
||||
} catch (Exception e) {
|
||||
logException("primaryExpression_9::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, 0, line);
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
@ -2630,7 +2681,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IToken t = consume();
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,
|
||||
completionKind, key);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope, kind, lhs,
|
||||
assignmentExpression, null, null, null, EMPTY_STRING, null);
|
||||
|
@ -2638,7 +2689,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("assignmentOperatorExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), endOffset, t.getLineNumber());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -2667,8 +2718,10 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
IASTExpression.Kind kind, CompletionKind completionKind,
|
||||
KeywordSetKey key) throws EndOfFileException, BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
IASTExpression castExpression = castExpression(scope, completionKind,
|
||||
key);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
try {
|
||||
return astFactory.createExpression(scope, kind, castExpression,
|
||||
null, null, null, null, EMPTY_STRING, null);
|
||||
|
@ -2676,7 +2729,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("unaryOperatorCastExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -2684,6 +2737,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
protected IASTExpression specialCastExpression(IASTScope scope,
|
||||
IASTExpression.Kind kind, KeywordSetKey key)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
int line = LA(1).getLineNumber();
|
||||
int startingOffset = consume().getOffset();
|
||||
consume(IToken.tLT);
|
||||
IASTTypeId duple = typeId(scope, false, CompletionKind.TYPE_REFERENCE);
|
||||
|
@ -2691,7 +2745,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
consume(IToken.tLPAREN);
|
||||
IASTExpression lhs = expression(scope,
|
||||
CompletionKind.SINGLE_NAME_REFERENCE, key);
|
||||
consume(IToken.tRPAREN);
|
||||
int endOffset = consume(IToken.tRPAREN).getEndOffset();
|
||||
try {
|
||||
return astFactory.createExpression(scope, kind, lhs, null, null,
|
||||
duple, null, EMPTY_STRING, null);
|
||||
|
@ -2699,7 +2753,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
logException("specialCastExpression::createExpression()", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -101,24 +101,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
protected void failParse( BacktrackException bt ) {
|
||||
if( bt.getProblem() == null )
|
||||
{
|
||||
IToken referenceToken = null;
|
||||
if( lastToken != null )
|
||||
referenceToken = lastToken;
|
||||
else
|
||||
try
|
||||
{
|
||||
referenceToken = LA(1);
|
||||
}
|
||||
catch( EndOfFileException eof )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IProblem problem = problemFactory.createProblem(
|
||||
IProblem.SYNTAX_ERROR,
|
||||
bt.getStartingOffset(),
|
||||
referenceToken.getOffset(),
|
||||
referenceToken.getLineNumber(),
|
||||
bt.getEndOffset(),
|
||||
bt.getLineNumber(),
|
||||
scanner.getCurrentFilename(),
|
||||
EMPTY_STRING,
|
||||
false,
|
||||
|
@ -190,7 +177,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
return;
|
||||
}
|
||||
|
||||
int lastBacktrack = -1;
|
||||
// int lastBacktrack = -1;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -212,17 +199,18 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
// Mark as failure and try to reach a recovery point
|
||||
failParse(b);
|
||||
if (lastBacktrack != -1 && lastBacktrack == LA(1).hashCode())
|
||||
{
|
||||
// we haven't progressed from the last backtrack
|
||||
// try and find tne next definition
|
||||
failParseWithErrorHandling();
|
||||
}
|
||||
else
|
||||
{
|
||||
// start again from here
|
||||
lastBacktrack = LA(1).hashCode();
|
||||
}
|
||||
errorHandling();
|
||||
// if (lastBacktrack != -1 && lastBacktrack == LA(1).hashCode())
|
||||
// {
|
||||
// // we haven't progressed from the last backtrack
|
||||
// // try and find tne next definition
|
||||
// failParseWithErrorHandling();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // start again from here
|
||||
// lastBacktrack = LA(1).hashCode();
|
||||
// }
|
||||
}
|
||||
catch (EndOfFileException e)
|
||||
{
|
||||
|
@ -317,10 +305,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
setCompletionValues(scope, CompletionKind.NAMESPACE_REFERENCE, KeywordSetKey.EMPTY );
|
||||
// optional :: and nested classes handled in name
|
||||
ITokenDuple duple = null;
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
|
||||
duple = name(scope, CompletionKind.NAMESPACE_REFERENCE, KeywordSetKey.EMPTY);
|
||||
else
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), endOffset, firstToken.getLineNumber());
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
{
|
||||
IToken last = consume(IToken.tSEMI);
|
||||
|
@ -333,12 +322,13 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "usingClause:createUsingDirective", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), last.getEndOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
astUD.acceptElement(requestor, astFactory.getReferenceManager());
|
||||
return astUD;
|
||||
}
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
throwBacktrack(firstToken.getOffset(), endOffset, firstToken.getLineNumber());
|
||||
}
|
||||
boolean typeName = false;
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, KeywordSetKey.POST_USING );
|
||||
|
@ -358,7 +348,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
else
|
||||
{
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), ( lastToken != null ) ? lastToken.getEndOffset() : 0, firstToken.getLineNumber());
|
||||
}
|
||||
if (LT(1) == IToken.tSEMI)
|
||||
{
|
||||
|
@ -377,13 +367,14 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "usingClause:createUsingDeclaration", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), last.getEndOffset(), firstToken.getLineNumber());
|
||||
}
|
||||
declaration.acceptElement( requestor, astFactory.getReferenceManager() );
|
||||
setCompletionValues(scope, getCompletionKindForDeclaration(scope, null), KeywordSetKey.DECLARATION );
|
||||
return declaration;
|
||||
}
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
throwBacktrack(firstToken.getOffset(), endOffset, firstToken.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
|
@ -404,12 +395,12 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
IToken firstToken = consume(IToken.t_extern);
|
||||
if (LT(1) != IToken.tSTRING)
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), firstToken.getEndOffset(), firstToken.getLineNumber());
|
||||
IToken spec = consume(IToken.tSTRING);
|
||||
|
||||
if (LT(1) == IToken.tLBRACE)
|
||||
{
|
||||
consume(IToken.tLBRACE);
|
||||
IToken lbrace = consume(IToken.tLBRACE);
|
||||
IASTLinkageSpecification linkage = null;
|
||||
try
|
||||
{
|
||||
|
@ -422,7 +413,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
logException( "linkageSpecification_1:createLinkageSpecification", e ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), lbrace.getEndOffset(), lbrace.getLineNumber());
|
||||
}
|
||||
|
||||
linkage.enterScope( requestor, astFactory.getReferenceManager() );
|
||||
|
@ -457,6 +448,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
// single declaration
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
IASTLinkageSpecification linkage;
|
||||
try
|
||||
{
|
||||
|
@ -469,7 +461,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
logException( "linkageSpecification_2:createLinkageSpecification", e ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), endOffset, firstToken.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
linkage.enterScope( requestor, astFactory.getReferenceManager() );
|
||||
|
@ -523,7 +515,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
logException( "templateDeclaration:createTemplateInstantiation", e ); //$NON-NLS-1$
|
||||
backup( mark );
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), firstToken.getEndOffset(), firstToken.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
templateInstantiation.enterScope( requestor, astFactory.getReferenceManager() );
|
||||
|
@ -536,7 +528,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
consume(IToken.tLT);
|
||||
if (LT(1) == IToken.tGT)
|
||||
{
|
||||
consume(IToken.tGT);
|
||||
IToken gt = consume(IToken.tGT);
|
||||
// explicit-specialization
|
||||
|
||||
IASTTemplateSpecialization templateSpecialization;
|
||||
|
@ -551,7 +543,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
logException( "templateDeclaration:createTemplateSpecialization", e ); //$NON-NLS-1$
|
||||
backup( mark );
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), gt.getEndOffset(), gt.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
templateSpecialization.enterScope(requestor, astFactory.getReferenceManager());
|
||||
|
@ -566,7 +558,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
try
|
||||
{
|
||||
List parms = templateParameterList(scope);
|
||||
consume(IToken.tGT);
|
||||
IToken gt = consume(IToken.tGT);
|
||||
IASTTemplateDeclaration templateDecl;
|
||||
try
|
||||
{
|
||||
|
@ -580,7 +572,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
logException( "templateDeclaration:createTemplateDeclaration", e ); //$NON-NLS-1$
|
||||
throwBacktrack(firstToken.getOffset());
|
||||
throwBacktrack(firstToken.getOffset(), gt.getEndOffset(), gt.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
templateDecl.enterScope( requestor, astFactory.getReferenceManager() );
|
||||
|
@ -633,7 +625,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if( parameterScope == null )
|
||||
parameterScope = scope;
|
||||
|
||||
int startingOffset = LA(1).getOffset();
|
||||
IToken la = LA(1);
|
||||
int startingOffset = la.getOffset();
|
||||
int lnum = la.getLineNumber();
|
||||
for (;;)
|
||||
{
|
||||
if (LT(1) == IToken.tGT)
|
||||
|
@ -680,10 +674,14 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
(id != null) ? id.getLineNumber() : 0,
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber() ));
|
||||
}
|
||||
catch( ASTSemanticException ase )
|
||||
{
|
||||
throwBacktrack(ase.getProblem());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logException( "templateParameterList_1:createTemplateParameter", e ); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, ( lastToken != null ) ? lastToken.getEndOffset() : 0, lnum);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -726,10 +724,15 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
(optionalId != null) ? optionalId.getLineNumber() : 0,
|
||||
lastToken.getEndOffset(), lastToken.getLineNumber() ));
|
||||
}
|
||||
catch( ASTSemanticException ase )
|
||||
{
|
||||
throwBacktrack(ase.getProblem());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException( "templateParameterList_2:createTemplateParameter", e ); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, lnum);
|
||||
}
|
||||
}
|
||||
else if (LT(1) == IToken.tCOMMA)
|
||||
|
@ -768,10 +771,15 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getNameLine(),
|
||||
wrapper.getEndOffset(), wrapper.getEndLine() ));
|
||||
}
|
||||
catch( ASTSemanticException ase )
|
||||
{
|
||||
throwBacktrack(ase.getProblem());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException( "templateParameterList:createParameterDeclaration", e ); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, lnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -829,7 +837,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
logException( "declaration:createASMDefinition", e ); //$NON-NLS-1$
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), last.getEndOffset(), first.getLineNumber());
|
||||
}
|
||||
// if we made it this far, then we have all we need
|
||||
// do the callback
|
||||
|
@ -948,7 +956,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
if (LT(1) == IToken.tLBRACE)
|
||||
{
|
||||
consume();
|
||||
IToken lbrace = consume();
|
||||
IASTNamespaceDefinition namespaceDefinition = null;
|
||||
try
|
||||
{
|
||||
|
@ -964,8 +972,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
|
||||
logException( "namespaceDefinition:createNamespaceDefinition", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), lbrace.getEndOffset(), first.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
namespaceDefinition.enterScope( requestor, astFactory.getReferenceManager() );
|
||||
|
@ -1007,16 +1016,16 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
else if( LT(1) == IToken.tASSIGN )
|
||||
{
|
||||
setCompletionValues(scope, CompletionKind.NO_SUCH_KIND,KeywordSetKey.EMPTY);
|
||||
consume( IToken.tASSIGN );
|
||||
IToken assign = consume( IToken.tASSIGN );
|
||||
|
||||
if( identifier == null )
|
||||
{
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), assign.getEndOffset(), first.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
|
||||
ITokenDuple duple = name(scope, CompletionKind.NAMESPACE_REFERENCE, KeywordSetKey.EMPTY);
|
||||
consume( IToken.tSEMI );
|
||||
IToken semi = consume( IToken.tSEMI );
|
||||
setCompletionValues(scope, kind, KeywordSetKey.DECLARATION );
|
||||
IASTNamespaceAlias alias = null;
|
||||
try
|
||||
|
@ -1028,14 +1037,15 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "namespaceDefinition:createNamespaceAlias", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(first.getOffset());
|
||||
throwBacktrack(first.getOffset(), semi.getEndOffset(), first.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
return alias;
|
||||
}
|
||||
else
|
||||
{
|
||||
throwBacktrack(first.getOffset());
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
throwBacktrack(first.getOffset(), endOffset, first.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1068,7 +1078,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
IToken firstToken = LA(1);
|
||||
int firstOffset = firstToken.getOffset();
|
||||
if( firstToken.getType() == IToken.tLBRACE ) throwBacktrack(firstToken.getOffset());
|
||||
int firstLine = firstToken.getLineNumber();
|
||||
if( firstToken.getType() == IToken.tLBRACE ) throwBacktrack(firstToken.getOffset(), firstToken.getEndOffset(), firstToken.getLineNumber());
|
||||
DeclarationWrapper sdw =
|
||||
new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate);
|
||||
firstToken = null; // necessary for scalability
|
||||
|
@ -1098,8 +1109,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException( "simpleDeclaration:createSimpleTypeSpecifier", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, endOffset, firstLine);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1140,10 +1152,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
case IToken.tRPAREN:
|
||||
if( ! fromCatchHandler )
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, LA(1).getEndOffset(), LA(1).getLineNumber());
|
||||
break;
|
||||
default:
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, LA(1).getEndOffset(), LA(1).getLineNumber());
|
||||
}
|
||||
|
||||
if( ! consumedSemi )
|
||||
|
@ -1155,9 +1167,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
|
||||
if( hasFunctionTryBlock && ! hasFunctionBody )
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, LA(1).getEndOffset(), LA(1).getLineNumber());
|
||||
}
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
List l = null;
|
||||
try
|
||||
{
|
||||
|
@ -1181,12 +1193,12 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch( Exception e )
|
||||
{
|
||||
logException( "simpleDecl", e ); //$NON-NLS-1$
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, endOffset, firstLine);
|
||||
}
|
||||
|
||||
if (hasFunctionBody && l.size() != 1)
|
||||
{
|
||||
throwBacktrack(firstOffset); //TODO Should be an IProblem
|
||||
throwBacktrack(firstOffset, endOffset, firstLine); //TODO Should be an IProblem
|
||||
}
|
||||
if (!l.isEmpty()) // no need to do this unless we have a declarator
|
||||
{
|
||||
|
@ -1212,7 +1224,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
((IASTSimpleTypeSpecifier)sdw.getTypeSpecifier()).releaseReferences( astFactory.getReferenceManager() );
|
||||
|
||||
if ( !( declaration instanceof IASTScope ) )
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, endOffset, firstLine);
|
||||
|
||||
handleFunctionBody((IASTScope)declaration );
|
||||
((IASTOffsetableElement)declaration).setEndingOffsetAndLineNumber(
|
||||
|
@ -1245,7 +1257,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "simpleDeclaration:createTypeSpecDeclaration", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(firstOffset);
|
||||
throwBacktrack(firstOffset, endOffset, firstLine);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1316,7 +1328,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
expressionList = expression(d.getDeclarationWrapper().getScope(), CompletionKind.SINGLE_NAME_REFERENCE, KeywordSetKey.EXPRESSION);
|
||||
|
||||
consume(IToken.tRPAREN);
|
||||
IToken rparen = consume(IToken.tRPAREN);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1328,7 +1340,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
catch (Exception e1)
|
||||
{
|
||||
logException( "ctorInitializer:addConstructorMemberInitializer", e1 ); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, rparen.getEndOffset(), rparen.getLineNumber());
|
||||
}
|
||||
if (LT(1) == IToken.tLBRACE)
|
||||
break;
|
||||
|
@ -1382,8 +1394,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException( "parameterDeclaration:createSimpleTypeSpecifier", e ); //$NON-NLS-1$
|
||||
throwBacktrack(current.getOffset());
|
||||
throwBacktrack(current.getOffset(), endOffset, current.getLineNumber());
|
||||
}
|
||||
|
||||
setCompletionValues(scope,CompletionKind.SINGLE_NAME_REFERENCE,KeywordSetKey.EMPTY );
|
||||
|
@ -1394,7 +1407,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
sdw.setEndingOffsetAndLineNumber( lastToken.getEndOffset(), lastToken.getLineNumber() );
|
||||
|
||||
if (current == LA(1))
|
||||
throwBacktrack(current.getOffset());
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
throwBacktrack(current.getOffset(), endOffset, current.getLineNumber());
|
||||
}
|
||||
collection.addParameter(sdw);
|
||||
}
|
||||
/**
|
||||
|
@ -1884,7 +1900,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
default :
|
||||
backup(t);
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), t.getEndOffset(), t.getLineNumber());
|
||||
}
|
||||
|
||||
ITokenDuple d = name(sdw.getScope(), completionKind,
|
||||
|
@ -1900,9 +1916,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e) {
|
||||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException(
|
||||
"elaboratedTypeSpecifier:createElaboratedTypeSpecifier", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), endOffset, t.getLineNumber());
|
||||
}
|
||||
sdw.setTypeSpecifier(elaboratedTypeSpec);
|
||||
|
||||
|
@ -2021,6 +2038,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
List designators, boolean constructInitializers)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
if (LT(1) == IToken.tLBRACE) {
|
||||
consume(IToken.tLBRACE);
|
||||
List initializerList = new ArrayList();
|
||||
|
@ -2044,7 +2062,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (LT(1) == IToken.tRBRACE)
|
||||
break;
|
||||
if (checkHashcode == LA(1).hashCode()) {
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, LA(1).getEndOffset(), LA(1).getLineNumber());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2073,13 +2091,15 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
assignmentExpression, null, designators,
|
||||
constructInitializers);
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException("cInitializerClause:createInitializerClause", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
} catch (BacktrackException b) {
|
||||
// do nothing
|
||||
}
|
||||
throwBacktrack(startingOffset);
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
|
@ -2090,8 +2110,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
BacktrackException {
|
||||
if (LT(1) == IToken.tLBRACE) {
|
||||
IToken t = consume(IToken.tLBRACE);
|
||||
IToken last = null;
|
||||
if (LT(1) == (IToken.tRBRACE)) {
|
||||
consume(IToken.tRBRACE);
|
||||
last = consume(IToken.tRBRACE);
|
||||
try {
|
||||
return createInitializerClause(scope,
|
||||
IASTInitializerClause.Kind.EMPTY, null, null,
|
||||
|
@ -2099,7 +2120,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (Exception e) {
|
||||
logException(
|
||||
"initializerClause_1:createInitializerClause", e); //$NON-NLS-1$
|
||||
throwBacktrack(t.getOffset());
|
||||
throwBacktrack(t.getOffset(), last.getEndOffset(), t.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -2119,7 +2140,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
break;
|
||||
consume(IToken.tCOMMA);
|
||||
}
|
||||
consume(IToken.tRBRACE);
|
||||
last = consume(IToken.tRBRACE);
|
||||
try {
|
||||
return createInitializerClause(scope,
|
||||
IASTInitializerClause.Kind.INITIALIZER_LIST, null,
|
||||
|
@ -2129,7 +2150,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
constructInitializers);
|
||||
} catch (Exception e) {
|
||||
logException("initializerClause_2:createInitializerClause", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, last.getEndOffset(), last.getLineNumber());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -2138,11 +2159,12 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
// try this now instead
|
||||
// assignmentExpression
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
|
||||
IASTExpression assignmentExpression = assignmentExpression(scope,
|
||||
CompletionKind.SINGLE_NAME_REFERENCE,
|
||||
KeywordSetKey.EXPRESSION);
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
try {
|
||||
return createInitializerClause(scope,
|
||||
IASTInitializerClause.Kind.ASSIGNMENT_EXPRESSION,
|
||||
|
@ -2150,9 +2172,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
constructInitializers);
|
||||
} catch (Exception e) {
|
||||
logException("initializerClause_3:createInitializerClause", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
}
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2250,6 +2271,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
Declarator d = null;
|
||||
DeclarationWrapper sdw = owner.getDeclarationWrapper();
|
||||
int startingOffset = LA(1).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
overallLoop : do {
|
||||
d = new Declarator(owner);
|
||||
|
||||
|
@ -2287,9 +2309,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
parameterScope, queryName))
|
||||
failed = true;
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException(
|
||||
"declarator:queryIsTypeName", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
} catch (BacktrackException b) {
|
||||
failed = true;
|
||||
|
@ -2334,8 +2357,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
seenParameter = false;
|
||||
break;
|
||||
default :
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
if (seenParameter)
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
parameterDeclaration(d, parameterScope);
|
||||
seenParameter = true;
|
||||
}
|
||||
|
@ -2409,9 +2433,10 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e) {
|
||||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException(
|
||||
"declarator:createExceptionSpecification", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
}
|
||||
// check for optional pure virtual
|
||||
|
@ -2513,9 +2538,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
? argumentList
|
||||
: null), kind);
|
||||
else {
|
||||
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
backup(mark);
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2565,8 +2590,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e) {
|
||||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException("enumSpecifier:createEnumerationSpecifier", e); //$NON-NLS-1$
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
handleEnumeration( enumeration );
|
||||
consume(IToken.tLBRACE);
|
||||
|
@ -2575,7 +2601,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (LT(1) == IToken.tIDENTIFIER) {
|
||||
enumeratorIdentifier = identifier();
|
||||
} else {
|
||||
throwBacktrack(LA(1).getOffset());
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(la.getOffset(), la.getEndOffset(), la.getLineNumber());
|
||||
}
|
||||
IASTExpression initialValue = null;
|
||||
if (LT(1) == IToken.tASSIGN) {
|
||||
|
@ -2600,8 +2627,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e1) {
|
||||
throwBacktrack(e1.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException("enumSpecifier:addEnumerator", e); //$NON-NLS-1$
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2611,7 +2639,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (enumerator != null)
|
||||
enumerator.freeReferences(astFactory
|
||||
.getReferenceManager());
|
||||
throwBacktrack(mark.getOffset());
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
try {
|
||||
enumerator = astFactory.addEnumerator(enumeration,
|
||||
|
@ -2627,8 +2656,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e1) {
|
||||
throwBacktrack(e1.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException("enumSpecifier:addEnumerator", e); //$NON-NLS-1$
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
consume(IToken.tCOMMA);
|
||||
}
|
||||
|
@ -2640,8 +2670,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
sdw.setTypeSpecifier(enumeration);
|
||||
} else {
|
||||
// enumSpecifierAbort
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
backup(mark);
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -2684,7 +2715,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
completionKind = CompletionKind.UNION_REFERENCE;
|
||||
break;
|
||||
default :
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), mark.getEndOffset(), mark.getLineNumber());
|
||||
}
|
||||
|
||||
ITokenDuple duple = null;
|
||||
|
@ -2696,8 +2727,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
if (duple != null && !duple.isIdentifier())
|
||||
nameType = ClassNameType.TEMPLATE;
|
||||
if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE) {
|
||||
IToken errorPoint = LA(1);
|
||||
backup(mark);
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(errorPoint.getOffset(), errorPoint.getEndOffset(), errorPoint.getLineNumber());
|
||||
}
|
||||
IASTClassSpecifier astClassSpecifier = null;
|
||||
|
||||
|
@ -2713,8 +2745,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
} catch (ASTSemanticException e) {
|
||||
throwBacktrack(e.getProblem());
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException("classSpecifier:createClassSpecifier", e); //$NON-NLS-1$
|
||||
throwBacktrack(mark.getOffset());
|
||||
throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber());
|
||||
}
|
||||
sdw.setTypeSpecifier(astClassSpecifier);
|
||||
// base clause
|
||||
|
@ -2774,7 +2807,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
astFactory.signalEndOfClassSpecifier(astClassSpecifier);
|
||||
} catch (Exception e1) {
|
||||
logException("classSpecifier:signalEndOfClassSpecifier", e1); //$NON-NLS-1$
|
||||
throwBacktrack(lt.getOffset());
|
||||
throwBacktrack(lt.getOffset(), lt.getEndOffset(), lt.getLineNumber());
|
||||
}
|
||||
|
||||
astClassSpecifier.exitScope(requestor, astFactory
|
||||
|
@ -2800,6 +2833,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
throws EndOfFileException, BacktrackException
|
||||
{
|
||||
int startingOffset = consume(IToken.tCOLON).getOffset();
|
||||
int line = LA(1).getLineNumber();
|
||||
|
||||
setCompletionValues(astClassSpec.getOwnerScope(), CompletionKind.CLASS_REFERENCE, KeywordSetKey.BASE_SPECIFIER );
|
||||
boolean isVirtual = false;
|
||||
|
@ -2883,8 +2917,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
failParse( e.getProblem() );
|
||||
} catch (Exception e)
|
||||
{
|
||||
int endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0 ;
|
||||
logException( "baseSpecifier_2::addBaseSpecifier", e ); //$NON-NLS-1$
|
||||
throwBacktrack( startingOffset );
|
||||
throwBacktrack( startingOffset, endOffset, line );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3086,8 +3121,12 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
protected void catchHandlerSequence(IASTScope scope)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
|
||||
if (LT(1) != IToken.t_catch)
|
||||
throwBacktrack(LA(1).getOffset()); // error, need at least one of these
|
||||
{
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(la.getOffset(), la.getEndOffset(), la.getLineNumber()); // error, need at least one of these
|
||||
}
|
||||
while (LT(1) == IToken.t_catch) {
|
||||
consume(IToken.t_catch);
|
||||
consume(IToken.tLPAREN);
|
||||
|
@ -3113,7 +3152,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
newScope = astFactory.createNewCodeBlock(scope);
|
||||
} catch (Exception e) {
|
||||
logException("singleStatementScope:createNewCodeBlock", e); //$NON-NLS-1$
|
||||
throwBacktrack(LA(1).getOffset());
|
||||
IToken la = LA(1);
|
||||
throwBacktrack(la.getOffset(), la.getEndOffset(), la.getLineNumber());
|
||||
return;
|
||||
}
|
||||
newScope.enterScope(requestor, astFactory.getReferenceManager());
|
||||
|
@ -3166,6 +3206,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
*/
|
||||
protected void compoundStatement(IASTScope scope, boolean createNewScope)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
int line = LA(1).getLineNumber();
|
||||
int startingOffset = consume(IToken.tLBRACE).getOffset();
|
||||
|
||||
IASTCodeScope newScope = null;
|
||||
|
@ -3173,8 +3214,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
try {
|
||||
newScope = astFactory.createNewCodeBlock(scope);
|
||||
} catch (Exception e) {
|
||||
int endOffset = ( lastToken == null ) ? 0 : lastToken.getEndOffset();
|
||||
logException("compoundStatement:createNewCodeBlock", e); //$NON-NLS-1$
|
||||
throwBacktrack(startingOffset);
|
||||
throwBacktrack(startingOffset, endOffset, line);
|
||||
}
|
||||
newScope.enterScope(requestor, astFactory.getReferenceManager());
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class IndexerOptionDialogPage extends DialogPage {
|
|||
preprocessorProblemsEnabled = createCheckButton( problemsGroup, ENABLE_PREPROCESSOR_PROBLEMS );
|
||||
semanticProblemsEnabled = createCheckButton( problemsGroup, ENABLE_SEMANTIC_PROBLEMS );
|
||||
//uncomment when we want to report syntax problems
|
||||
//syntacticProblemsEnabled = createCheckButton( problemsGroup, ENABLE_SYNTACTIC_PROBLEMS );
|
||||
syntacticProblemsEnabled = createCheckButton( problemsGroup, ENABLE_SYNTACTIC_PROBLEMS );
|
||||
setControl(result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue