当前位置: 首页>>代码示例>>C#>>正文


C# BitSet.Member方法代码示例

本文整理汇总了C#中Antlr.Runtime.BitSet.Member方法的典型用法代码示例。如果您正苦于以下问题:C# BitSet.Member方法的具体用法?C# BitSet.Member怎么用?C# BitSet.Member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Antlr.Runtime.BitSet的用法示例。


在下文中一共展示了BitSet.Member方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MismatchIsMissingToken

		public bool MismatchIsMissingToken(IIntStream input, BitSet follow) {
			if (follow == null) {
				// we have no information about the follow; we can only consume
				// a single token and hope for the best
				return false;
			}

			// compute what can follow this grammar element reference
			if (follow.Member(Token.EOR_TOKEN_TYPE)) {
				BitSet viableTokensFollowingThisRule = ComputeContextSensitiveRuleFOLLOW();
				follow = follow.Or(viableTokensFollowingThisRule);
				if (state.followingStackPointer >= 0) { // remove EOR if we're not the start symbol
					follow.Remove(Token.EOR_TOKEN_TYPE);
				}
			}

			// if current token is consistent with what could come after set
			// then we know we're missing a token; error recovery is free to
			// "insert" the missing token

			// BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
			// in follow set to indicate that the fall of the start symbol is
			// in the set (EOF can follow).
			if ( follow.Member(input.LA(1)) || follow.Member(Token.EOR_TOKEN_TYPE) ) {
				return true;
			}
			return false;
		}
开发者ID:sebasjm,项目名称:antlr,代码行数:28,代码来源:BaseRecognizer.cs

示例2: ConsumeUntil

		/// <summary>Consume tokens until one matches the given token set </summary>
		public virtual void ConsumeUntil(IIntStream input, BitSet set)
		{
			int ttype = input.LA(1);
			while (ttype != Token.EOF && !set.Member(ttype))
			{
				input.Consume();
				ttype = input.LA(1);
			}
		}
开发者ID:sebasjm,项目名称:antlr,代码行数:10,代码来源:BaseRecognizer.cs

示例3: GetTokens

 public virtual List<IToken> GetTokens(int start, int stop, BitSet types)
 {
     if (this._p == -1)
     {
         this.Setup();
     }
     if (stop >= this._tokens.Count)
     {
         stop = this._tokens.Count - 1;
     }
     if (start < 0)
     {
         start = 0;
     }
     if (start > stop)
     {
         return null;
     }
     List<IToken> list = new List<IToken>();
     for (int i = start; i <= stop; i++)
     {
         IToken item = this._tokens[i];
         if ((types == null) || types.Member(item.Type))
         {
             list.Add(item);
         }
     }
     if (list.Count == 0)
     {
         list = null;
     }
     return list;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:33,代码来源:BufferedTokenStream.cs

示例4: GetTokens

        /** <summary>
         *  Given a start and stop index, return a List of all tokens in
         *  the token type BitSet.  Return null if no tokens were found.  This
         *  method looks at both on and off channel tokens.
         *  </summary>
         */
        public virtual IList<IToken> GetTokens( int start, int stop, BitSet types )
        {
            if ( p == -1 )
            {
                FillBuffer();
            }
            if ( stop >= tokens.Count )
            {
                stop = tokens.Count - 1;
            }
            if ( start < 0 )
            {
                start = 0;
            }
            if ( start > stop )
            {
                return null;
            }

            // list = tokens[start:stop]:{Token t, t.getType() in types}
            IList<IToken> filteredTokens = new List<IToken>();
            for ( int i = start; i <= stop; i++ )
            {
                IToken t = tokens[i];
                if ( types == null || types.Member( t.Type ) )
                {
                    filteredTokens.Add( t );
                }
            }
            if ( filteredTokens.Count == 0 )
            {
                filteredTokens = null;
            }
            return filteredTokens;
        }
开发者ID:antlr,项目名称:antlrcs,代码行数:41,代码来源:LegacyCommonTokenStream.cs

示例5: GetTokens

        /** Given a start and stop index, return a List of all tokens in
         *  the token type BitSet.  Return null if no tokens were found.  This
         *  method looks at both on and off channel tokens.
         */
        public virtual List<IToken> GetTokens(int start, int stop, BitSet types)
        {
            if (_p == -1)
                Setup();
            if (stop >= _tokens.Count)
                stop = _tokens.Count - 1;
            if (start < 0)
                start = 0;
            if (start > stop)
                return null;

            // list = tokens[start:stop]:{Token t, t.getType() in types}
            List<IToken> filteredTokens = new List<IToken>();
            for (int i = start; i <= stop; i++)
            {
                IToken t = _tokens[i];
                if (types == null || types.Member(t.Type))
                {
                    filteredTokens.Add(t);
                }
            }
            if (filteredTokens.Count == 0)
            {
                filteredTokens = null;
            }
            return filteredTokens;
        }
开发者ID:antlr,项目名称:antlrcs,代码行数:31,代码来源:BufferedTokenStream.cs

示例6: MismatchIsMissingToken

        public virtual bool MismatchIsMissingToken( IIntStream input, BitSet follow )
        {
            if ( follow == null )
            {
                // we have no information about the follow; we can only consume
                // a single token and hope for the best
                return false;
            }
            // compute what can follow this grammar element reference
            if ( follow.Member( TokenTypes.EndOfRule ) )
            {
                BitSet viableTokensFollowingThisRule = ComputeContextSensitiveRuleFOLLOW();
                follow = follow.Or( viableTokensFollowingThisRule );
                if ( state._fsp >= 0 )
                { // remove EOR if we're not the start symbol
                    follow.Remove( TokenTypes.EndOfRule );
                }
            }
            // if current token is consistent with what could come after set
            // then we know we're missing a token; error recovery is free to
            // "insert" the missing token

            //System.out.println("viable tokens="+follow.toString(getTokenNames()));
            //System.out.println("LT(1)="+((TokenStream)input).LT(1));

            // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
            // in follow set to indicate that the fall of the start symbol is
            // in the set (EOF can follow).
            if ( follow.Member( input.LA( 1 ) ) || follow.Member( TokenTypes.EndOfRule ) )
            {
                //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
                return true;
            }
            return false;
        }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:35,代码来源:BaseRecognizer.cs

示例7: ConsumeUntil

 /** <summary>Consume tokens until one matches the given token set</summary> */
 public virtual void ConsumeUntil( IIntStream input, BitSet set )
 {
     //System.out.println("consumeUntil("+set.toString(getTokenNames())+")");
     int ttype = input.LA( 1 );
     while ( ttype != TokenTypes.EndOfFile && !set.Member( ttype ) )
     {
         //System.out.println("consume during recover LA(1)="+getTokenNames()[input.LA(1)]);
         input.Consume();
         ttype = input.LA( 1 );
     }
 }
开发者ID:biddyweb,项目名称:azfone-ios,代码行数:12,代码来源:BaseRecognizer.cs

示例8: ConsumeUntil

 public virtual void ConsumeUntil(IIntStream input, BitSet set)
 {
     for (int i = input.LA(1); (i != -1) && !set.Member(i); i = input.LA(1))
     {
         input.Consume();
     }
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:7,代码来源:BaseRecognizer.cs

示例9: MismatchIsMissingToken

 public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow)
 {
     if (follow == null)
     {
         return false;
     }
     if (follow.Member(1))
     {
         BitSet a = this.ComputeContextSensitiveRuleFOLLOW();
         follow = follow.Or(a);
         if (this.state._fsp >= 0)
         {
             follow.Remove(1);
         }
     }
     if (!follow.Member(input.LA(1)) && !follow.Member(1))
     {
         return false;
     }
     return true;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:21,代码来源:BaseRecognizer.cs


注:本文中的Antlr.Runtime.BitSet.Member方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。