Search in sources :

Example 1 with ErrorousExpr

use of kalang.ast.ErrorousExpr in project kalang by kasonyang.

the class AstBuilder method visitExpression.

protected ExprNode visitExpression(ExpressionContext expression) {
    Object node = visit(expression);
    if (node instanceof ExprNode) {
        return (ExprNode) node;
    } else {
        ExprNode expr;
        if (node instanceof AstNode) {
            expr = new ErrorousExpr((AstNode) node);
        } else {
            expr = new ErrorousExpr();
        }
        this.diagnosisReporter.report(Diagnosis.Kind.ERROR, "not an expression", expression);
        return expr;
    }
}
Also used : ExprNode(kalang.ast.ExprNode) VarObject(kalang.ast.VarObject) ErrorousExpr(kalang.ast.ErrorousExpr) AstNode(kalang.ast.AstNode)

Aggregations

AstNode (kalang.ast.AstNode)1 ErrorousExpr (kalang.ast.ErrorousExpr)1 ExprNode (kalang.ast.ExprNode)1 VarObject (kalang.ast.VarObject)1