1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00
This commit is contained in:
John Camelon 2004-06-14 14:02:22 +00:00
parent 611017bdcf
commit 85be18a5f9
5 changed files with 4179 additions and 4389 deletions

View file

@ -2244,4 +2244,10 @@ public class QuickParseASTTests extends BaseASTTest
assertFalse( iter.hasNext() );
}
}
public void testBadIdentifier() throws Exception
{
parse( "class 0302 { private: int stinks; };", true, false ); //$NON-NLS-1$
}
}

View file

@ -16,4 +16,53 @@ package org.eclipse.cdt.core.parser;
*/
public class BacktrackException extends Exception
{
private IProblem problem;
private int startOffset;
private int endOffset;
/**
* @param p
*/
public void initialize(IProblem p) {
reset();
problem = p;
}
/**
*
*/
private void reset() {
problem = null;
startOffset = 0;
endOffset = 0;
}
/**
* @return Returns the problem.
*/
public final IProblem getProblem() {
return problem;
}
/**
* @param startingOffset
* @param endingOffset
*/
public void initialize(int startingOffset, int endingOffset) {
reset();
startOffset = startingOffset;
endOffset = endingOffset;
}
/**
* @return Returns the offset.
*/
public final int getStartingOffset() {
return startOffset;
}
/**
* @return Returns the endOffset.
*/
public final int getEndOffset() {
return endOffset;
}
}

View file

@ -131,7 +131,9 @@ public class CompletionParser extends ContextualParser implements IParser {
protected void catchHandlerSequence(IASTScope scope)
throws EndOfFileException, BacktrackException {
if( LT(1) != IToken.t_catch )
throw backtrack; // error, need at least one of these
{
throwBacktrack(LA(1).getOffset()); // error, need at least one of these
}
while (LT(1) == IToken.t_catch)
{
consume(IToken.t_catch);