mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Partial fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=65610
This commit is contained in:
parent
611017bdcf
commit
85be18a5f9
5 changed files with 4179 additions and 4389 deletions
|
@ -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$
|
||||
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue