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