Package org.codehaus.groovy.control.messages

Examples of org.codehaus.groovy.control.messages.SyntaxErrorMessage


    }
  }
 
  protected void error(final SourceUnit sourceUnit, final ASTNode astNode, final String message) {
    final SyntaxException syntaxException = new SyntaxException(message, astNode.getLineNumber(), astNode.getColumnNumber());
    final SyntaxErrorMessage syntaxErrorMessage = new SyntaxErrorMessage(syntaxException, sourceUnit);
    sourceUnit.getErrorCollector().addError(syntaxErrorMessage, false);
  }
View Full Code Here


    public static void addError(final String msg, final ASTNode expr, final SourceUnit source) {
        final int line = expr.getLineNumber();
        final int col = expr.getColumnNumber();
        source.getErrorCollector().addErrorAndContinue(
                new SyntaxErrorMessage(new SyntaxException(msg + '\n', line, col), source)
        );
    }
View Full Code Here

                    Logger.trace("%sms to compile template %s to %d classes", System.currentTimeMillis() - start, name, groovyClassesForThisTemplate.size());
                }

            } catch (MultipleCompilationErrorsException e) {
                if (e.getErrorCollector().getLastError() != null) {
                    SyntaxErrorMessage errorMessage = (SyntaxErrorMessage) e.getErrorCollector().getLastError();
                    SyntaxException syntaxException = errorMessage.getCause();
                    Integer line = this.linesMatrix.get(syntaxException.getLine());
                    if (line == null) {
                        line = 0;
                    }
                    String message = syntaxException.getMessage();
View Full Code Here

            error = false;
        } else {
            error = true;
        }
        if (pMessage instanceof SyntaxErrorMessage) {
            SyntaxErrorMessage syntaxErrorMessage = (SyntaxErrorMessage)pMessage;
            SyntaxException syntaxException = syntaxErrorMessage.getCause();
            message = syntaxException.getMessage();
            fileName = syntaxException.getSourceLocator();
            // FIXME: getStartLine() vs. getLine()
            startLine = syntaxException.getStartLine();
            startColumn = syntaxException.getStartColumn();
View Full Code Here

                Logger.trace("%sms to compile template %s to %d classes", System.currentTimeMillis() - start, name, groovyClassesForThisTemplate.size());

            } catch (MultipleCompilationErrorsException e) {
                if (e.getErrorCollector().getLastError() != null) {
                    SyntaxErrorMessage errorMessage = (SyntaxErrorMessage) e.getErrorCollector().getLastError();
                    SyntaxException syntaxException = errorMessage.getCause();
                    Integer line = this.linesMatrix.get(syntaxException.getLine());
                    if (line == null) {
                        line = 0;
                    }
                    String message = syntaxException.getMessage();
View Full Code Here

            } catch (MultipleCompilationErrorsException e) {
                if (e.getErrorCollector().getLastError() != null) {
                    Message errorMsg = e.getErrorCollector().getLastError();
                    if (errorMsg instanceof SyntaxErrorMessage) {
                        SyntaxErrorMessage errorMessage = (SyntaxErrorMessage) e.getErrorCollector().getLastError();
                        SyntaxException syntaxException = errorMessage.getCause();
                        Integer line = this.linesMatrix.get(syntaxException.getLine());
                        if (line == null) {
                            line = 0;
                        }
                        String message = syntaxException.getMessage();
                        if (message.indexOf("@") > 0) {
                            message = message.substring(0, message.lastIndexOf("@"));
                        }
                        throw new TemplateCompilationException(this, line, message);
                    } else{
                        ExceptionMessage  errorMessage = (ExceptionMessage ) e.getErrorCollector().getLastError();
                        Exception exception = errorMessage.getCause();
                        Integer line = 0;
                        String message = exception.getMessage();
                        throw new TemplateCompilationException(this, line, message);
                    }
                }
View Full Code Here

    @Override
    protected void addError(final String msg, final ASTNode expr) {
        Long err = ((long) expr.getLineNumber()) << 16 + expr.getColumnNumber();
        if ((DEBUG_GENERATED_CODE && expr.getLineNumber()<0) || !typeCheckingContext.reportedErrors.contains(err)) {
            typeCheckingContext.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
                    new SyntaxException(msg + '\n', expr.getLineNumber(), expr.getColumnNumber(), expr.getLastLineNumber(), expr.getLastColumnNumber()),
                    typeCheckingContext.source)
            );
            typeCheckingContext.reportedErrors.add(err);
        }
View Full Code Here

        enumClass.addStaticInitializerStatements(block, true);
    }

    private void addError(AnnotatedNode exp, String msg) {
        sourceUnit.getErrorCollector().addErrorAndContinue(
                new SyntaxErrorMessage(
                        new SyntaxException(msg + '\n', exp.getLineNumber(), exp.getColumnNumber(), exp.getLastLineNumber(), exp.getLastColumnNumber()), sourceUnit)
        );
    }
View Full Code Here

        }
        return list;
    }

    public void addError(String msg, ASTNode expr) {
        sourceUnit.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
                        new SyntaxException(msg + '\n', expr.getLineNumber(), expr.getColumnNumber(),
                                expr.getLastLineNumber(), expr.getLastColumnNumber()),
                        sourceUnit)
        );
    }
View Full Code Here

        addError(msg, this.annotation);
    }

    protected void addError(String msg, ASTNode expr) {
        this.errorCollector.addErrorAndContinue(
                new SyntaxErrorMessage(new SyntaxException(msg + " in @" + this.reportClass.getName() + '\n', expr.getLineNumber(), expr.getColumnNumber(), expr.getLastLineNumber(), expr.getLastColumnNumber()), this.source)
        );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.groovy.control.messages.SyntaxErrorMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.