This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#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)
{
}
}