Describes the input token stream.
Esempio n. 1
0
 public Token GetNextToken()
 {
     if (token.next != null)
         token = token.next;
     else
         token = token.next = token_source.GetNextToken();
     jj_ntk_Renamed_Field = - 1;
     jj_gen++;
     return token;
 }
Esempio n. 2
0
        private void  jj_rescan_token()
        {
            jj_rescan = true;
            for (int i = 0; i < 2; i++)
            {
                JJCalls p = jj_2_rtns[i];
                do 
                {
                    if (p.gen > jj_gen)
                    {
                        jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
                        switch (i)
                        {
							
                            case 0:  jj_3_1(); break;
							
                            case 1:  jj_3_2(); break;
                        }
                    }
                    p = p.next;
                }
                while (p != null);
            }
            jj_rescan = false;
        }
Esempio n. 3
0
 private Token jj_consume_token(int kind)
 {
     Token oldToken;
     if ((oldToken = token).next != null)
         token = token.next;
     else
         token = token.next = token_source.GetNextToken();
     jj_ntk_Renamed_Field = -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();
 }
Esempio n. 4
0
 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 = token_source.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;
 }
Esempio n. 5
0
 public virtual void  ReInit(System.IO.StreamReader stream)
 {
     jj_input_stream.ReInit(stream, 1, 1);
     token_source.ReInit(jj_input_stream);
     token = new Token();
     jj_ntk_Renamed_Field = - 1;
     jj_gen = 0;
     for (int i = 0; i < 14; i++)
         jj_la1[i] = - 1;
     for (int i = 0; i < jj_2_rtns.Length; i++)
         jj_2_rtns[i] = new JJCalls();
 }
Esempio n. 6
0
 public virtual void  ReInit(HTMLParserTokenManager tm)
 {
     token_source = tm;
     token = new Token();
     jj_ntk_Renamed_Field = - 1;
     jj_gen = 0;
     for (int i = 0; i < 14; i++)
         jj_la1[i] = - 1;
     for (int i = 0; i < jj_2_rtns.Length; i++)
         jj_2_rtns[i] = new JJCalls();
 }
Esempio n. 7
0
 public HTMLParser(System.IO.StreamReader stream)
 {
     InitBlock();
     jj_input_stream = new SimpleCharStream(stream, 1, 1);
     token_source = new HTMLParserTokenManager(jj_input_stream);
     token = new Token();
     jj_ntk_Renamed_Field = -1;
     jj_gen = 0;
     for (int i = 0; i < 14; i++)
         jj_la1[i] = - 1;
     for (int i = 0; i < jj_2_rtns.Length; i++)
         jj_2_rtns[i] = new JJCalls();
 }
Esempio n. 8
0
		public HTMLParser(HTMLParserTokenManager tm)
		{
			InitBlock();
			token_source = tm;
			token = new Token();
			jj_ntk = - 1;
			jj_gen = 0;
			for (int i = 0; i < 14; i++)
				jj_la1[i] = - 1;
			for (int i = 0; i < jj_2_rtns.Length; i++)
				jj_2_rtns[i] = new JJCalls();
		}
Esempio n. 9
0
		/// <summary> This constructor is used by the method "generateParseException"
		/// in the generated parser.  Calling this constructor generates
		/// a new object of this type with the fields "currentToken",
		/// "expectedTokenSequences", and "tokenImage" set.  The boolean
		/// flag "specialConstructor" is also set to true to indicate that
		/// this constructor was used to create this object.
		/// This constructor calls its super class with the empty string
		/// to force the "toString" method of parent class "Throwable" to
		/// print the error message in the form:
		/// ParseException: <result of getMessage>
		/// </summary>
		public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, System.String[] tokenImageVal):base("")
		{
			specialConstructor = true;
			currentToken = currentTokenVal;
			expectedTokenSequences = expectedTokenSequencesVal;
			tokenImage = tokenImageVal;
		}
Esempio n. 10
0
		public virtual void  ReInit(System.IO.Stream stream, System.String encoding)
		{
			try
			{
				jj_input_stream.ReInit(stream, encoding, 1, 1);
			}
			catch (System.IO.IOException e)
			{
				throw new System.Exception(e.Message, e);
			}
			token_source.ReInit(jj_input_stream);
			token = new Token();
			jj_ntk = - 1;
			jj_gen = 0;
			for (int i = 0; i < 14; i++)
				jj_la1[i] = - 1;
			for (int i = 0; i < jj_2_rtns.Length; i++)
				jj_2_rtns[i] = new JJCalls();
		}
Esempio n. 11
0
		public HTMLParser(System.IO.Stream stream, System.String encoding)
		{
			InitBlock();
			try
			{
				jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
			}
			catch (System.IO.IOException e)
			{
				throw new System.Exception(e.Message, e);
			}
			token_source = new HTMLParserTokenManager(jj_input_stream);
			token = new Token();
			jj_ntk = - 1;
			jj_gen = 0;
			for (int i = 0; i < 14; i++)
				jj_la1[i] = - 1;
			for (int i = 0; i < jj_2_rtns.Length; i++)
				jj_2_rtns[i] = new JJCalls();
		}