Java Code Examples for org.eclipse.jdt.core.compiler.IProblem#ParsingErrorInsertToCompletePhrase
The following examples show how to use
org.eclipse.jdt.core.compiler.IProblem#ParsingErrorInsertToCompletePhrase .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASTRecoveryPropagator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private boolean markIncludedProblems(int start, int end) { boolean foundProblems = false; next: for (int i = 0, max = this.problems.length; i < max; i++) { CategorizedProblem problem = this.problems[i]; if(this.usedOrIrrelevantProblems[i]) continue next; switch(problem.getID()) { case IProblem.ParsingErrorOnKeywordNoSuggestion : case IProblem.ParsingErrorOnKeyword : case IProblem.ParsingError : case IProblem.ParsingErrorNoSuggestion : case IProblem.ParsingErrorInsertTokenBefore : case IProblem.ParsingErrorInsertTokenAfter : case IProblem.ParsingErrorDeleteToken : case IProblem.ParsingErrorDeleteTokens : case IProblem.ParsingErrorMergeTokens : case IProblem.ParsingErrorInvalidToken : case IProblem.ParsingErrorMisplacedConstruct : case IProblem.ParsingErrorReplaceTokens : case IProblem.ParsingErrorNoSuggestionForTokens : case IProblem.ParsingErrorUnexpectedEOF : case IProblem.ParsingErrorInsertToComplete : case IProblem.ParsingErrorInsertToCompleteScope : case IProblem.ParsingErrorInsertToCompletePhrase : case IProblem.EndOfSource : case IProblem.InvalidHexa : case IProblem.InvalidOctal : case IProblem.InvalidCharacterConstant : case IProblem.InvalidEscape : case IProblem.InvalidInput : case IProblem.InvalidUnicodeEscape : case IProblem.InvalidFloat : case IProblem.NullSourceString : case IProblem.UnterminatedString : case IProblem.UnterminatedComment : case IProblem.InvalidDigit : break; default: this.usedOrIrrelevantProblems[i] = true; continue next; } int problemStart = problem.getSourceStart(); int problemEnd = problem.getSourceEnd(); if ((start <= problemStart) && (problemStart <= end) || (start <= problemEnd) && (problemEnd <= end)) { this.usedOrIrrelevantProblems[i] = true; foundProblems = true; } } return foundProblems; }
Example 2
Source File: ASTSyntaxErrorPropagator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private boolean checkAndTagAsMalformed(ASTNode node) { boolean tagWithErrors = false; search: for (int i = 0, max = this.problems.length; i < max; i++) { CategorizedProblem problem = this.problems[i]; switch(problem.getID()) { case IProblem.ParsingErrorOnKeywordNoSuggestion : case IProblem.ParsingErrorOnKeyword : case IProblem.ParsingError : case IProblem.ParsingErrorNoSuggestion : case IProblem.ParsingErrorInsertTokenBefore : case IProblem.ParsingErrorInsertTokenAfter : case IProblem.ParsingErrorDeleteToken : case IProblem.ParsingErrorDeleteTokens : case IProblem.ParsingErrorMergeTokens : case IProblem.ParsingErrorInvalidToken : case IProblem.ParsingErrorMisplacedConstruct : case IProblem.ParsingErrorReplaceTokens : case IProblem.ParsingErrorNoSuggestionForTokens : case IProblem.ParsingErrorUnexpectedEOF : case IProblem.ParsingErrorInsertToComplete : case IProblem.ParsingErrorInsertToCompleteScope : case IProblem.ParsingErrorInsertToCompletePhrase : case IProblem.EndOfSource : case IProblem.InvalidHexa : case IProblem.InvalidOctal : case IProblem.InvalidCharacterConstant : case IProblem.InvalidEscape : case IProblem.InvalidInput : case IProblem.InvalidUnicodeEscape : case IProblem.InvalidFloat : case IProblem.NullSourceString : case IProblem.UnterminatedString : case IProblem.UnterminatedComment : case IProblem.InvalidDigit : break; default: continue search; } int position = problem.getSourceStart(); int start = node.getStartPosition(); int end = start + node.getLength(); if ((start <= position) && (position <= end)) { node.setFlags(node.getFlags() | ASTNode.MALFORMED); // clear the bits on parent ASTNode currentNode = node.getParent(); while (currentNode != null) { currentNode.setFlags(currentNode.getFlags() & ~ASTNode.MALFORMED); currentNode = currentNode.getParent(); } tagWithErrors = true; } } return tagWithErrors; }