コード例 #1
0
        private void  consumeFirst()
        {
            consume();             // get first token of input stream

            // Handle situation where hidden or discarded tokens
            // appear first in input stream
            IHiddenStreamToken p = null;

            // while hidden or discarded scarf tokens
            while (hideMask.member(LA(1).Type) || discardMask.member(LA(1).Type))
            {
                if (hideMask.member(LA(1).Type))
                {
                    if (p == null)
                    {
                        p = LA(1);
                    }
                    else
                    {
                        p.setHiddenAfter(LA(1));
                        LA(1).setHiddenBefore(p);                         // double-link
                        p = LA(1);
                    }
                    lastHiddenToken = p;
                    if (firstHidden == null)
                    {
                        firstHidden = p;                         // record hidden token if first
                    }
                }
                consume();
            }
        }
コード例 #2
0
ファイル: TreeParser.cs プロジェクト: Qq247534686/DataFolder
 /*Make sure current lookahead symbol matches the given set
  * Throw an exception upon mismatch, which is catch by either the
  * error handler or by the syntactic predicate.
  */
 public virtual void  match(AST t, BitSet b)
 {
     if (t == null || t == ASTNULL || !b.member(t.Type))
     {
         throw new MismatchedTokenException(getTokenNames(), t, b, false);
     }
 }
コード例 #3
0
ファイル: Parser.cs プロジェクト: Qq247534686/DataFolder
 /*Consume tokens until one matches the given token set */
 public virtual void  consumeUntil(BitSet bset)
 {
     while (LA(1) != Token.EOF_TYPE && !bset.member(LA(1)))
     {
         consume();
     }
 }
コード例 #4
0
ファイル: CharScanner.cs プロジェクト: Qq247534686/DataFolder
 /*Consume chars until one matches the given set */
 public virtual void  consumeUntil(BitSet bset)
 {
     while (cached_LA1 != EOF_CHAR && !bset.member(cached_LA1))
     {
         consume();
     }
 }
コード例 #5
0
ファイル: CharScanner.cs プロジェクト: Qq247534686/DataFolder
 public virtual void  match(BitSet b)
 {
     if (!b.member(cached_LA1))
     {
         throw new MismatchedCharException(cached_LA1, b, false, this);
     }
     consume();
 }
コード例 #6
0
        public virtual IToken nextToken()
        {
            IToken tok = input.nextToken();

            while (tok != null && discardMask.member(tok.Type))
            {
                tok = input.nextToken();
            }
            return(tok);
        }
コード例 #7
0
ファイル: Parser.cs プロジェクト: Qq247534686/DataFolder
 /*Make sure current lookahead symbol matches the given set
  * Throw an exception upon mismatch, which is catch by either the
  * error handler or by the syntactic predicate.
  */
 public virtual void  match(BitSet b)
 {
     if (!b.member(LA(1)))
     {
         throw new MismatchedTokenException(tokenNames, LT(1), b, false, getFilename());
     }
     else
     {
         consume();
     }
 }
コード例 #8
0
ファイル: Parser.cs プロジェクト: Binodesk/spring-net
		/*Make sure current lookahead symbol matches the given set
		* Throw an exception upon mismatch, which is catch by either the
		* error handler or by the syntactic predicate.
		*/
		public virtual void  match(BitSet b)
		{
			if (!b.member(LA(1)))
				throw new MismatchedTokenException(tokenNames, LT(1), b, false, getFilename());
			else
				consume();
		}
コード例 #9
0
ファイル: Parser.cs プロジェクト: Binodesk/spring-net
		/*Consume tokens until one matches the given token set */
		public virtual void  consumeUntil(BitSet bset)
		{
			while (LA(1) != Token.EOF_TYPE && !bset.member(LA(1)))
			{
				consume();
			}
		}
コード例 #10
0
		/*Make sure current lookahead symbol matches the given set
		* Throw an exception upon mismatch, which is catch by either the
		* error handler or by the syntactic predicate.
		*/
		public virtual void  match(AST t, BitSet b)
		{
			if (t == null || t == ASTNULL || !b.member(t.Type))
			{
				throw new MismatchedTokenException(getTokenNames(), t, b, false);
			}
		}
コード例 #11
0
ファイル: CharScanner.cs プロジェクト: fgq841103/spring-net
		public virtual void  match(BitSet b)
		{
			if (!b.member(cached_LA1))
			{
				throw new MismatchedCharException(cached_LA1, b, false, this);
			}
			consume();
		}
コード例 #12
0
ファイル: CharScanner.cs プロジェクト: fgq841103/spring-net
		/*Consume chars until one matches the given set */
		public virtual void  consumeUntil(BitSet bset)
		{
			while (cached_LA1 != EOF_CHAR && !bset.member(cached_LA1))
			{
				consume();
			}
		}