53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an Exit statement.
|
|
/// </summary>
|
|
public sealed class ExitStatement : Statement
|
|
{
|
|
private readonly BlockType _ExitType;
|
|
|
|
private readonly Location _ExitArgumentLocation;
|
|
|
|
/// <summary>
|
|
/// The type of tree this statement exits.
|
|
/// </summary>
|
|
public BlockType ExitType => _ExitType;
|
|
|
|
/// <summary>
|
|
/// The location of the exit statement type.
|
|
/// </summary>
|
|
public Location ExitArgumentLocation => _ExitArgumentLocation;
|
|
|
|
/// <summary>
|
|
/// Constructs a parse tree for an Exit statement.
|
|
/// </summary>
|
|
/// <param name="exitType">The type of tree this statement exits.</param>
|
|
/// <param name="exitArgumentLocation">The location of the exit statement type.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
/// <param name="comments">The comments for the parse tree.</param>
|
|
public ExitStatement(BlockType exitType, Location exitArgumentLocation, Span span, IList<Comment> comments)
|
|
: base(TreeType.ExitStatement, span, comments)
|
|
{
|
|
switch (exitType)
|
|
{
|
|
default:
|
|
throw new ArgumentOutOfRangeException("exitType");
|
|
case BlockType.None:
|
|
case BlockType.Do:
|
|
case BlockType.For:
|
|
case BlockType.While:
|
|
case BlockType.Select:
|
|
case BlockType.Try:
|
|
case BlockType.Sub:
|
|
case BlockType.Function:
|
|
case BlockType.Property:
|
|
_ExitType = exitType;
|
|
_ExitArgumentLocation = exitArgumentLocation;
|
|
break;
|
|
}
|
|
}
|
|
}
|