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,52 @@
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for a Loop statement.
/// </summary>
public sealed class LoopStatement : Statement
{
private readonly bool _IsWhile;
private readonly Location _WhileOrUntilLocation;
private readonly Expression _Expression;
/// <summary>
/// Whether the Loop has a While or Until.
/// </summary>
public bool IsWhile => _IsWhile;
/// <summary>
/// The location of the While or Until, if any.
/// </summary>
public Location WhileOrUntilLocation => _WhileOrUntilLocation;
/// <summary>
/// The loop expression, if any.
/// </summary>
public Expression Expression => _Expression;
/// <summary>
/// Constructs a parse tree for a Loop statement.
/// </summary>
/// <param name="expression">The loop expression, if any.</param>
/// <param name="isWhile">WHether the Loop has a While or Until.</param>
/// <param name="whileOrUntilLocation">The location of the While or Until, if any.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments for the parse tree.</param>
public LoopStatement(Expression expression, bool isWhile, Location whileOrUntilLocation, Span span, IList<Comment> comments)
: base(TreeType.LoopStatement, span, comments)
{
SetParent(expression);
_Expression = expression;
_IsWhile = isWhile;
_WhileOrUntilLocation = whileOrUntilLocation;
}
protected override void GetChildTrees(IList<Tree> childList)
{
Tree.AddChild(childList, Expression);
}
}