Exemple #1
0
        public StoneParser Maybe(StoneParser P)
        {
            var P2 = new StoneParser(P);

            P2.Reset();
            Elements_.Add(new OrTree(new [] { P, P2 }));
            return(this);
        }
Exemple #2
0
        public StoneParser InsertChoice(StoneParser P)
        {
            var Ele = Elements_[0];

            if (Ele is OrTree OrT)
            {
                OrT.Insert(P);
            }
            else
            {
                var Otherwise = new StoneParser(this);
                Reset(null);
                Or(P, Otherwise);
            }

            return(this);
        }
Exemple #3
0
 public RepeatTree(StoneParser P, bool Once)
 {
     StoneParser_ = P;
     OnlyOnce_    = Once;
 }
Exemple #4
0
 public void Insert(StoneParser P)
 {
     Parsers_.Add(P);
 }
Exemple #5
0
 public StoneParser Expression(Type T, StoneParser SubExp, Operators Ops)
 {
     Elements_.Add(new Expr(T, SubExp, Ops));
     return(this);
 }
Exemple #6
0
 public StoneParser Repeat(StoneParser P)
 {
     Elements_.Add(new RepeatTree(P, false));
     return(this);
 }
Exemple #7
0
 public StoneParser Option(StoneParser P)
 {
     Elements_.Add(new RepeatTree(P, true));
     return(this);
 }
Exemple #8
0
 public StoneParser Ast(StoneParser P)
 {
     Elements_.Add(new Tree(P));
     return(this);
 }
Exemple #9
0
 public StoneParser(StoneParser P)
 {
     Elements_ = P.Elements_;
     Factory_  = P.Factory_;
 }
Exemple #10
0
 public Expr(Type T, StoneParser Exp, Operators Map)
 {
     Factory_ = Factory.GetForSyntax(T);
     Ops_     = Map;
     Factor_  = Exp;
 }
Exemple #11
0
 public Tree(StoneParser P)
 {
     StoneParser_ = P;
 }