public TryStatement ParseTryStatement() { var tryStatement = new TryStatement { Token = Next() }; Match(TokenType.Try); tryStatement.Body = ParseStatementBlock(); if (Next().IsNot(TokenType.Rescue) && Next().IsNot(TokenType.Finally)) { throw Error("Missing rescue or finally", Next()); } if (Next().Is(TokenType.Rescue)) { var rescueClause = new RescueClause { Token = Next() }; Match(TokenType.Rescue); if (!Next().Is(TokenType.LeftBrace)) { rescueClause.Identifier = ParseIdentifier(); } rescueClause.StatementBlock = ParseStatementBlock(); tryStatement.Rescue = rescueClause; } if (Next().Is(TokenType.Finally)) { Match(TokenType.Finally); tryStatement.Finally = ParseStatementBlock(); } return(tryStatement); }
public virtual object Walk(RescueClause node) { if (Enter(node)) { if (node.Identifier != null) { node.Identifier.Accept(this); } node.StatementBlock.Accept(this); } Exit(node); return(null); }
public override void Exit(RescueClause node) { level--; }
public override bool Enter(RescueClause node) { Print("RescueClause"); level++; return true; }
public virtual void Exit(RescueClause node) { }
public virtual bool Enter(RescueClause node) { return true; }
public virtual bool Enter(RescueClause node) { return(true); }
public override bool Enter(RescueClause node) { Print("RescueClause"); level++; return(true); }
public TryStatement ParseTryStatement() { var tryStatement = new TryStatement { Token = Next() }; Match(TokenType.Try); tryStatement.Body = ParseStatementBlock(); if (Next().IsNot(TokenType.Rescue) && Next().IsNot(TokenType.Finally)) throw Error("Missing rescue or finally", Next()); if (Next().Is(TokenType.Rescue)) { var rescueClause = new RescueClause { Token = Next() }; Match(TokenType.Rescue); if (!Next().Is(TokenType.LeftBrace)) { rescueClause.Identifier = ParseIdentifier(); } rescueClause.StatementBlock = ParseStatementBlock(); tryStatement.Rescue = rescueClause; } if (Next().Is(TokenType.Finally)) { Match(TokenType.Finally); tryStatement.Finally = ParseStatementBlock(); } return tryStatement; }
public virtual object Walk(RescueClause node) { if (Enter(node)) { if (node.Identifier != null) node.Identifier.Accept(this); node.StatementBlock.Accept(this); } Exit(node); return null; }