sharp-parser/ParserPath.cs

38 lines
691 B
C#

using System;
using System.Collections.Generic;
namespace sharp.parser
{
public abstract class ParserPath
{
public ParserPath[] Followers { get { return followers.ToArray(); } }
private List<ParserPath> followers = new List<ParserPath>();
public ParserPath(){
}
public ParserPath(ParserPath[] followers)
{
this.followers.AddRange(followers);
}
public void AddFollower(ParserPath path,params ParserPath[] paths){
AddFollower(path);
foreach (ParserPath p in paths){
AddFollower(p);
}
}
public void AddFollower(ParserPath path)
{
followers.Add(path);
}
public void RemoveFollower(ParserPath path)
{
followers.Remove(path);
}
}
}