79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an On Error statement.
|
|
/// </summary>
|
|
public sealed class OnErrorStatement : LabelReferenceStatement
|
|
{
|
|
private readonly OnErrorType _OnErrorType;
|
|
|
|
private readonly Location _ErrorLocation;
|
|
|
|
private readonly Location _ResumeOrGoToLocation;
|
|
|
|
private readonly Location _NextOrZeroOrMinusLocation;
|
|
|
|
private readonly Location _OneLocation;
|
|
|
|
/// <summary>
|
|
/// The type of On Error statement.
|
|
/// </summary>
|
|
public OnErrorType OnErrorType => _OnErrorType;
|
|
|
|
/// <summary>
|
|
/// The location of the 'Error'.
|
|
/// </summary>
|
|
public Location ErrorLocation => _ErrorLocation;
|
|
|
|
/// <summary>
|
|
/// The location of the 'Resume' or 'GoTo'.
|
|
/// </summary>
|
|
public Location ResumeOrGoToLocation => _ResumeOrGoToLocation;
|
|
|
|
/// <summary>
|
|
/// The location of the 'Next', '0' or '-', if any.
|
|
/// </summary>
|
|
public Location NextOrZeroOrMinusLocation => _NextOrZeroOrMinusLocation;
|
|
|
|
/// <summary>
|
|
/// The location of the '1', if any.
|
|
/// </summary>
|
|
public Location OneLocation => _OneLocation;
|
|
|
|
/// <summary>
|
|
/// Constructs a parse tree for an On Error statement.
|
|
/// </summary>
|
|
/// <param name="onErrorType">The type of the On Error statement.</param>
|
|
/// <param name="errorLocation">The location of the 'Error'.</param>
|
|
/// <param name="resumeOrGoToLocation">The location of the 'Resume' or 'GoTo'.</param>
|
|
/// <param name="nextOrZeroOrMinusLocation">The location of the 'Next', '0' or '-', if any.</param>
|
|
/// <param name="oneLocation">The location of the '1', if any.</param>
|
|
/// <param name="name">The label to branch to, if any.</param>
|
|
/// <param name="isLineNumber">Whether the label is a line number.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
/// <param name="comments">The comments for the parse tree.</param>
|
|
public OnErrorStatement(OnErrorType onErrorType, Location errorLocation, Location resumeOrGoToLocation, Location nextOrZeroOrMinusLocation, Location oneLocation, SimpleName name, bool isLineNumber, Span span, IList<Comment> comments)
|
|
: base(TreeType.OnErrorStatement, name, isLineNumber, span, comments)
|
|
{
|
|
if (onErrorType < OnErrorType.Bad || onErrorType > OnErrorType.Label)
|
|
{
|
|
throw new ArgumentOutOfRangeException("onErrorType");
|
|
}
|
|
_OnErrorType = onErrorType;
|
|
_ErrorLocation = errorLocation;
|
|
_ResumeOrGoToLocation = resumeOrGoToLocation;
|
|
_NextOrZeroOrMinusLocation = nextOrZeroOrMinusLocation;
|
|
_OneLocation = oneLocation;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
if (OnErrorType == OnErrorType.Label)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
}
|
|
}
|
|
}
|