This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

@ -0,0 +1,65 @@
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for a Do statement.
/// </summary>
public sealed class DoBlockStatement : BlockStatement
{
private readonly bool _IsWhile;
private readonly Location _WhileOrUntilLocation;
private readonly Expression _Expression;
private readonly LoopStatement _EndStatement;
/// <summary>
/// Whether the Do is followed by a While or Until, if any.
/// </summary>
public bool IsWhile => _IsWhile;
/// <summary>
/// The location of the While or Until, if any.
/// </summary>
public Location WhileOrUntilLocation => _WhileOrUntilLocation;
/// <summary>
/// The While or Until expression, if any.
/// </summary>
public Expression Expression => _Expression;
/// <summary>
/// The ending Loop statement.
/// </summary>
public LoopStatement EndStatement => _EndStatement;
/// <summary>
/// Constructs a new parse tree for a Do statement.
/// </summary>
/// <param name="expression">The While or Until expression, if any.</param>
/// <param name="isWhile">Whether the Do is followed by a While or Until, if any.</param>
/// <param name="whileOrUntilLocation">The location of the While or Until, if any.</param>
/// <param name="statements">The statements in the block.</param>
/// <param name="endStatement">The ending Loop statement.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments on the parse tree.</param>
public DoBlockStatement(Expression expression, bool isWhile, Location whileOrUntilLocation, StatementCollection statements, LoopStatement endStatement, Span span, IList<Comment> comments)
: base(TreeType.DoBlockStatement, statements, span, comments)
{
SetParent(expression);
SetParent(endStatement);
_Expression = expression;
_IsWhile = isWhile;
_WhileOrUntilLocation = whileOrUntilLocation;
_EndStatement = endStatement;
}
protected override void GetChildTrees(IList<Tree> childList)
{
Tree.AddChild(childList, Expression);
base.GetChildTrees(childList);
Tree.AddChild(childList, EndStatement);
}
}