Example #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);
        });
    }
Example #2
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);
    }
    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);
    }