1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 333941: Squiqgly line for missing semicolons.

This commit is contained in:
Markus Schorn 2011-01-26 16:57:58 +00:00
parent 46a7cd35cd
commit c38a620170
6 changed files with 14 additions and 3 deletions

View file

@ -328,6 +328,13 @@ public interface IProblem
*/
public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
/**
* Missing semicolon.
* @since 5.3
*/
public final static int MISSING_SEMICOLON = SYNTAX_RELATED | 0x002;
@Deprecated
public final static int SEMANTICS_RELATED = 0x08000000;

View file

@ -168,6 +168,8 @@ public class ASTProblem extends ASTNode implements IASTProblem {
ParserMessages.getString("ScannerProblemFactory.error.scanner.badCharacter")); //$NON-NLS-1$
errorMessages.put(new Integer(SYNTAX_ERROR),
ParserMessages.getString("ParserProblemFactory.error.syntax.syntaxError")); //$NON-NLS-1$
errorMessages.put(new Integer(MISSING_SEMICOLON),
ParserMessages.getString("ParserProblemFactory.error.syntax.missingSemicolon")); //$NON-NLS-1$
}
/*

View file

@ -184,6 +184,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
*/
protected IToken declarationMark;
protected IToken nextToken;
protected IToken lastToken;
protected IToken lastTokenFromScanner;
protected boolean isCancelled = false;
@ -1866,7 +1867,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
if (foundSemicolon)
return expressionStatement;
throwBacktrack(createProblem(IProblem.SYNTAX_ERROR, calculateEndOffset(expressionStatement), 0), expressionStatement);
throwBacktrack(createProblem(IProblem.MISSING_SEMICOLON, calculateEndOffset(expressionStatement)-1, 1), expressionStatement);
return null; // Hint for java-compiler
}

View file

@ -399,7 +399,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
}
if (insertSemi) {
IASTProblem problem= createProblem(IProblem.SYNTAX_ERROR, endOffset, 0);
IASTProblem problem= createProblem(IProblem.MISSING_SEMICOLON, endOffset-1, 1);
throwBacktrack(problem, simpleDeclaration);
}
return simpleDeclaration;

View file

@ -2142,7 +2142,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
if (insertSemi) {
IASTProblem problem= createProblem(IProblem.SYNTAX_ERROR, endOffset, 0);
IASTProblem problem= createProblem(IProblem.MISSING_SEMICOLON, endOffset-1, 1);
throwBacktrack(problem, simpleDeclaration);
}
return simpleDeclaration;

View file

@ -43,6 +43,7 @@ ScannerProblemFactory.error.scanner.unexpectedEOF=Unexpected End Of File encount
ScannerProblemFactory.error.scanner.badCharacter=Bad character sequence encountered: {0}
ParserProblemFactory.error.syntax.syntaxError=Syntax error
ParserProblemFactory.error.syntax.missingSemicolon=Missing '';''
BaseProblemFactory.problemPattern={0} in file: {1}:{2, number, integer}