mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
990 B
39 lines
990 B
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace DOM.DSL.Tokens
|
|
{
|
|
public class TBlockToken :
|
|
TToken
|
|
{
|
|
public string Name { get; }
|
|
public TToken Condition { get; }
|
|
public IEnumerable<TToken> Body { get; }
|
|
|
|
public TBlockToken(string name,
|
|
TToken condition,
|
|
IEnumerable<TToken> body)
|
|
{
|
|
Name = name;
|
|
Condition = condition?.Clone();
|
|
Body = body.Select(b => b.Clone()).ToArray();
|
|
}
|
|
|
|
public TBlockToken(IEnumerable<TToken> body)
|
|
{
|
|
Name = string.Empty;
|
|
Condition = null;
|
|
Body = body.Select(b => b.Clone()).ToArray();
|
|
}
|
|
|
|
public override TToken Clone()
|
|
{
|
|
return new TBlockToken(this.Name, this.Condition?.Clone(), this.Body?.Select(b => b.Clone()).ToArray());
|
|
}
|
|
|
|
public override TToken CloneLocal()
|
|
{
|
|
return Clone();
|
|
}
|
|
}
|
|
} |