progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
55
AspClassic.Parser/EndBlockDeclaration.cs
Normal file
55
AspClassic.Parser/EndBlockDeclaration.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for an End declaration.
|
||||
/// </summary>
|
||||
public sealed class EndBlockDeclaration : Declaration
|
||||
{
|
||||
private readonly BlockType _EndType;
|
||||
|
||||
private readonly Location _EndArgumentLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The type of block the declaration ends.
|
||||
/// </summary>
|
||||
public BlockType EndType => _EndType;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the end block argument.
|
||||
/// </summary>
|
||||
public Location EndArgumentLocation => _EndArgumentLocation;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new parse tree for an End block declaration.
|
||||
/// </summary>
|
||||
/// <param name="endType">The type of the block the statement ends.</param>
|
||||
/// <param name="endArgumentLocation">The location of the end block argument.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
/// <param name="comments">The comments for the parse tree.</param>
|
||||
public EndBlockDeclaration(BlockType endType, Location endArgumentLocation, Span span, IList<Comment> comments)
|
||||
: base(TreeType.EndBlockDeclaration, span, comments)
|
||||
{
|
||||
if (endType < BlockType.Sub && endType > BlockType.Namespace)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("endType");
|
||||
}
|
||||
_EndType = endType;
|
||||
_EndArgumentLocation = endArgumentLocation;
|
||||
}
|
||||
|
||||
internal EndBlockDeclaration(EndBlockStatement endBlockStatement)
|
||||
: base(TreeType.EndBlockDeclaration, endBlockStatement.Span, endBlockStatement.Comments)
|
||||
{
|
||||
BlockType endType = endBlockStatement.EndType;
|
||||
if ((uint)(endType - 10) <= 2u || (uint)(endType - 14) <= 4u)
|
||||
{
|
||||
_EndType = endBlockStatement.EndType;
|
||||
_EndArgumentLocation = endBlockStatement.EndArgumentLocation;
|
||||
return;
|
||||
}
|
||||
throw new ArgumentException("Invalid EndBlockStatement type.");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue