• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITokenSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AntlrParserTokenStream

 public AntlrParserTokenStream(ITokenSource tokenSource)
     : base(tokenSource)
 {
 }
开发者ID:sebandraos,项目名称:LangSvcV2,代码行数:4,代码来源:AntlrParserTokenStream.cs


示例17: BufferedTokenStream

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


示例18: BufferedTokenStream

 public BufferedTokenStream(ITokenSource tokenSource)
 {
     this._tokens = new List<IToken>(100);
     this._p = -1;
     this._tokenSource = tokenSource;
 }
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:6,代码来源:BufferedTokenStream.cs


示例19: SnapshotTokenFactory

 public SnapshotTokenFactory(ITextSnapshot snapshot, ITokenSource effectiveSource)
 {
     this.snapshot = snapshot;
     this.effectiveSource = Tuple.Create(effectiveSource, effectiveSource.InputStream);
 }
开发者ID:chandramouleswaran,项目名称:LangSvcV2,代码行数:5,代码来源:SnapshotTokenFactory.cs


示例20: Query

        private List<Result> Query(Query query, ITokenSource cancelToken)
        {
            if (query.KeywordComplete && query.HasArguments) {
                // check the cache for a matching result
                var cacheKey = query.Arguments;
                var cachedSuggestions = MemoryCache.Default.Get(cacheKey) as List<string>;

                // if cached result is found, return it.
                if (cachedSuggestions != null) {
                    // convert the list of suggestion strings to a List<Result>
                    if (cachedSuggestions.Any()) {
                        var results = cachedSuggestions.Select(suggestion => new Result
                        {
                            Title = suggestion,
                            Icon = _icon,
                            SubTitle = "Search google for " + suggestion,
                            Launch = query1 =>
                            {
                                Process.Start($"http://google.co.uk/search?q={suggestion}");
                                AppCommands.HideWindow();

                            }
                        }).ToList();
                        return results;
                    }
                    // no suggestions were received from the server
                    return new List<Result>
                    {
                        new Result
                        {
                            Title = "No search suggestions found.",
                            Icon = _icon
                        }
                    };
                }

                // Cache miss, begin the background query to fill the cache
                // create a local cancel token for passing to httpclient..
                var cancellable = new CancellationToken();
                cancellable.Register(() =>
                {
                    cancelToken.Cancel();
                    cancelToken.Dispose();
                });
                var x = GetSuggestionsAsync(query.Arguments, cancellable);
                return new List<Result>
                {
                    new Result
                    {
                        Title = "Retrieving search suggestions...",
                        Icon = _icon
                    }
                };
            }
            // otherwise the query has not been provided yet, running the action will autocomplete the query
            return new List<Result>
            {
                new Result
                {
                    Title = "Search Google",
                    SubTitle = "Search Google with Suggestions",
                    Icon = _icon,
                    Launch = query1 => AppCommands.RewriteQuery(Keyword + ' ')
                }
            };
        }
开发者ID:jameshy,项目名称:else,代码行数:66,代码来源:GoogleSuggest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITokenStream类代码示例发布时间:2022-05-24
下一篇:
C# IToken类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap