private Statement assertStatement() { match("LEFT_PAREN"); var assert = new Statement.Assert(expression()); match("RIGHT_PAREN"); return(assert); }
public object visitAssertStmt(Statement.Assert stmt) { if (!((bool)stmt.Expression.Accept(this))) { Console.WriteLine(string.Format("Line {0}: Assertion failed", stmt.GetLine())); } return(null); }
public bool visitAssertStmt(Statement.Assert stmt) { if (stmt.Expression.Accept(expressionAnalyzer) != "bool") { ErrorWriter.Write(stmt.Expression, "Cannot assert non-boolean expression"); return(false); } return(true); }