progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
83
AspClassic.Parser/IfBlockStatement.cs
Normal file
83
AspClassic.Parser/IfBlockStatement.cs
Normal file
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for an If block.
|
||||
/// </summary>
|
||||
public sealed class IfBlockStatement : BlockStatement
|
||||
{
|
||||
private readonly Expression _Expression;
|
||||
|
||||
private readonly Location _ThenLocation;
|
||||
|
||||
private readonly StatementCollection _ElseIfBlockStatements;
|
||||
|
||||
private readonly ElseBlockStatement _ElseBlockStatement;
|
||||
|
||||
private readonly EndBlockStatement _EndStatement;
|
||||
|
||||
/// <summary>
|
||||
/// The conditional expression.
|
||||
/// </summary>
|
||||
public Expression Expression => _Expression;
|
||||
|
||||
/// <summary>
|
||||
/// The location of the 'Then', if any.
|
||||
/// </summary>
|
||||
public Location ThenLocation => _ThenLocation;
|
||||
|
||||
/// <summary>
|
||||
/// The Else If statements.
|
||||
/// </summary>
|
||||
public StatementCollection ElseIfBlockStatements => _ElseIfBlockStatements;
|
||||
|
||||
/// <summary>
|
||||
/// The Else statement, if any.
|
||||
/// </summary>
|
||||
public ElseBlockStatement ElseBlockStatement => _ElseBlockStatement;
|
||||
|
||||
/// <summary>
|
||||
/// The End If statement, if any.
|
||||
/// </summary>
|
||||
public EndBlockStatement EndStatement => _EndStatement;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new parse tree for a If statement.
|
||||
/// </summary>
|
||||
/// <param name="expression">The conditional expression.</param>
|
||||
/// <param name="thenLocation">The location of the 'Then', if any.</param>
|
||||
/// <param name="statements">The statements in the If block.</param>
|
||||
/// <param name="elseIfBlockStatements">The Else If statements.</param>
|
||||
/// <param name="elseBlockStatement">The Else statement, if any.</param>
|
||||
/// <param name="endStatement">The End If statement, if any.</param>
|
||||
/// <param name="span">The location of the parse tree.</param>
|
||||
/// <param name="comments">The comments for the parse tree.</param>
|
||||
public IfBlockStatement(Expression expression, Location thenLocation, StatementCollection statements, StatementCollection elseIfBlockStatements, ElseBlockStatement elseBlockStatement, EndBlockStatement endStatement, Span span, IList<Comment> comments)
|
||||
: base(TreeType.IfBlockStatement, statements, span, comments)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
SetParent(expression);
|
||||
SetParent(elseIfBlockStatements);
|
||||
SetParent(elseBlockStatement);
|
||||
SetParent(endStatement);
|
||||
_Expression = expression;
|
||||
_ThenLocation = thenLocation;
|
||||
_ElseIfBlockStatements = elseIfBlockStatements;
|
||||
_ElseBlockStatement = elseBlockStatement;
|
||||
_EndStatement = endStatement;
|
||||
}
|
||||
|
||||
protected override void GetChildTrees(IList<Tree> childList)
|
||||
{
|
||||
Tree.AddChild(childList, Expression);
|
||||
base.GetChildTrees(childList);
|
||||
Tree.AddChild(childList, ElseIfBlockStatements);
|
||||
Tree.AddChild(childList, ElseBlockStatement);
|
||||
Tree.AddChild(childList, EndStatement);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue