progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
69
AspClassic.Parser/ComparisonCaseClause.cs
Normal file
69
AspClassic.Parser/ComparisonCaseClause.cs
Normal file
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for a case clause that compares values.
|
||||
/// </summary>
|
||||
public sealed class ComparisonCaseClause : CaseClause
|
||||
{
|
||||
private readonly Location _IsLocation;
|
||||
|
||||
private readonly OperatorType _ComparisonOperator;
|
||||
|
||||
private readonly Location _OperatorLocation;
|
||||
|
||||
private readonly Expression _Operand;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the 'Is', if any.
|
||||
/// </summary>
|
||||
public Location IsLocation => _IsLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The comparison operator used in the case clause.
|
||||
/// </summary>
|
||||
public OperatorType ComparisonOperator => _ComparisonOperator;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the comparison operator.
|
||||
/// </summary>
|
||||
public Location OperatorLocation => _OperatorLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The operand of the case clause.
|
||||
/// </summary>
|
||||
public Expression Operand => _Operand;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new parse tree for a comparison case clause.
|
||||
/// </summary>
|
||||
/// <param name="isLocation">The location of the 'Is', if any.</param>
|
||||
/// <param name="comparisonOperator">The comparison operator used.</param>
|
||||
/// <param name="operatorLocation">The location of the comparison operator.</param>
|
||||
/// <param name="operand">The operand of the comparison.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
public ComparisonCaseClause(Location isLocation, OperatorType comparisonOperator, Location operatorLocation, Expression operand, Span span)
|
||||
: base(TreeType.ComparisonCaseClause, span)
|
||||
{
|
||||
if (operand == null)
|
||||
{
|
||||
throw new ArgumentNullException("operand");
|
||||
}
|
||||
if (comparisonOperator < OperatorType.Equals || comparisonOperator > OperatorType.GreaterThanEquals)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("comparisonOperator");
|
||||
}
|
||||
SetParent(operand);
|
||||
_IsLocation = isLocation;
|
||||
_ComparisonOperator = comparisonOperator;
|
||||
_OperatorLocation = operatorLocation;
|
||||
_Operand = operand;
|
||||
}
|
||||
|
||||
protected override void GetChildTrees(IList<Tree> childList)
|
||||
{
|
||||
Tree.AddChild(childList, Operand);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue