Beispiel #1
0
 private void ExecuteThrowStmt(Ast.ThrowStmt stmt, ScriptEnv env)
 {
     if (stmt.HasErrorValues)
     {
         var errorMessage = EvaluateExpr(stmt.Message, env);
         Throw(errorMessage.ToString());
     }
     else
     {
         Throw(Notebook.ErrorMessage);
     }
 }
Beispiel #2
0
    private Ast.Stmt ParseThrowStmt(TokenQueue q)
    {
        var stmt = new Ast.ThrowStmt {
            SourceToken = q.SourceToken
        };

        q.Take("throw");
        if (PeekExpr(q))
        {
            stmt.HasErrorValues = true;
            stmt.Message        = ParseExpr(q);
        }
        ConsumeSemicolon(q);
        return(stmt);
    }