@Override public boolean apply(ICompilerProblem problem) { return problem.getLine() == line; } };
@Override public boolean apply(ICompilerProblem problem) { return problem.getLine() == line; } @Override
@Override public boolean accept(ICompilerProblem problem) { if ( problem.getLine() != lineNumber || compareStrings(this.fileName, problem.getSourcePath()) != 0 ) { this.lineNumber = problem.getLine(); this.fileName = problem.getSourcePath(); } else if ( parserProblemOnLine && (problem instanceof AbstractSemanticProblem || problem instanceof CodegenProblem) ) { // Skip this problem. return false; } this.parserProblemOnLine = problem instanceof IParserProblem; return true; }
@Override public boolean accept(ICompilerProblem problem) { if ( problem.getLine() != lineNumber || compareStrings(this.fileName, problem.getSourcePath()) != 0 ) { this.lineNumber = problem.getLine(); this.fileName = problem.getSourcePath(); } else if ( parserProblemOnLine && (problem instanceof AbstractSemanticProblem || problem instanceof CodegenProblem) ) { // Skip this problem. return false; } this.parserProblemOnLine = problem instanceof IParserProblem; return true; }
/** * Gets the text of the line specified problem occured or * <code>null</code> if there is no line information. * * @param problem problem to process * @return the text of the line or <code>null</code> if there * is no line information */ protected String getLineText(ICompilerProblem problem) { String filePath = problem.getSourcePath(); if (filePath == null) return null; int lineNumber = problem.getLine(); if (lineNumber < 0) return null; FileLineInfo fileLineInfo = readers.getUnchecked(filePath); return fileLineInfo.getLineText(lineNumber); }
/** * Gets the text of the line specified problem occured or * <code>null</code> if there is no line information. * * @param problem problem to process * @return the text of the line or <code>null</code> if there * is no line information */ protected String getLineText(ICompilerProblem problem) { String filePath = problem.getSourcePath(); if (filePath == null) return null; int lineNumber = problem.getLine(); if (lineNumber < 0) return null; FileLineInfo fileLineInfo = readers.getUnchecked(filePath); return fileLineInfo.getLineText(lineNumber); }
final String locationString = getLocationString(problem.getSourcePath(), problem.getLine(), problem.getColumn()); if (!locationString.isEmpty())
final String locationString = getLocationString(problem.getSourcePath(), problem.getLine(), problem.getColumn()); if (!locationString.isEmpty())
/** * An optional function body can either be a function block or a semicolon * (virtual semicolon). If neither is matched, a * {@link MissingLeftBraceBeforeFunctionBodyProblem} occurs. However, we * only report the problem if the function definition parsing doesn't have * other syntax issues so far. */ protected void reportFunctionBodyMissingLeftBraceProblem() { final ICompilerProblem lastError = Iterables.getLast(errors, null); if (lastError == null || lastError.getLine() < buffer.previous().getLine()) { final ICompilerProblem problem = new MissingLeftBraceBeforeFunctionBodyProblem(buffer.LT(1)); addProblem(problem); } }
/** * An optional function body can either be a function block or a semicolon * (virtual semicolon). If neither is matched, a * {@link MissingLeftBraceBeforeFunctionBodyProblem} occurs. However, we * only report the problem if the function definition parsing doesn't have * other syntax issues so far. */ protected void reportFunctionBodyMissingLeftBraceProblem() { final ICompilerProblem lastError = Iterables.getLast(errors, null); if (lastError == null || lastError.getLine() < buffer.previous().getLine()) { final ICompilerProblem problem = new MissingLeftBraceBeforeFunctionBodyProblem(buffer.LT(1)); addProblem(problem); } }
else break; // skip if IGNORE? CompilerMessage msg = new CompilerMessage(level, problem.getSourcePath(), problem.getLine() + 1, problem.getColumn()); try
CompilerMessage msg = new CompilerMessage(level, prob.getSourcePath(), prob.getLine() + 1, prob.getColumn()); try
/** * Match optional semicolon. * <p> * This method will report a {@link CanNotInsertSemicolonProblem} if a * "virtual semicolon" is expected but failed to be inserted, except when * there's already a syntax error on the same line, because the preceding * syntax error might early-terminate a statement, making the parser to * expect a optional semicolon. * <p> * It's not "wrong" to always report the semicolon problem. However, it * would make too much "noise" on the console, and it would break almost all * negative ASC tests. * * @return True if optional semicolon is matched. * @see IRepairingTokenBuffer#matchOptionalSemicolon() */ protected boolean matchOptionalSemicolon() { final boolean success = buffer.matchOptionalSemicolon(); if (!success) { final ICompilerProblem lastError = Iterables.getLast(errors, null); if (lastError == null || lastError.getLine() < buffer.previous().getLine()) { addProblem(new CanNotInsertSemicolonProblem(buffer.LT(1))); } } return success; }
/** * Match optional semicolon. * <p> * This method will report a {@link CanNotInsertSemicolonProblem} if a * "virtual semicolon" is expected but failed to be inserted, except when * there's already a syntax error on the same line, because the preceding * syntax error might early-terminate a statement, making the parser to * expect a optional semicolon. * <p> * It's not "wrong" to always report the semicolon problem. However, it * would make too much "noise" on the console, and it would break almost all * negative ASC tests. * * @return True if optional semicolon is matched. * @see IRepairingTokenBuffer#matchOptionalSemicolon() */ protected boolean matchOptionalSemicolon() { final boolean success = buffer.matchOptionalSemicolon(); if (!success) { final ICompilerProblem lastError = Iterables.getLast(errors, null); if (lastError == null || lastError.getLine() < buffer.previous().getLine()) { addProblem(new CanNotInsertSemicolonProblem(buffer.LT(1))); } } return success; }
CompilerMessage msg = new CompilerMessage(level, prob.getSourcePath(), prob.getLine() + 1, prob.getColumn()); try