Beispiel #1
0
 private int Jj_ntk()
 {
     if ((Jj_nt = Token.Next) == null)
     {
         return(jj_ntk = (Token.Next = TokenSource.GetNextToken()).Kind);
     }
     else
     {
         return(jj_ntk = Jj_nt.Kind);
     }
 }
Beispiel #2
0
 /// <summary>Get the next Token.</summary>
 public Token GetNextToken()
 {
     if (Token.Next != null)
     {
         Token = Token.Next;
     }
     else
     {
         Token = Token.Next = TokenSource.GetNextToken();
     }
     jj_ntk = -1;
     jj_gen++;
     return(Token);
 }
Beispiel #3
0
        /// <summary>Get the specific Token.</summary>
        public Token GetToken(int index)
        {
            Token t = Token;

            for (int i = 0; i < index; i++)
            {
                if (t.Next != null)
                {
                    t = t.Next;
                }
                else
                {
                    t = t.Next = TokenSource.GetNextToken();
                }
            }
            return(t);
        }
Beispiel #4
0
 private readonly LookaheadSuccess jj_ls = new LookaheadSuccess(); // LUCENENET: marked readonly
 private bool Jj_scan_token(int kind)
 {
     if (jj_scanpos == jj_lastpos)
     {
         jj_la--;
         if (jj_scanpos.Next == null)
         {
             jj_lastpos = jj_scanpos = jj_scanpos.Next = TokenSource.GetNextToken();
         }
         else
         {
             jj_lastpos = jj_scanpos = jj_scanpos.Next;
         }
     }
     else
     {
         jj_scanpos = jj_scanpos.Next;
     }
     if (jj_rescan)
     {
         int   i   = 0;
         Token tok = Token;
         while (tok != null && tok != jj_scanpos)
         {
             i++;
             tok = tok.Next;
         }
         if (tok != null)
         {
             Jj_add_error_token(kind, i);
         }
     }
     if (jj_scanpos.Kind != kind)
     {
         return(true);
     }
     if (jj_la == 0 && jj_scanpos == jj_lastpos)
     {
         throw jj_ls;
     }
     return(false);
 }
Beispiel #5
0
        private Token Jj_consume_token(int kind)
        {
            Token oldToken;

            if ((oldToken = Token).Next != null)
            {
                Token = Token.Next;
            }
            else
            {
                Token = Token.Next = TokenSource.GetNextToken();
            }
            jj_ntk = -1;
            if (Token.Kind == kind)
            {
                jj_gen++;
                if (++jj_gc > 100)
                {
                    jj_gc = 0;
                    for (int i = 0; i < jj_2_rtns.Length; i++)
                    {
                        JJCalls c = jj_2_rtns[i];
                        while (c != null)
                        {
                            if (c.gen < jj_gen)
                            {
                                c.first = null;
                            }
                            c = c.next;
                        }
                    }
                }
                return(Token);
            }
            Token   = oldToken;
            jj_kind = kind;
            throw GenerateParseException();
        }