38 lines
863 B
C#
38 lines
863 B
C#
#define DEBUG
|
|
using System.Diagnostics;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an expression.
|
|
/// </summary>
|
|
public class Expression : Tree
|
|
{
|
|
/// <summary>
|
|
/// Whether the expression is constant or not.
|
|
/// </summary>
|
|
public virtual bool IsConstant => false;
|
|
|
|
public override bool IsBad => base.Type == TreeType.SyntaxError;
|
|
|
|
/// <summary>
|
|
/// Creates a bad expression.
|
|
/// </summary>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
/// <returns>A bad expression.</returns>
|
|
public static Expression GetBadExpression(Span span)
|
|
{
|
|
return new Expression(span);
|
|
}
|
|
|
|
protected Expression(TreeType type, Span span)
|
|
: base(type, span)
|
|
{
|
|
Debug.Assert(type >= TreeType.SimpleNameExpression && type <= TreeType.GetTypeExpression);
|
|
}
|
|
|
|
private Expression(Span span)
|
|
: base(TreeType.SyntaxError, span)
|
|
{
|
|
}
|
|
}
|