Esempio n. 1
0
        void Num()
        {
            int la0, la1;
            int dot = 0;

            // Line 181: ([.])?
            la0 = Src.LA0;
            if (la0 == '.')
            {
                dot = Src.MatchAny();
            }
            Src.MatchRange('0', '9');
            // Line 182: ([0-9])*
            for (;;)
            {
                la0 = Src.LA0;
                if (la0 >= '0' && la0 <= '9')
                {
                    Src.Skip();
                }
                else
                {
                    break;
                }
            }
            // Line 183: (&{dot == 0} [.] [0-9] ([0-9])*)?
            la0 = Src.LA0;
            if (la0 == '.')
            {
                if (dot == 0)
                {
                    la1 = Src.LA(1);
                    if (la1 >= '0' && la1 <= '9')
                    {
                        Src.Skip();
                        Src.Skip();
                        // Line 183: ([0-9])*
                        for (;;)
                        {
                            la0 = Src.LA0;
                            if (la0 >= '0' && la0 <= '9')
                            {
                                Src.Skip();
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
            }
                        #line 184 "Grammars.ecs"
            _tok.Value = double.Parse(Src.CharSource.Slice(_tok.StartIndex, Src.InputPosition - _tok.StartIndex).ToString());
                        #line default
        }
Esempio n. 2
0
        void Id()
        {
            int la0;

            Src.Skip();
            // Line 177: ([0-9A-Z_a-z])*
            for (;;)
            {
                la0 = Src.LA0;
                if (Id_set0.Contains(la0))
                {
                    Src.Skip();
                }
                else
                {
                    break;
                }
            }
                        #line 178 "Grammars.ecs"
            _tok.Value = Src.CharSource.Slice(_tok.StartIndex, Src.InputPosition - _tok.StartIndex).ToString();
                        #line default
        }
Esempio n. 3
0
        public bool MoveNext()
        {
            int la0, la1;

            // Line 161: ([\t ])*
            for (;;)
            {
                la0 = Src.LA0;
                if (la0 == '\t' || la0 == ' ')
                {
                    Src.Skip();
                }
                else
                {
                    break;
                }
            }
            _tok.StartIndex = Src.InputPosition;
            _tok.Value      = null;
            // Line 164: ( (Num | Id | [.] [n] [a] [n] | [.] [i] [n] [f]) | ([>] [>] / [<] [<] / [=] / [>] / [<] / [\^] / [*] / [/] / [+] / [\-] / [;] / [(] / [)]) )
            do
            {
                la0 = Src.LA0;
                switch (la0)
                {
                case '.':
                {
                    la1 = Src.LA(1);
                    if (la1 >= '0' && la1 <= '9')
                    {
                        goto matchNum;
                    }
                    else if (la1 == 'n')
                    {
                                                        #line 166 "Grammars.ecs"
                        _tok.Type = TT.Num;
                                                        #line default
                        Src.Skip();
                        Src.Skip();
                        Src.Match('a');
                        Src.Match('n');
                                                        #line 166 "Grammars.ecs"
                        _tok.Value = double.NaN;
                                                        #line default
                    }
                    else if (la1 == 'i')
                    {
                                                        #line 167 "Grammars.ecs"
                        _tok.Type = TT.Num;
                                                        #line default
                        Src.Skip();
                        Src.Skip();
                        Src.Match('n');
                        Src.Match('f');
                                                        #line 167 "Grammars.ecs"
                        _tok.Value = double.PositiveInfinity;
                                                        #line default
                    }
                    else
                    {
                        goto error;
                    }
                }
                break;

                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    goto matchNum;

                case '>':
                {
                    la1 = Src.LA(1);
                    if (la1 == '>')
                    {
                        Src.Skip();
                        Src.Skip();
                                                        #line 198 "Grammars.ecs"
                        _tok.Type = TT.Shr;
                                                        #line default
                    }
                    else
                    {
                        Src.Skip();
                                                        #line 198 "Grammars.ecs"
                        _tok.Type = TT.GT;
                                                        #line default
                    }
                }
                break;

                case '<':
                {
                    la1 = Src.LA(1);
                    if (la1 == '<')
                    {
                        Src.Skip();
                        Src.Skip();
                                                        #line 198 "Grammars.ecs"
                        _tok.Type = TT.Shl;
                                                        #line default
                    }
                    else
                    {
                        Src.Skip();
                                                        #line 198 "Grammars.ecs"
                        _tok.Type = TT.LT;
                                                        #line default
                    }
                }
                break;

                case '=':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Assign;
                                                #line default
                }
                break;

                case '^':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Exp;
                                                #line default
                }
                break;

                case '*':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Mul;
                                                #line default
                }
                break;

                case '/':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Div;
                                                #line default
                }
                break;

                case '+':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Add;
                                                #line default
                }
                break;

                case '-':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Sub;
                                                #line default
                }
                break;

                case ';':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.Semicolon;
                                                #line default
                }
                break;

                case '(':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.LParen;
                                                #line default
                }
                break;

                case ')':
                {
                    Src.Skip();
                                                #line 198 "Grammars.ecs"
                    _tok.Type = TT.RParen;
                                                #line default
                }
                break;

                default:
                    if (la0 >= 'A' && la0 <= 'Z' || la0 == '_' || la0 >= 'a' && la0 <= 'z')
                    {
                                                #line 165 "Grammars.ecs"
                        _tok.Type = TT.Id;
                                                #line default
                        Id();
                    }
                    else
                    {
                        goto error;
                    }
                    break;
                }
                break;
matchNum:
                {
                                        #line 164 "Grammars.ecs"
                    _tok.Type = TT.Num;
                                        #line default
                    Num();
                }
                break;
error:
                {
                                        #line 170 "Grammars.ecs"
                    _tok.Type = TT.EOF;
                                        #line default
                    // Line 170: ([^\$])?
                    la0 = Src.LA0;
                    if (la0 != -1)
                    {
                        Src.Skip();
                                                #line 170 "Grammars.ecs"
                        _tok.Type = TT.Unknown;
                                                #line default
                    }
                }
            } while (false);
                        #line 172 "Grammars.ecs"
            return(_tok.Type != TT.EOF);

                        #line default
        }