Exemple #1
0
    public override void Compile(CodeBuf cb)
    {
        int l1 = cb.NewLabel();
        int l2 = cb.NewLabel();

        cb.ops.Add(delegate(Frame th) {
            th.rx.OpenQuant();
            return(th);
        });
        cb.labels[l1] = cb.ops.Count;
        cb.ops.Add(delegate(Frame th) {
            th.rx.PushBacktrack("*", cb.labels[l2]);
            return(th);
        });
        inner.Compile(cb);
        cb.ops.Add(delegate(Frame th) {
            th.ip = cb.labels[l1];
            return(th);
        });
        cb.labels[l2] = cb.ops.Count;
        cb.ops.Add(delegate(Frame th) {
            th.rx.CloseQuant();
            return(th);
        });
    }
 public override void Compile(CodeBuf cb) {
     cb.ops.Add(delegate(Frame th) {
         if (!th.rx.Exact(th, s))
             return th.rx.Backtrack(th);
         return th;
     });
 }
Exemple #3
0
 public override void Compile(CodeBuf cb)
 {
     foreach (RxOp ze in z)
     {
         ze.Compile(cb);
     }
 }
Exemple #4
0
 public override void Compile(CodeBuf cb)
 {
     cb.ops.Add(delegate(Frame th) {
         md(th.rx);
         return(th);
     });
 }
Exemple #5
0
 public override void Compile(CodeBuf cb)
 {
     cb.ops.Add(delegate(Frame th) {
         if (!th.rx.Exact(th, s))
         {
             return(th.rx.Backtrack(th));
         }
         return(th);
     });
 }
Exemple #6
0
    private static Frame TestC(Frame th)
    {
        if (Kernel.TraceCont)
        {
            Console.WriteLine("At {0}", th.ip);
        }
        CodeBuf cb = (CodeBuf)th.lex0;

        if (th.ip == cb.ops.Count)
        {
            ok = true;
            return(null);
        }
        CodeBuf.D d = cb.ops[th.ip++];
        return(d(th));
    }
Exemple #7
0
    private static void RunTest(int ix, bool y, string s, RxOp ot)
    {
        CodeBuf cb = new CodeBuf();

        ot.Compile(cb);

        Frame th = new Frame(null, null, TestSI);

        th.rx   = new RxFrame(Kernel.MockBox(new Cursor(s)));
        th.lex0 = cb;

        ok = false;
        while (th != null)
        {
            th = th.Continue();
        }

        Console.WriteLine((ok == y) ? "ok {0}" : "not ok {0}", ix);
    }
 public override void Compile(CodeBuf cb) {
     int l1 = cb.NewLabel();
     int l2 = cb.NewLabel();
     cb.ops.Add(delegate(Frame th) {
         th.rx.OpenQuant();
         return th;
     });
     cb.labels[l1] = cb.ops.Count;
     cb.ops.Add(delegate(Frame th) {
         th.rx.PushBacktrack("*", cb.labels[l2]);
         return th;
     });
     inner.Compile(cb);
     cb.ops.Add(delegate(Frame th) {
         th.ip = cb.labels[l1];
         return th;
     });
     cb.labels[l2] = cb.ops.Count;
     cb.ops.Add(delegate(Frame th) {
         th.rx.CloseQuant();
         return th;
     });
 }
    private static void RunTest(int ix, bool y, string s, RxOp ot) {
        CodeBuf cb = new CodeBuf();
        ot.Compile(cb);

        Frame th = new Frame(null, null, TestSI);
        th.rx = new RxFrame(Kernel.MockBox(new Cursor(s)));
        th.lex0 = cb;

        ok = false;
        while (th != null)
            th = th.Continue();

        Console.WriteLine((ok == y) ? "ok {0}" : "not ok {0}", ix);
    }
 public override void Compile(CodeBuf cb) {
     foreach (RxOp ze in z)
         ze.Compile(cb);
 }
 public override void Compile(CodeBuf cb) {
     cb.ops.Add(delegate(Frame th) {
         md(th.rx);
         return th;
     });
 }
 public abstract void Compile(CodeBuf cb);
Exemple #13
0
 public abstract void Compile(CodeBuf cb);