Package org.codehaus.groovy.syntax

Examples of org.codehaus.groovy.syntax.SyntaxException


import org.codehaus.groovy.syntax.SyntaxException;

public class SyntaxErrorMessageTest extends TestCase {

    public void testSetsTheSourceLocatorOfItsSyntaxExceptionAsTheNameOfTheCorrespondingSourceUnitWhenInstantiated() {
        SyntaxException syntaxException = new SyntaxException(someString(), -1, -1);
        assertEquals("source locator", null, syntaxException.getSourceLocator());

        String sourceUnitName = someString();
        SourceUnit sourceUnit = SourceUnit.create(sourceUnitName, someString());

        new SyntaxErrorMessage(syntaxException, sourceUnit);
        assertEquals("source locator", sourceUnitName, syntaxException.getSourceLocator());
    }
View Full Code Here


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

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

    private ClassNode getTargetClass(SourceUnit source, AnnotationNode annotation) {
        final Expression value = annotation.getMember("value");
        if (value == null || !(value instanceof ClassExpression)) {
            //noinspection ThrowableInstanceNeverThrown
            source.getErrorCollector().addErrorAndContinue(
                    new SyntaxErrorMessage(new SyntaxException(
                            "@groovy.lang.Category must define 'value' which is the class to apply this category to",
                            annotation.getLineNumber(),
                            annotation.getColumnNumber()),
                            source));
        }
View Full Code Here

//                evaluateBinaryExpression(compareNotIdenticalMethod, expression);
//                break;

            case Types.COMPARE_IDENTICAL: // ===
            case Types.COMPARE_NOT_IDENTICAL: // !==
                source.addError(new SyntaxException("Operators === and !== are not supported. Use this.is(that) instead", expression.getLineNumber(), expression.getColumnNumber()));
                break;

            case Types.COMPARE_EQUAL: // ==
                evaluateBinaryExpression(compareEqualMethod, expression);
                break;
View Full Code Here

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

    }

    protected void addError(String msg, ASTNode expr) {
        this.source.getErrorCollector().addErrorAndContinue(
                new SyntaxErrorMessage(
                        new SyntaxException(msg + '\n', expr.getLineNumber(), expr.getColumnNumber()), this.source)
        );
    }
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()), this.source)
        );
    }
View Full Code Here

    */
    private void addError(String msg, ASTNode expr) {
        int line = expr.getLineNumber();
        int col = expr.getColumnNumber();
        sourceUnit.getErrorCollector().addErrorAndContinue(
          new SyntaxErrorMessage(new SyntaxException(msg + '\n', line, col), sourceUnit)
        );
    }
View Full Code Here

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

TOP

Related Classes of org.codehaus.groovy.syntax.SyntaxException

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.