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:
parent
46a7cd35cd
commit
c38a620170
6 changed files with 14 additions and 3 deletions
|
@ -327,6 +327,13 @@ public interface IProblem
|
|||
* Syntax error, detected by the parser.
|
||||
*/
|
||||
public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
|
||||
|
||||
/**
|
||||
* Missing semicolon.
|
||||
* @since 5.3
|
||||
*/
|
||||
public final static int MISSING_SEMICOLON = SYNTAX_RELATED | 0x002;
|
||||
|
||||
|
||||
|
||||
@Deprecated
|
||||
|
|
|
@ -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$
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue