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


C# TokenReader.Get方法代码示例

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


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

示例1: GetListValue

 private static ListMembers GetListValue(TokenReader reader)
 {
     reader.AssertGet(TokenType.Period);
     var user = reader.AssertGet(TokenType.Literal).Value;
     reader.AssertGet(TokenType.Period);
     string slug;
     var slugToken = reader.Get();
     switch (slugToken.Type)
     {
         case TokenType.String:
         case TokenType.Literal:
             slug = slugToken.Value;
             break;
         default:
             throw CreateUnexpectedTokenError(slugToken.Value, reader.RemainQuery);
     }
     return new ListMembers(user, slug);
 }
开发者ID:Mojopon,项目名称:StarryEyes,代码行数:18,代码来源:QueryCompiler.cs

示例2: CompileFilters

 /// <summary>
 ///     Instantiate expression tree from tokens.
 /// </summary>
 private static FilterExpressionRoot CompileFilters(IEnumerable<Token> token)
 {
     var reader = new TokenReader(token);
     var op = CompileL0(reader);
     if (reader.IsRemainToken)
     {
         throw CreateUnexpectedTokenError(reader.Get().ToString(), reader.RemainQuery);
     }
     return new FilterExpressionRoot { Operator = op };
 }
开发者ID:Mojopon,项目名称:StarryEyes,代码行数:13,代码来源:QueryCompiler.cs

示例3: CompileSources

 /// <summary>
 ///     Instantiate sources from tokens.
 /// </summary>
 private static IEnumerable<FilterSourceBase> CompileSources(IEnumerable<Token> token)
 {
     // filter
     // filter: "argument"
     // filter: "argument1", "argument2", ... -> filter: "argument1", filter: "argument2", ...
     var reader = new TokenReader(token);
     while (reader.IsRemainToken)
     {
         var filter = reader.Get();
         if (filter.Type != TokenType.Literal && filter.Type != TokenType.OperatorMultiple)
         {
             throw CreateUnexpectedTokenError(filter.Value, reader.RemainQuery);
         }
         Type fstype;
         if (!FilterSourceResolver.TryGetValue(filter.Value, out fstype))
         {
             throw new ArgumentException(
                 QueryCompilerResources.QueryUnknownFilterSource + " " +
                 filter.Value);
         }
         if (reader.IsRemainToken && reader.LookAhead().Type == TokenType.Collon) // with argument
         {
             reader.AssertGet(TokenType.Collon);
             do
             {
                 var argument = reader.AssertGet(TokenType.String);
                 yield return Activator.CreateInstance(fstype, argument.Value) as FilterSourceBase;
                 // separated by comma
                 if (reader.IsRemainToken)
                 {
                     reader.AssertGet(TokenType.Comma);
                 }
             } while (reader.IsRemainToken && reader.LookAhead().Type == TokenType.String);
         }
         else
         {
             yield return Activator.CreateInstance(fstype) as FilterSourceBase;
             if (reader.IsRemainToken)
             {
                 // filters are divided by comma
                 reader.AssertGet(TokenType.Comma);
             }
         }
     }
 }
开发者ID:karno,项目名称:StarryEyes,代码行数:48,代码来源:QueryCompiler.cs

示例4: CompileSources

 /// <summary>
 ///     Instantiate sources from tokens.
 /// </summary>
 private static IEnumerable<FilterSourceBase> CompileSources(IEnumerable<Token> token)
 {
     // filter
     // filter: "argument"
     // filter: "argument1", "argument2", ... -> filter: "argument1", filter: "argument2", ...
     var reader = new TokenReader(token);
     while (reader.IsRemainToken)
     {
         var filter = reader.Get();
         if (filter.Type != TokenType.Literal && filter.Type != TokenType.OperatorMultiple)
         {
             throw new ArgumentException("このトークンは無効です: " + filter.Type +
                                         " (リテラルか \'*\' です。)");
         }
         Type fstype;
         if (!FilterSourceResolver.TryGetValue(filter.Value, out fstype))
             throw new ArgumentException("フィルタ ソースが一致しません: " + filter.Value);
         if (reader.IsRemainToken && reader.LookAhead().Type == TokenType.Collon) // with argument
         {
             reader.AssertGet(TokenType.Collon);
             do
             {
                 var argument = reader.AssertGet(TokenType.String);
                 yield return Activator.CreateInstance(fstype, argument.Value) as FilterSourceBase;
                 // separated by comma
                 if (reader.IsRemainToken)
                 {
                     reader.AssertGet(TokenType.Comma);
                 }
             } while (reader.IsRemainToken && reader.LookAhead().Type == TokenType.String);
         }
         else
         {
             yield return Activator.CreateInstance(fstype) as FilterSourceBase;
             if (reader.IsRemainToken)
             {
                 // filters are divided by comma
                 reader.AssertGet(TokenType.Comma);
             }
         }
     }
 }
开发者ID:Mojopon,项目名称:StarryEyes,代码行数:45,代码来源:QueryCompiler.cs

示例5: CompileFilters

 /// <summary>
 ///     Instantiate expression tree from tokens.
 /// </summary>
 private static FilterExpressionRoot CompileFilters(IEnumerable<Token> token)
 {
     var reader = new TokenReader(token);
     var op = CompileL0(reader);
     if (reader.IsRemainToken)
         throw new FilterQueryException("不正なトークンです: " + reader.Get(), reader.RemainQuery);
     return new FilterExpressionRoot { Operator = op };
 }
开发者ID:sgfc,项目名称:StarryEyes,代码行数:11,代码来源:QueryCompiler.cs


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