Esempio n. 1
0
 private void RestoreStateAndPos(Scanner.Context ctx)
 {
     this.buffer.Pos = ctx.bPos;
     this.cNum       = ctx.cNum;
     this.state      = ctx.state;
     this.chr        = ctx.cChr;
 }
Esempio n. 2
0
        private Scanner.Result Recurse2(Scanner.Context ctx, int next)
        {
            this.SaveStateAndPos(ctx);
            this.state = next;
            if (this.state == 0)
            {
                return(Scanner.Result.accept);
            }
            this.GetChr();
            bool flag = false;

            while ((next = this.NextState()) != this.currentStart)
            {
                if (flag && next > 40)
                {
                    this.SaveStateAndPos(ctx);
                }
                this.state = next;
                if (this.state == 0)
                {
                    return(Scanner.Result.accept);
                }
                this.GetChr();
                flag = (this.state <= 40);
            }
            if (flag)
            {
                return(Scanner.Result.accept);
            }
            return(Scanner.Result.noMatch);
        }
Esempio n. 3
0
 private void SaveStateAndPos(Scanner.Context ctx)
 {
     ctx.bPos  = this.buffer.Pos;
     ctx.cNum  = this.cNum;
     ctx.state = this.state;
     ctx.cChr  = this.chr;
 }
Esempio n. 4
0
 private void RestorePos(Scanner.Context ctx)
 {
     this.buffer.Pos = ctx.bPos;
     this.cNum       = ctx.cNum;
 }
Esempio n. 5
0
        private int Scan()
        {
            int result2;

            try
            {
                for (;;)
                {
                    bool flag = false;
                    this.state = this.currentStart;
                    while (this.NextState() == this.state)
                    {
                        this.GetChr();
                    }
                    this.MarkToken();
                    int num;
                    while ((num = this.NextState()) != this.currentStart)
                    {
                        if (flag && num > 40)
                        {
                            Scanner.Context ctx    = new Scanner.Context();
                            Scanner.Result  result = this.Recurse2(ctx, num);
                            if (result == Scanner.Result.noMatch)
                            {
                                this.RestoreStateAndPos(ctx);
                                break;
                            }
                            break;
                        }
                        else
                        {
                            this.state = num;
                            this.GetChr();
                            if (this.state <= 40)
                            {
                                flag = true;
                            }
                        }
                    }
                    if (this.state > 40)
                    {
                        this.state = this.currentStart;
                    }
                    else
                    {
                        this.MarkEnd();
                        switch (this.state)
                        {
                        case 0:
                            goto IL_154;

                        case 1:
                        case 7:
                            goto IL_15C;

                        case 2:
                        case 11:
                        case 12:
                            goto IL_162;

                        case 3:
                            goto IL_167;

                        case 4:
                            goto IL_16C;

                        case 5:
                            goto IL_172;

                        case 6:
                            goto IL_178;

                        case 8:
                            goto IL_17E;

                        case 9:
                        case 10:
                            goto IL_183;

                        case 13:
                        case 14:
                        case 15:
                        case 16:
                        case 17:
                        case 18:
                        case 19:
                        case 20:
                        case 24:
                        case 26:
                        case 27:
                        case 28:
                        case 34:
                        case 35:
                            goto IL_188;

                        case 21:
                            goto IL_18E;

                        case 22:
                            goto IL_194;

                        case 23:
                            goto IL_19A;

                        case 25:
                            goto IL_1A0;

                        case 29:
                            goto IL_1A6;

                        case 30:
                            goto IL_1AC;

                        case 31:
                            goto IL_1B2;

                        case 32:
                            goto IL_1B8;

                        case 33:
                            goto IL_1BE;

                        case 36:
                            goto IL_1C4;

                        case 37:
                            goto IL_1CA;

                        case 38:
                        case 39:
                            goto IL_1D0;

                        case 40:
                            goto IL_1D5;
                        }
                    }
                }
IL_154:
                return(2);

IL_15C:
                return(22);

IL_162:
                return(6);

IL_167:
                return(3);

IL_16C:
                return(9);

IL_172:
                return(10);

IL_178:
                return(24);

IL_17E:
                return(7);

IL_183:
                return(8);

IL_188:
                return(22);

IL_18E:
                return(12);

IL_194:
                return(11);

IL_19A:
                return(14);

IL_1A0:
                return(19);

IL_1A6:
                return(21);

IL_1AC:
                return(17);

IL_1B2:
                return(15);

IL_1B8:
                return(18);

IL_1BE:
                return(16);

IL_1C4:
                return(20);

IL_1CA:
                return(13);

IL_1D0:
                return(5);

IL_1D5:
                result2 = 4;
            }
            finally
            {
                this.LoadYylval();
            }
            return(result2);
        }