override public void Visit(AST_read_statement read_statement) { base.Visit(read_statement); if (read_statement.Identifier.Declaration.Type.Kind == bool_type) { Error("Read statement requires int or string type.", read_statement.Identifier); } }
public override void Visit(AST_read_statement read_statement) { bool ok = false; while (!ok) { string input = Console.ReadLine(); if (evaluateVisitor.SetVariable(read_statement.Identifier.Name, input)) { break; } Console.WriteLine("Not a valid integer."); } }
private AST_read_statement Parse_read_statement() { IncrementDepth(); AST_read_statement read_statement; Match(read_Keyword); AST_identifier identifier = Parse_identifier(Semicolon); DebugPrint("read_statement, identifier = " + identifier.Name); read_statement = new AST_read_statement(identifier); DecrementDepth(); return(read_statement); }
public virtual void Visit(AST_read_statement read_statement) { IncrementDepth(); read_statement.Identifier.Accept(this); DecrementDepth(); }