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


C# ITokenSource类代码示例

本文整理汇总了C#中ITokenSource的典型用法代码示例。如果您正苦于以下问题:C# ITokenSource类的具体用法?C# ITokenSource怎么用?C# ITokenSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ProcessTerm

 public bool ProcessTerm(ITokenSource source)
 {
     var term = new ArraySegmentKey<char>(source.Buffer, source.Size);
     if (_stopWords.Contains(term))
         return false;
     return true;
 }
开发者ID:josephdecock,项目名称:Corax,代码行数:7,代码来源:StopWordsFilter.cs

示例2: ExecuteQueryFunc

 public List<Result> ExecuteQueryFunc(Query query, ITokenSource cancelToken)
 {
     if (QueryFunc != null) {
         return QueryFunc(query, cancelToken);
     }
     return new List<Result>();
 }
开发者ID:jameshy,项目名称:else,代码行数:7,代码来源:BaseProvider.cs

示例3: ProcessTerm

 public bool ProcessTerm(ITokenSource source)
 {
     for (int i = 0; i < source.Size; i++)
     {
         source.Buffer[i] = char.ToLowerInvariant(source.Buffer[i]);
     }
     return true;
 }
开发者ID:josephdecock,项目名称:Corax,代码行数:8,代码来源:LowerCaseFilter.cs

示例4: Process

 public bool Process(string field, ITokenSource source)
 {
     for (int i = 0; i < _filters.Length; i++)
     {
         if (_filters[i].ProcessTerm(source) == false)
             return false;
     }
     return true;
 }
开发者ID:josephdecock,项目名称:Corax,代码行数:9,代码来源:DefaultAnalyzer.cs

示例5: Run

        //    public object Run(string parameters)//, CancellationToken ct)
        //    {
        //        for (int i = 0; i < 2; i++)
        //        {
        //            //ct.ThrowIfCancellationRequested();
        //            Thread.Sleep(5000);
        //        }
        //        return "Hello from MyCustomJob in App1";
        //    }
        public void Run(ITokenSource tokenSource)
        {
            for (int i = 0; i < 5; i++)
            {
                tokenSource.Token.ThrowIfCancellationRequested();
                Thread.Sleep(5000);
            }

            AutoMapper.Mapper.CreateMap<Class1, Class2>();
        }
开发者ID:BredStik,项目名称:RemoteJobExecutor,代码行数:19,代码来源:MyCustomJob.cs

示例6: ProcessTerm

 public bool ProcessTerm(ITokenSource source)
 {
     if (source.Size <= 2)
         return true;
     if (source.Buffer[source.Size - 1] == '\'') // remove "boys' ball" suffix '
     {
         source.Size--;
     }
     // remove "boy's ball" suffix 's
     else if ((source.Buffer[source.Size - 1] == 's') && source.Buffer[source.Size - 2] == '\'')
     {
         source.Size -= 2;
     }
     return true;
 }
开发者ID:josephdecock,项目名称:Corax,代码行数:15,代码来源:RemovePossesiveSuffix.cs

示例7: Parse

        /// <summary>
        /// Parses the given token source using the specified grammar, starting with
        /// expression with the given name.
        /// </summary>
        /// <param name="expressionType">The type of the expression to start parsing.</param>
        /// <param name="tokenSource">The source of tokens.</param>
        public MatchResult Parse(string expressionType, ITokenSource tokenSource)
        {
            if (tokenSource == null)
            {
                throw new ArgumentNullException("tokenSource");
            }

            Expression expression = grammar.Expression(expressionType);
            ParseAttempt attempt = new ParseAttempt(this, tokenSource);
            MatchResult result = expression.Match(attempt, String.Empty);

            // check that there are no trailing tokens
            if (result.IsMatch && attempt.GetToken() != null)
            {
                result.IsMatch = false;
            }

            return result;
        }
开发者ID:kobynet,项目名称:SQLGeneration,代码行数:25,代码来源:Parser.cs

示例8: CommonTokenStream

 public CommonTokenStream(ITokenSource tokenSource, int channel)
     : base(tokenSource)
 {
     this._channel = channel;
 }
开发者ID:benpriebe,项目名称:TypeSql,代码行数:5,代码来源:CommonTokenStream.cs

示例9: ConstructToken

 protected internal virtual IToken ConstructToken(ITokenSource tokenSource, int expectedTokenType, string tokenText, IToken current)
 {
     ITokenFactory factory = tokenSource.TokenFactory;
     return factory.Create(Tuple.Create(tokenSource, current.TokenSource.InputStream), expectedTokenType, tokenText, TokenConstants.DefaultChannel, -1, -1, current.Line, current.Column);
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:5,代码来源:DefaultErrorStrategy.cs

示例10: UnbufferedTokenStream

 public UnbufferedTokenStream(ITokenSource tokenSource, int bufferSize)
 {
     this.TokenSource = tokenSource;
     this.tokens = new IToken[bufferSize];
     n = 0;
     Fill(1);
 }
开发者ID:RainerBosch,项目名称:antlr4,代码行数:7,代码来源:UnbufferedTokenStream.cs

示例11: TokenRewriteStream

 public TokenRewriteStream(ITokenSource tokenSource, int channel)
     : base(tokenSource, channel)
     {
     Init();
     }
开发者ID:rgatkinson,项目名称:nadir,代码行数:5,代码来源:AntrRuntimeFixes.cs

示例12: NadirTokenStream

 public NadirTokenStream(ITokenSource tokenSource, int channel) : base(tokenSource, channel)
     {
     }
开发者ID:rgatkinson,项目名称:nadir,代码行数:3,代码来源:AntrRuntimeFixes.cs

示例13: CommonTokenStream

 /// <summary>
 /// Constructs a new
 /// <see cref="CommonTokenStream"/>
 /// using the specified token
 /// source and the default token channel (
 /// <see cref="TokenConstants.DefaultChannel"/>
 /// ).
 /// </summary>
 /// <param name="tokenSource">The token source.</param>
 public CommonTokenStream(ITokenSource tokenSource)
     : base(tokenSource)
 {
 }
开发者ID:rharrisxtheta,项目名称:antlr4cs,代码行数:13,代码来源:CommonTokenStream.cs

示例14: TokenStreamRemovable

 public TokenStreamRemovable(ITokenSource tokenSource, int channel) : base(tokenSource, channel) { }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:1,代码来源:TokenStreamRemovable.cs

示例15: LegacyCommonTokenStream

 public LegacyCommonTokenStream(ITokenSource tokenSource)
     : this()
 {
     this._tokenSource = tokenSource;
 }
开发者ID:antlr,项目名称:antlrcs,代码行数:5,代码来源:LegacyCommonTokenStream.cs


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