aspclassic-core/AspClassic.Parser/OptionDeclaration.cs
Jelle Luteijn 484dbfc9d9 progress
2022-05-15 11:19:49 +02:00

51 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for an Option declaration.
/// </summary>
public sealed class OptionDeclaration : Declaration
{
private readonly OptionType _OptionType;
private readonly Location _OptionTypeLocation;
private readonly Location _OptionArgumentLocation;
/// <summary>
/// The type of Option statement.
/// </summary>
public OptionType OptionType => _OptionType;
/// <summary>
/// The location of the Option type (e.g. "Strict"), if any.
/// </summary>
public Location OptionTypeLocation => _OptionTypeLocation;
/// <summary>
/// The location of the Option argument (e.g. "On"), if any.
/// </summary>
public Location OptionArgumentLocation => _OptionArgumentLocation;
/// <summary>
/// Constructs a new parse tree for an Option declaration.
/// </summary>
/// <param name="optionType">The type of the Option declaration.</param>
/// <param name="optionTypeLocation">The location of the Option type, if any.</param>
/// <param name="optionArgumentLocation">The location of the Option argument, if any.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments for the parse tree.</param>
public OptionDeclaration(OptionType optionType, Location optionTypeLocation, Location optionArgumentLocation, Span span, IList<Comment> comments)
: base(TreeType.OptionDeclaration, span, comments)
{
if (optionType < OptionType.SyntaxError || optionType > OptionType.CompareText)
{
throw new ArgumentOutOfRangeException("optionType");
}
_OptionType = optionType;
_OptionTypeLocation = optionTypeLocation;
_OptionArgumentLocation = optionArgumentLocation;
}
}