Пример #1
0
        protected override void Go()
        {
            Goto(0);

            for (;;)
            {
#if DBG
                if (runmatch.Debug)
                {
                    DumpState();
                }
#endif

                switch (Operator())
                {
                case RegexCode.Stop:
                    return;

                case RegexCode.Nothing:
                    break;

                case RegexCode.Goto:
                    Goto(Operand(0));
                    continue;

                case RegexCode.Testref:
                    if (!IsMatched(Operand(0)))
                    {
                        break;
                    }
                    Advance(1);
                    continue;

                case RegexCode.Lazybranch:
                    Track(Textpos());
                    Advance(1);
                    continue;

                case RegexCode.Lazybranch | RegexCode.Back:
                    Trackframe(1);
                    Textto(Tracked(0));
                    Goto(Operand(0));
                    continue;

                case RegexCode.Setmark:
                    Stack(Textpos());
                    Track();
                    Advance();
                    continue;

                case RegexCode.Nullmark:
                    Stack(-1);
                    Track();
                    Advance();
                    continue;

                case RegexCode.Setmark | RegexCode.Back:
                case RegexCode.Nullmark | RegexCode.Back:
                    Stackframe(1);
                    break;

                case RegexCode.Getmark:
                    Stackframe(1);
                    Track(Stacked(0));
                    Textto(Stacked(0));
                    Advance();
                    continue;

                case RegexCode.Getmark | RegexCode.Back:
                    Trackframe(1);
                    Stack(Tracked(0));
                    break;

                case RegexCode.Capturemark:
                    if (Operand(1) != -1 && !IsMatched(Operand(1)))
                    {
                        break;
                    }
                    Stackframe(1);
                    if (Operand(1) != -1)
                    {
                        TransferCapture(Operand(0), Operand(1), Stacked(0), Textpos());
                    }
                    else
                    {
                        Capture(Operand(0), Stacked(0), Textpos());
                    }
                    Track(Stacked(0));

                    Advance(2);

                    /*  This is code for ASURT 78559
                     *  Also need to "uncapture" the groups in 'runstrings[Operand(2)]'
                     *  in 'case RegexCode.Capturemark | RegexCode.Back'
                     * string groups = runstrings[Operand(2)];
                     * for (int i=0; i<groups.Length; i++) {
                     *  int g = (int) groups[i];
                     *  if (runmatch.GroupCaptureCount(g) < runmatch.GroupCaptureCount(Operand(0)))
                     *      Capture(g, Textpos(), Textpos());
                     * }
                     *
                     * Advance(3);
                     */
                    continue;

                case RegexCode.Capturemark | RegexCode.Back:
                    Trackframe(1);
                    Stack(Tracked(0));
                    Uncapture();
                    if (Operand(0) != -1 && Operand(1) != -1)
                    {
                        Uncapture();
                    }

                    break;

                case RegexCode.Branchmark:
                {
                    int matched;
                    Stackframe(1);

                    matched = Textpos() - Stacked(0);

                    if (matched != 0)                           // Nonempty match -> loop now
                    {
                        Track(Stacked(0), Textpos());           // Save old mark, textpos
                        Stack(Textpos());                       // Make new mark
                        Goto(Operand(0));                       // Loop
                    }
                    else                                        // Empty match -> straight now
                    {
                        Track2(Stacked(0));                     // Save old mark
                        Advance(1);                             // Straight
                    }
                    continue;
                }

                case RegexCode.Branchmark | RegexCode.Back:
                    Trackframe(2);
                    Stackframe(1);
                    Textto(Tracked(1));                         // Recall position
                    Track2(Tracked(0));                         // Save old mark
                    Advance(1);                                 // Straight
                    continue;

                case RegexCode.Branchmark | RegexCode.Back2:
                    Trackframe(1);
                    Stack(Tracked(0));                          // Recall old mark
                    break;                                      // Backtrack

                case RegexCode.Lazybranchmark:
                {
                    int matched;
                    Stackframe(1);

                    matched = Textpos() - Stacked(0);

                    if (matched != 0)                           // Nonempty match -> next loop
                    {
                        Track(Stacked(0), Textpos());           // Save old mark, textpos
                    }
                    else                                        // Empty match -> no loop
                    {
                        Track2(Stacked(0));                     // Save old mark
                    }
                    Advance(1);
                    continue;
                }

                case RegexCode.Lazybranchmark | RegexCode.Back:
                {
                    int pos;

                    Trackframe(2);
                    pos = Tracked(1);
                    Track2(Tracked(0));                         // Save old mark
                    Stack(pos);                                 // Make new mark
                    Textto(pos);                                // Recall position
                    Goto(Operand(0));                           // Loop
                    continue;
                }

                case RegexCode.Lazybranchmark | RegexCode.Back2:
                    Stackframe(1);
                    Trackframe(1);
                    Stack(Tracked(0));                          // Recall old mark
                    break;

                case RegexCode.Setcount:
                    Stack(Textpos(), Operand(0));
                    Track();
                    Advance(1);
                    continue;

                case RegexCode.Nullcount:
                    Stack(-1, Operand(0));
                    Track();
                    Advance(1);
                    continue;

                case RegexCode.Setcount | RegexCode.Back:
                    Stackframe(2);
                    break;

                case RegexCode.Nullcount | RegexCode.Back:
                    Stackframe(2);
                    break;

                case RegexCode.Branchcount:
                    // Stack:
                    //  0: Mark
                    //  1: Count
                {
                    Stackframe(2);
                    int mark    = Stacked(0);
                    int count   = Stacked(1);
                    int matched = Textpos() - mark;

                    if (count >= Operand(1) || (matched == 0 && count >= 0)) // Max loops or empty match -> straight now
                    {
                        Track2(mark, count);                                 // Save old mark, count
                        Advance(2);                                          // Straight
                    }
                    else                                                     // Nonempty match -> count+loop now
                    {
                        Track(mark);                                         // remember mark
                        Stack(Textpos(), count + 1);                         // Make new mark, incr count
                        Goto(Operand(0));                                    // Loop
                    }
                    continue;
                }

                case RegexCode.Branchcount | RegexCode.Back:
                    // Track:
                    //  0: Previous mark
                    // Stack:
                    //  0: Mark (= current pos, discarded)
                    //  1: Count
                    Trackframe(1);
                    Stackframe(2);
                    if (Stacked(1) > 0)                         // Positive -> can go straight
                    {
                        Textto(Stacked(0));                     // Zap to mark
                        Track2(Tracked(0), Stacked(1) - 1);     // Save old mark, old count
                        Advance(2);                             // Straight
                        continue;
                    }
                    Stack(Tracked(0), Stacked(1) - 1);          // recall old mark, old count
                    break;

                case RegexCode.Branchcount | RegexCode.Back2:
                    // Track:
                    //  0: Previous mark
                    //  1: Previous count
                    Trackframe(2);
                    Stack(Tracked(0), Tracked(1));              // Recall old mark, old count
                    break;                                      // Backtrack


                case RegexCode.Lazybranchcount:
                    // Stack:
                    //  0: Mark
                    //  1: Count
                {
                    Stackframe(2);
                    int mark  = Stacked(0);
                    int count = Stacked(1);

                    if (count < 0)                              // Negative count -> loop now
                    {
                        Track2(mark);                           // Save old mark
                        Stack(Textpos(), count + 1);            // Make new mark, incr count
                        Goto(Operand(0));                       // Loop
                    }
                    else                                        // Nonneg count -> straight now
                    {
                        Track(mark, count, Textpos());          // Save mark, count, position
                        Advance(2);                             // Straight
                    }
                    continue;
                }

                case RegexCode.Lazybranchcount | RegexCode.Back:
                    // Track:
                    //  0: Mark
                    //  1: Count
                    //  2: Textpos
                {
                    Trackframe(3);
                    int mark    = Tracked(0);
                    int textpos = Tracked(2);
                    if (Tracked(1) <= Operand(1) && textpos != mark) // Under limit and not empty match -> loop
                    {
                        Textto(textpos);                             // Recall position
                        Stack(textpos, Tracked(1) + 1);              // Make new mark, incr count
                        Track2(mark);                                // Save old mark
                        Goto(Operand(0));                            // Loop
                        continue;
                    }
                    else                                            // Max loops or empty match -> backtrack
                    {
                        Stack(Tracked(0), Tracked(1));              // Recall old mark, count
                        break;                                      // backtrack
                    }
                }

                case RegexCode.Lazybranchcount | RegexCode.Back2:
                    // Track:
                    //  0: Previous mark
                    // Stack:
                    //  0: Mark (== current pos, discarded)
                    //  1: Count
                    Trackframe(1);
                    Stackframe(2);
                    Stack(Tracked(0), Stacked(1) - 1);      // Recall old mark, count
                    break;                                  // Backtrack

                case RegexCode.Setjump:
                    Stack(Trackpos(), Crawlpos());
                    Track();
                    Advance();
                    continue;

                case RegexCode.Setjump | RegexCode.Back:
                    Stackframe(2);
                    break;

                case RegexCode.Backjump:
                    // Stack:
                    //  0: Saved trackpos
                    //  1: Crawlpos
                    Stackframe(2);
                    Trackto(Stacked(0));

                    while (Crawlpos() != Stacked(1))
                    {
                        Uncapture();
                    }

                    break;

                case RegexCode.Forejump:
                    // Stack:
                    //  0: Saved trackpos
                    //  1: Crawlpos
                    Stackframe(2);
                    Trackto(Stacked(0));
                    Track(Stacked(1));
                    Advance();
                    continue;

                case RegexCode.Forejump | RegexCode.Back:
                    // Track:
                    //  0: Crawlpos
                    Trackframe(1);

                    while (Crawlpos() != Tracked(0))
                    {
                        Uncapture();
                    }

                    break;

                case RegexCode.Bol:
                    if (Leftchars() > 0 && CharAt(Textpos() - 1) != '\n')
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.Eol:
                    if (Rightchars() > 0 && CharAt(Textpos()) != '\n')
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.Boundary:
                    if (!IsBoundary(Textpos(), runtextbeg, runtextend))
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.Nonboundary:
                    if (IsBoundary(Textpos(), runtextbeg, runtextend))
                    {
                        break;
                    }
                    Advance();
                    continue;

#if ECMA
                case RegexCode.ECMABoundary:
                    if (!IsECMABoundary(Textpos(), runtextbeg, runtextend))
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.NonECMABoundary:
                    if (IsECMABoundary(Textpos(), runtextbeg, runtextend))
                    {
                        break;
                    }
                    Advance();
                    continue;
#endif

                case RegexCode.Beginning:
                    if (Leftchars() > 0)
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.Start:
                    if (Textpos() != Textstart())
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.EndZ:
                    if (Rightchars() > 1 || Rightchars() == 1 && CharAt(Textpos()) != '\n')
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.End:
                    if (Rightchars() > 0)
                    {
                        break;
                    }
                    Advance();
                    continue;

                case RegexCode.One:
                    if (Forwardchars() < 1 || Forwardcharnext() != (char)Operand(0))
                    {
                        break;
                    }

                    Advance(1);
                    continue;

                case RegexCode.Notone:
                    if (Forwardchars() < 1 || Forwardcharnext() == (char)Operand(0))
                    {
                        break;
                    }

                    Advance(1);
                    continue;

                case RegexCode.Set:
                    if (Forwardchars() < 1 || !RegexCharClass.CharInSet(Forwardcharnext(), runstrings[Operand(0)], runstrings[Operand(1)]))
                    {
                        break;
                    }

                    Advance(2);
                    continue;

                case RegexCode.Multi:
                {
                    if (!Stringmatch(runstrings[Operand(0)]))
                    {
                        break;
                    }

                    Advance(1);
                    continue;
                }

                case RegexCode.Ref:
                {
                    int capnum = Operand(0);

                    if (IsMatched(capnum))
                    {
                        if (!Refmatch(MatchIndex(capnum), MatchLength(capnum)))
                        {
                            break;
                        }
                    }
                    else
                    {
#if ECMA
                        if ((runregex.roptions & RegexOptions.ECMAScript) == 0)
#endif
                        break;
                    }

                    Advance(1);
                    continue;
                }

                case RegexCode.Onerep:
                {
                    int c = Operand(1);

                    if (Forwardchars() < c)
                    {
                        break;
                    }

                    char ch = (char)Operand(0);

                    while (c-- > 0)
                    {
                        if (Forwardcharnext() != ch)
                        {
                            goto BreakBackward;
                        }
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Notonerep:
                {
                    int c = Operand(1);

                    if (Forwardchars() < c)
                    {
                        break;
                    }

                    char ch = (char)Operand(0);

                    while (c-- > 0)
                    {
                        if (Forwardcharnext() == ch)
                        {
                            goto BreakBackward;
                        }
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Setrep:
                {
                    int c = Operand(2);

                    if (Forwardchars() < c)
                    {
                        break;
                    }

                    String set = runstrings[Operand(0)];
                    String cat = runstrings[Operand(1)];

                    while (c-- > 0)
                    {
                        if (!RegexCharClass.CharInSet(Forwardcharnext(), set, cat))
                        {
                            goto BreakBackward;
                        }
                    }

                    Advance(3);
                    continue;
                }

                case RegexCode.Oneloop:
                {
                    int c = Operand(1);

                    if (c > Forwardchars())
                    {
                        c = Forwardchars();
                    }

                    char ch = (char)Operand(0);
                    int  i;

                    for (i = c; i > 0; i--)
                    {
                        if (Forwardcharnext() != ch)
                        {
                            Backwardnext();
                            break;
                        }
                    }

                    if (c > i)
                    {
                        Track(c - i - 1, Textpos() - Bump());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Notoneloop:
                {
                    int c = Operand(1);

                    if (c > Forwardchars())
                    {
                        c = Forwardchars();
                    }

                    char ch = (char)Operand(0);
                    int  i;

                    for (i = c; i > 0; i--)
                    {
                        if (Forwardcharnext() == ch)
                        {
                            Backwardnext();
                            break;
                        }
                    }

                    if (c > i)
                    {
                        Track(c - i - 1, Textpos() - Bump());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Setloop:
                {
                    int c = Operand(2);

                    if (c > Forwardchars())
                    {
                        c = Forwardchars();
                    }

                    String set = runstrings[Operand(0)];
                    String cat = runstrings[Operand(1)];
                    int    i;

                    for (i = c; i > 0; i--)
                    {
                        if (!RegexCharClass.CharInSet(Forwardcharnext(), set, cat))
                        {
                            Backwardnext();
                            break;
                        }
                    }

                    if (c > i)
                    {
                        Track(c - i - 1, Textpos() - Bump());
                    }

                    Advance(3);
                    continue;
                }

                case RegexCode.Oneloop | RegexCode.Back:
                case RegexCode.Notoneloop | RegexCode.Back:
                {
                    Trackframe(2);
                    int i   = Tracked(0);
                    int pos = Tracked(1);

                    Textto(pos);

                    if (i > 0)
                    {
                        Track(i - 1, pos - Bump());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Setloop | RegexCode.Back:
                {
                    Trackframe(2);
                    int i   = Tracked(0);
                    int pos = Tracked(1);

                    Textto(pos);

                    if (i > 0)
                    {
                        Track(i - 1, pos - Bump());
                    }

                    Advance(3);
                    continue;
                }

                case RegexCode.Onelazy:
                case RegexCode.Notonelazy:
                {
                    int c = Operand(1);

                    if (c > Forwardchars())
                    {
                        c = Forwardchars();
                    }

                    if (c > 0)
                    {
                        Track(c - 1, Textpos());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Setlazy:
                {
                    int c = Operand(2);

                    if (c > Forwardchars())
                    {
                        c = Forwardchars();
                    }

                    if (c > 0)
                    {
                        Track(c - 1, Textpos());
                    }

                    Advance(3);
                    continue;
                }

                case RegexCode.Onelazy | RegexCode.Back:
                {
                    Trackframe(2);
                    int pos = Tracked(1);
                    Textto(pos);

                    if (Forwardcharnext() != (char)Operand(0))
                    {
                        break;
                    }

                    int i = Tracked(0);

                    if (i > 0)
                    {
                        Track(i - 1, pos + Bump());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Notonelazy | RegexCode.Back:
                {
                    Trackframe(2);
                    int pos = Tracked(1);
                    Textto(pos);

                    if (Forwardcharnext() == (char)Operand(0))
                    {
                        break;
                    }

                    int i = Tracked(0);

                    if (i > 0)
                    {
                        Track(i - 1, pos + Bump());
                    }

                    Advance(2);
                    continue;
                }

                case RegexCode.Setlazy | RegexCode.Back:
                {
                    Trackframe(2);
                    int pos = Tracked(1);
                    Textto(pos);

                    if (!RegexCharClass.CharInSet(Forwardcharnext(), runstrings[Operand(0)], runstrings[Operand(1)]))
                    {
                        break;
                    }

                    int i = Tracked(0);

                    if (i > 0)
                    {
                        Track(i - 1, pos + Bump());
                    }

                    Advance(3);
                    continue;
                }

                default:
                    throw new NotImplementedException(SR.GetString(SR.UnimplementedState));
                }

BreakBackward:
                ;

                // "break Backward" comes here:
                Backtrack();
            }
        }
Пример #2
0
        protected override bool FindFirstChar()
        {
            int    i;
            String set;

            if (0 != (runanchors & (RegexFCD.Beginning | RegexFCD.Start | RegexFCD.EndZ | RegexFCD.End)))
            {
                if (!runcode._rightToLeft)
                {
                    if ((0 != (runanchors & RegexFCD.Beginning) && runtextpos > runtextbeg) ||
                        (0 != (runanchors & RegexFCD.Start) && runtextpos > runtextstart))
                    {
                        runtextpos = runtextend;
                        return(false);
                    }
                    if (0 != (runanchors & RegexFCD.EndZ) && runtextpos < runtextend - 1)
                    {
                        runtextpos = runtextend - 1;
                    }
                    else if (0 != (runanchors & RegexFCD.End) && runtextpos < runtextend)
                    {
                        runtextpos = runtextend;
                    }
                }
                else
                {
                    if ((0 != (runanchors & RegexFCD.End) && runtextpos < runtextend) ||
                        (0 != (runanchors & RegexFCD.EndZ) && (runtextpos < runtextend - 1 ||
                                                               (runtextpos == runtextend - 1 && CharAt(runtextpos) != '\n'))) ||
                        (0 != (runanchors & RegexFCD.Start) && runtextpos < runtextstart))
                    {
                        runtextpos = runtextbeg;
                        return(false);
                    }
                    if (0 != (runanchors & RegexFCD.Beginning) && runtextpos > runtextbeg)
                    {
                        runtextpos = runtextbeg;
                    }
                }

                if (runbmPrefix != null)
                {
                    return(runbmPrefix.IsMatch(runtext, runtextpos, runtextbeg, runtextend));
                }
            }
            else if (runbmPrefix != null)
            {
                runtextpos = runbmPrefix.Scan(runtext, runtextpos, runtextbeg, runtextend);

                if (runtextpos == -1)
                {
                    runtextpos = (runcode._rightToLeft ? runtextbeg : runtextend);
                    return(false);
                }

                return(true);
            }

            if (runfcPrefix == null)
            {
                return(true);
            }

            runrtl = runcode._rightToLeft;
            runci  = runfcPrefix.CaseInsensitive;
            set    = runfcPrefix.Prefix;

            if (RegexCharClass.IsSingleton(set))
            {
                char ch = RegexCharClass.SingletonChar(set);

                for (i = Forwardchars(); i > 0; i--)
                {
                    if (ch == Forwardcharnext())
                    {
                        Backwardnext();
                        return(true);
                    }
                }
            }
            else
            {
                for (i = Forwardchars(); i > 0; i--)
                {
                    if (RegexCharClass.CharInSet(Forwardcharnext(), set, String.Empty))
                    {
                        Backwardnext();
                        return(true);
                    }
                }
            }
            return(false);
        }
        protected override bool FindFirstChar()
        {
            int num;

            if ((this.runanchors & 0x35) != 0)
            {
                if (!this.runcode._rightToLeft)
                {
                    if ((((this.runanchors & 1) != 0) && (base.runtextpos > base.runtextbeg)) || (((this.runanchors & 4) != 0) && (base.runtextpos > base.runtextstart)))
                    {
                        base.runtextpos = base.runtextend;
                        return(false);
                    }
                    if (((this.runanchors & 0x10) != 0) && (base.runtextpos < (base.runtextend - 1)))
                    {
                        base.runtextpos = base.runtextend - 1;
                    }
                    else if (((this.runanchors & 0x20) != 0) && (base.runtextpos < base.runtextend))
                    {
                        base.runtextpos = base.runtextend;
                    }
                }
                else
                {
                    if (((((this.runanchors & 0x20) != 0) && (base.runtextpos < base.runtextend)) || (((this.runanchors & 0x10) != 0) && ((base.runtextpos < (base.runtextend - 1)) || ((base.runtextpos == (base.runtextend - 1)) && (this.CharAt(base.runtextpos) != '\n'))))) || (((this.runanchors & 4) != 0) && (base.runtextpos < base.runtextstart)))
                    {
                        base.runtextpos = base.runtextbeg;
                        return(false);
                    }
                    if (((this.runanchors & 1) != 0) && (base.runtextpos > base.runtextbeg))
                    {
                        base.runtextpos = base.runtextbeg;
                    }
                }
                if (this.runbmPrefix != null)
                {
                    return(this.runbmPrefix.IsMatch(base.runtext, base.runtextpos, base.runtextbeg, base.runtextend));
                }
            }
            else if (this.runbmPrefix != null)
            {
                base.runtextpos = this.runbmPrefix.Scan(base.runtext, base.runtextpos, base.runtextbeg, base.runtextend);
                if (base.runtextpos == -1)
                {
                    base.runtextpos = this.runcode._rightToLeft ? base.runtextbeg : base.runtextend;
                    return(false);
                }
                return(true);
            }
            if (this.runfcPrefix == null)
            {
                return(true);
            }
            this.runrtl = this.runcode._rightToLeft;
            this.runci  = this.runfcPrefix.CaseInsensitive;
            string prefix = this.runfcPrefix.Prefix;

            if (RegexCharClass.IsSingleton(prefix))
            {
                char ch = RegexCharClass.SingletonChar(prefix);
                for (num = this.Forwardchars(); num > 0; num--)
                {
                    if (ch == this.Forwardcharnext())
                    {
                        this.Backwardnext();
                        return(true);
                    }
                }
            }
            else
            {
                for (num = this.Forwardchars(); num > 0; num--)
                {
                    if (RegexCharClass.CharInSet(this.Forwardcharnext(), prefix, string.Empty))
                    {
                        this.Backwardnext();
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #4
0
 /// <include file='doc\RegexRunner.uex' path='docs/doc[@for="RegexRunner.CharInSet"]/*' />
 protected static bool CharInSet(char ch, String set, String category)
 {
     return(RegexCharClass.CharInSet(ch, set, category));
 }
        protected override void Go()
        {
            this.Goto(0);
Label_0007:
            switch (this.Operator())
            {
            case 0:
            {
                int num12 = this.Operand(1);
                if (this.Forwardchars() < num12)
                {
                    goto Label_0EA3;
                }
                char ch = (char)this.Operand(0);
                while (num12-- > 0)
                {
                    if (this.Forwardcharnext() != ch)
                    {
                        goto Label_0EA3;
                    }
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 1:
            {
                int num13 = this.Operand(1);
                if (this.Forwardchars() < num13)
                {
                    goto Label_0EA3;
                }
                char ch2 = (char)this.Operand(0);
                while (num13-- > 0)
                {
                    if (this.Forwardcharnext() == ch2)
                    {
                        goto Label_0EA3;
                    }
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 2:
            {
                int num14 = this.Operand(2);
                if (this.Forwardchars() < num14)
                {
                    goto Label_0EA3;
                }
                string set      = this.runstrings[this.Operand(0)];
                string category = this.runstrings[this.Operand(1)];
                while (num14-- > 0)
                {
                    if (!RegexCharClass.CharInSet(this.Forwardcharnext(), set, category))
                    {
                        goto Label_0EA3;
                    }
                }
                this.Advance(3);
                goto Label_0007;
            }

            case 3:
            {
                int num15 = this.Operand(1);
                if (num15 > this.Forwardchars())
                {
                    num15 = this.Forwardchars();
                }
                char ch3   = (char)this.Operand(0);
                int  num16 = num15;
                while (num16 > 0)
                {
                    if (this.Forwardcharnext() != ch3)
                    {
                        this.Backwardnext();
                        break;
                    }
                    num16--;
                }
                if (num15 > num16)
                {
                    this.Track((num15 - num16) - 1, this.Textpos() - this.Bump());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 4:
            {
                int num17 = this.Operand(1);
                if (num17 > this.Forwardchars())
                {
                    num17 = this.Forwardchars();
                }
                char ch4   = (char)this.Operand(0);
                int  num18 = num17;
                while (num18 > 0)
                {
                    if (this.Forwardcharnext() == ch4)
                    {
                        this.Backwardnext();
                        break;
                    }
                    num18--;
                }
                if (num17 > num18)
                {
                    this.Track((num17 - num18) - 1, this.Textpos() - this.Bump());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 5:
            {
                int num19 = this.Operand(2);
                if (num19 > this.Forwardchars())
                {
                    num19 = this.Forwardchars();
                }
                string str3  = this.runstrings[this.Operand(0)];
                string str4  = this.runstrings[this.Operand(1)];
                int    num20 = num19;
                while (num20 > 0)
                {
                    if (!RegexCharClass.CharInSet(this.Forwardcharnext(), str3, str4))
                    {
                        this.Backwardnext();
                        break;
                    }
                    num20--;
                }
                if (num19 > num20)
                {
                    this.Track((num19 - num20) - 1, this.Textpos() - this.Bump());
                }
                this.Advance(3);
                goto Label_0007;
            }

            case 6:
            case 7:
            {
                int num25 = this.Operand(1);
                if (num25 > this.Forwardchars())
                {
                    num25 = this.Forwardchars();
                }
                if (num25 > 0)
                {
                    this.Track(num25 - 1, this.Textpos());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 8:
            {
                int num26 = this.Operand(2);
                if (num26 > this.Forwardchars())
                {
                    num26 = this.Forwardchars();
                }
                if (num26 > 0)
                {
                    this.Track(num26 - 1, this.Textpos());
                }
                this.Advance(3);
                goto Label_0007;
            }

            case 9:
                if ((this.Forwardchars() < 1) || (this.Forwardcharnext() != ((char)this.Operand(0))))
                {
                    goto Label_0EA3;
                }
                this.Advance(1);
                goto Label_0007;

            case 10:
                if ((this.Forwardchars() < 1) || (this.Forwardcharnext() == ((char)this.Operand(0))))
                {
                    goto Label_0EA3;
                }
                this.Advance(1);
                goto Label_0007;

            case 11:
                if ((this.Forwardchars() < 1) || !RegexCharClass.CharInSet(this.Forwardcharnext(), this.runstrings[this.Operand(0)], this.runstrings[this.Operand(1)]))
                {
                    goto Label_0EA3;
                }
                this.Advance(2);
                goto Label_0007;

            case 12:
                if (!this.Stringmatch(this.runstrings[this.Operand(0)]))
                {
                    goto Label_0EA3;
                }
                this.Advance(1);
                goto Label_0007;

            case 13:
            {
                int cap = this.Operand(0);
                if (!base.IsMatched(cap))
                {
                    if ((base.runregex.roptions & RegexOptions.ECMAScript) == RegexOptions.None)
                    {
                        goto Label_0EA3;
                    }
                    goto Label_0A06;
                }
                if (this.Refmatch(base.MatchIndex(cap), base.MatchLength(cap)))
                {
                    goto Label_0A06;
                }
                goto Label_0EA3;
            }

            case 14:
                if ((this.Leftchars() > 0) && (this.CharAt(this.Textpos() - 1) != '\n'))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 15:
                if ((this.Rightchars() > 0) && (this.CharAt(this.Textpos()) != '\n'))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x10:
                if (!base.IsBoundary(this.Textpos(), base.runtextbeg, base.runtextend))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x11:
                if (base.IsBoundary(this.Textpos(), base.runtextbeg, base.runtextend))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x12:
                if (this.Leftchars() > 0)
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x13:
                if (this.Textpos() != this.Textstart())
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 20:
                if ((this.Rightchars() > 1) || ((this.Rightchars() == 1) && (this.CharAt(this.Textpos()) != '\n')))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x15:
                if (this.Rightchars() > 0)
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x16:
                goto Label_0EA3;

            case 0x17:
                this.Track(this.Textpos());
                this.Advance(1);
                goto Label_0007;

            case 0x18:
                this.Stackframe(1);
                if ((this.Textpos() - this.Stacked(0)) == 0)
                {
                    this.Track2(this.Stacked(0));
                    this.Advance(1);
                }
                else
                {
                    this.Track(this.Stacked(0), this.Textpos());
                    this.Stack(this.Textpos());
                    this.Goto(this.Operand(0));
                }
                goto Label_0007;

            case 0x19:
                this.Stackframe(1);
                if ((this.Textpos() - this.Stacked(0)) == 0)
                {
                    this.Track2(this.Stacked(0));
                    break;
                }
                this.Track(this.Stacked(0), this.Textpos());
                break;

            case 0x1a:
                this.Stack(-1, this.Operand(0));
                this.Track();
                this.Advance(1);
                goto Label_0007;

            case 0x1b:
                this.Stack(this.Textpos(), this.Operand(0));
                this.Track();
                this.Advance(1);
                goto Label_0007;

            case 0x1c:
            {
                this.Stackframe(2);
                int num4 = this.Stacked(0);
                int num5 = this.Stacked(1);
                int num6 = this.Textpos() - num4;
                if ((num5 < this.Operand(1)) && ((num6 != 0) || (num5 < 0)))
                {
                    this.Track(num4);
                    this.Stack(this.Textpos(), num5 + 1);
                    this.Goto(this.Operand(0));
                }
                else
                {
                    this.Track2(num4, num5);
                    this.Advance(2);
                }
                goto Label_0007;
            }

            case 0x1d:
            {
                this.Stackframe(2);
                int num7 = this.Stacked(0);
                int num8 = this.Stacked(1);
                if (num8 >= 0)
                {
                    this.Track(num7, num8, this.Textpos());
                    this.Advance(2);
                }
                else
                {
                    this.Track2(num7);
                    this.Stack(this.Textpos(), num8 + 1);
                    this.Goto(this.Operand(0));
                }
                goto Label_0007;
            }

            case 30:
                this.Stack(-1);
                this.Track();
                this.Advance();
                goto Label_0007;

            case 0x1f:
                this.Stack(this.Textpos());
                this.Track();
                this.Advance();
                goto Label_0007;

            case 0x20:
                if ((this.Operand(1) != -1) && !base.IsMatched(this.Operand(1)))
                {
                    goto Label_0EA3;
                }
                this.Stackframe(1);
                if (this.Operand(1) != -1)
                {
                    base.TransferCapture(this.Operand(0), this.Operand(1), this.Stacked(0), this.Textpos());
                }
                else
                {
                    base.Capture(this.Operand(0), this.Stacked(0), this.Textpos());
                }
                this.Track(this.Stacked(0));
                this.Advance(2);
                goto Label_0007;

            case 0x21:
                this.Stackframe(1);
                this.Track(this.Stacked(0));
                this.Textto(this.Stacked(0));
                this.Advance();
                goto Label_0007;

            case 0x22:
                this.Stack(this.Trackpos(), base.Crawlpos());
                this.Track();
                this.Advance();
                goto Label_0007;

            case 0x23:
                this.Stackframe(2);
                this.Trackto(this.Stacked(0));
                while (base.Crawlpos() != this.Stacked(1))
                {
                    base.Uncapture();
                }
                goto Label_0EA3;

            case 0x24:
                this.Stackframe(2);
                this.Trackto(this.Stacked(0));
                this.Track(this.Stacked(1));
                this.Advance();
                goto Label_0007;

            case 0x25:
                if (!base.IsMatched(this.Operand(0)))
                {
                    goto Label_0EA3;
                }
                this.Advance(1);
                goto Label_0007;

            case 0x26:
                this.Goto(this.Operand(0));
                goto Label_0007;

            case 40:
                return;

            case 0x29:
                if (!base.IsECMABoundary(this.Textpos(), base.runtextbeg, base.runtextend))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x2a:
                if (base.IsECMABoundary(this.Textpos(), base.runtextbeg, base.runtextend))
                {
                    goto Label_0EA3;
                }
                this.Advance();
                goto Label_0007;

            case 0x83:
            case 0x84:
            {
                this.Trackframe(2);
                int num21  = this.Tracked(0);
                int newpos = this.Tracked(1);
                this.Textto(newpos);
                if (num21 > 0)
                {
                    this.Track(num21 - 1, newpos - this.Bump());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 0x85:
            {
                this.Trackframe(2);
                int num23 = this.Tracked(0);
                int num24 = this.Tracked(1);
                this.Textto(num24);
                if (num23 > 0)
                {
                    this.Track(num23 - 1, num24 - this.Bump());
                }
                this.Advance(3);
                goto Label_0007;
            }

            case 0x86:
            {
                this.Trackframe(2);
                int num27 = this.Tracked(1);
                this.Textto(num27);
                if (this.Forwardcharnext() != ((char)this.Operand(0)))
                {
                    goto Label_0EA3;
                }
                int num28 = this.Tracked(0);
                if (num28 > 0)
                {
                    this.Track(num28 - 1, num27 + this.Bump());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 0x87:
            {
                this.Trackframe(2);
                int num29 = this.Tracked(1);
                this.Textto(num29);
                if (this.Forwardcharnext() == ((char)this.Operand(0)))
                {
                    goto Label_0EA3;
                }
                int num30 = this.Tracked(0);
                if (num30 > 0)
                {
                    this.Track(num30 - 1, num29 + this.Bump());
                }
                this.Advance(2);
                goto Label_0007;
            }

            case 0x88:
            {
                this.Trackframe(2);
                int num31 = this.Tracked(1);
                this.Textto(num31);
                if (!RegexCharClass.CharInSet(this.Forwardcharnext(), this.runstrings[this.Operand(0)], this.runstrings[this.Operand(1)]))
                {
                    goto Label_0EA3;
                }
                int num32 = this.Tracked(0);
                if (num32 > 0)
                {
                    this.Track(num32 - 1, num31 + this.Bump());
                }
                this.Advance(3);
                goto Label_0007;
            }

            case 0x97:
                this.Trackframe(1);
                this.Textto(this.Tracked(0));
                this.Goto(this.Operand(0));
                goto Label_0007;

            case 0x98:
                this.Trackframe(2);
                this.Stackframe(1);
                this.Textto(this.Tracked(1));
                this.Track2(this.Tracked(0));
                this.Advance(1);
                goto Label_0007;

            case 0x99:
            {
                this.Trackframe(2);
                int num3 = this.Tracked(1);
                this.Track2(this.Tracked(0));
                this.Stack(num3);
                this.Textto(num3);
                this.Goto(this.Operand(0));
                goto Label_0007;
            }

            case 0x9a:
                this.Stackframe(2);
                goto Label_0EA3;

            case 0x9b:
                this.Stackframe(2);
                goto Label_0EA3;

            case 0x9c:
                this.Trackframe(1);
                this.Stackframe(2);
                if (this.Stacked(1) <= 0)
                {
                    this.Stack(this.Tracked(0), this.Stacked(1) - 1);
                    goto Label_0EA3;
                }
                this.Textto(this.Stacked(0));
                this.Track2(this.Tracked(0), this.Stacked(1) - 1);
                this.Advance(2);
                goto Label_0007;

            case 0x9d:
            {
                this.Trackframe(3);
                int num9  = this.Tracked(0);
                int num10 = this.Tracked(2);
                if ((this.Tracked(1) > this.Operand(1)) || (num10 == num9))
                {
                    this.Stack(this.Tracked(0), this.Tracked(1));
                    goto Label_0EA3;
                }
                this.Textto(num10);
                this.Stack(num10, this.Tracked(1) + 1);
                this.Track2(num9);
                this.Goto(this.Operand(0));
                goto Label_0007;
            }

            case 0x9e:
            case 0x9f:
                this.Stackframe(1);
                goto Label_0EA3;

            case 160:
                this.Trackframe(1);
                this.Stack(this.Tracked(0));
                base.Uncapture();
                if ((this.Operand(0) != -1) && (this.Operand(1) != -1))
                {
                    base.Uncapture();
                }
                goto Label_0EA3;

            case 0xa1:
                this.Trackframe(1);
                this.Stack(this.Tracked(0));
                goto Label_0EA3;

            case 0xa2:
                this.Stackframe(2);
                goto Label_0EA3;

            case 0xa4:
                this.Trackframe(1);
                while (base.Crawlpos() != this.Tracked(0))
                {
                    base.Uncapture();
                }
                goto Label_0EA3;

            case 280:
                this.Trackframe(1);
                this.Stack(this.Tracked(0));
                goto Label_0EA3;

            case 0x119:
                this.Stackframe(1);
                this.Trackframe(1);
                this.Stack(this.Tracked(0));
                goto Label_0EA3;

            case 0x11c:
                this.Trackframe(2);
                this.Stack(this.Tracked(0), this.Tracked(1));
                goto Label_0EA3;

            case 0x11d:
                this.Trackframe(1);
                this.Stackframe(2);
                this.Stack(this.Tracked(0), this.Stacked(1) - 1);
                goto Label_0EA3;

            default:
                throw new Exception(RegExRes.GetString(3));
            }
            this.Advance(1);
            goto Label_0007;
Label_0A06:
            this.Advance(1);
            goto Label_0007;
Label_0EA3:
            this.Backtrack();
            goto Label_0007;
        }