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

C# PredictionContext类代码示例

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

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



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

示例1: Create

 public static Antlr4.Runtime.Atn.ATNConfig Create(ATNState state, int alt, PredictionContext context, Antlr4.Runtime.Atn.SemanticContext semanticContext, LexerActionExecutor lexerActionExecutor)
 {
     if (semanticContext != Antlr4.Runtime.Atn.SemanticContext.None)
     {
         if (lexerActionExecutor != null)
         {
             return new ATNConfig.ActionSemanticContextATNConfig(lexerActionExecutor, semanticContext, state, alt, context, false);
         }
         else
         {
             return new ATNConfig.SemanticContextATNConfig(semanticContext, state, alt, context);
         }
     }
     else
     {
         if (lexerActionExecutor != null)
         {
             return new ATNConfig.ActionATNConfig(lexerActionExecutor, state, alt, context, false);
         }
         else
         {
             return new Antlr4.Runtime.Atn.ATNConfig(state, alt, context);
         }
     }
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:25,代码来源:ATNConfig.cs


示例2: SingletonPredictionContext

 internal SingletonPredictionContext(PredictionContext parent, int returnState)
     : base(CalculateHashCode(parent, returnState))
 {
     System.Diagnostics.Debug.Assert(returnState != EmptyFullStateKey && returnState != EmptyLocalStateKey);
     this.parent = parent;
     this.returnState = returnState;
 }
开发者ID:RainerBosch,项目名称:antlr4,代码行数:7,代码来源:SingletonPredictionContext.cs


示例3: ATNConfig

 protected internal ATNConfig(ATNState state, int alt, PredictionContext context)
 {
     System.Diagnostics.Debug.Assert((alt & unchecked((int)(0xFFFFFF))) == alt);
     this.state = state;
     this.altAndOuterContextDepth = alt & unchecked((int)(0x7FFFFFFF));
     this.context = context;
 }
开发者ID:nickdurcholz,项目名称:antlr4cs,代码行数:7,代码来源:ATNConfig.cs


示例4: ArrayPredictionContext

 internal ArrayPredictionContext(PredictionContext[] parents, int[] returnStates, int hashCode)
     : base(hashCode)
 {
     System.Diagnostics.Debug.Assert(parents.Length == returnStates.Length);
     System.Diagnostics.Debug.Assert(returnStates.Length > 1 || returnStates[0] != EmptyFullStateKey, "Should be using PredictionContext.EMPTY instead.");
     this.parents = parents;
     this.returnStates = returnStates;
 }
开发者ID:RainerBosch,项目名称:antlr4,代码行数:8,代码来源:ArrayPredictionContext.cs


示例5: ATNConfig

 protected internal ATNConfig(Antlr4.Runtime.Atn.ATNConfig c, ATNState state, PredictionContext
      context)
 {
     this.state = state;
     this.altAndOuterContextDepth = c.altAndOuterContextDepth & unchecked((int)(0x7FFFFFFF
         ));
     this.context = context;
 }
开发者ID:pabloescribano,项目名称:antlr4cs,代码行数:8,代码来源:ATNConfig.cs


示例6: Create

		public static PredictionContext Create(PredictionContext parent, int returnState)
		{
			if (returnState == EMPTY_RETURN_STATE && parent == null)
			{
				// someone can pass in the bits of an array ctx that mean $
				return PredictionContext.EMPTY;
			}
			return new SingletonPredictionContext(parent, returnState);
		}
开发者ID:antlr,项目名称:antlr4,代码行数:9,代码来源:SingletonPredictionContext.cs


示例7: Put

 public void Put(PredictionContext a, PredictionContext b, PredictionContext value)
 {
     Dictionary<PredictionContext, PredictionContext> first;
     if (!data.TryGetValue(a, out first))
     {
         first = new Dictionary<PredictionContext, PredictionContext>();
         data[a] = first;
     }
     first[b] = value;
 }
开发者ID:antlr,项目名称:antlr4,代码行数:10,代码来源:MergeCache.cs


示例8: Get

 public PredictionContext Get(PredictionContext a, PredictionContext b)
 {
     Dictionary<PredictionContext, PredictionContext> first;
     if (!data.TryGetValue(a, out first))
         return null;
     PredictionContext value;
     if (first.TryGetValue(b, out value))
         return value;
     else
         return null;
 }
开发者ID:antlr,项目名称:antlr4,代码行数:11,代码来源:MergeCache.cs


示例9: Add

 /** Add a context to the cache and return it. If the context already exists,
  *  return that one instead and do not add a new context to the cache.
  *  Protect shared cache from unsafe thread access.
  */
 public PredictionContext Add(PredictionContext ctx)
 {
     if (ctx == PredictionContext.EMPTY)
         return PredictionContext.EMPTY;
     PredictionContext existing = cache.Get(ctx);
     if (existing != null)
     {
         return existing;
     }
     cache.Put(ctx, ctx);
     return ctx;
 }
开发者ID:antlr,项目名称:antlr4,代码行数:16,代码来源:PredictionContextCache.cs


示例10: getCachedContext

        public PredictionContext getCachedContext(PredictionContext context)
        {
            if (sharedContextCache == null) return context;

            lock (sharedContextCache)
            {
                PredictionContext.IdentityHashMap visited =
                    new PredictionContext.IdentityHashMap();
                return PredictionContext.GetCachedContext(context,
                                                          sharedContextCache,
                                                          visited);
            }
        }
开发者ID:antlr,项目名称:antlr4,代码行数:13,代码来源:ATNSimulator.cs


示例11: GetAsCached

 public virtual PredictionContext GetAsCached(PredictionContext context)
 {
     if (!enableCache)
     {
         return context;
     }
     PredictionContext result;
     if (!contexts.TryGetValue(context, out result))
     {
         result = context;
         contexts[context] = context;
     }
     return result;
 }
开发者ID:RainerBosch,项目名称:antlr4,代码行数:14,代码来源:PredictionContextCache.cs


示例12: GetChild

 public virtual PredictionContext GetChild(PredictionContext context, int invokingState)
 {
     if (!enableCache)
     {
         return context.GetChild(invokingState);
     }
     PredictionContextCache.PredictionContextAndInt operands = new PredictionContextCache.PredictionContextAndInt(context, invokingState);
     PredictionContext result;
     if (!childContexts.TryGetValue(operands, out result))
     {
         result = context.GetChild(invokingState);
         result = GetAsCached(result);
         childContexts[operands] = result;
     }
     return result;
 }
开发者ID:RainerBosch,项目名称:antlr4,代码行数:16,代码来源:PredictionContextCache.cs


示例13: Join

 public virtual PredictionContext Join(PredictionContext x, PredictionContext y)
 {
     if (!enableCache)
     {
         return PredictionContext.Join(x, y, this);
     }
     PredictionContextCache.IdentityCommutativePredictionContextOperands operands = new PredictionContextCache.IdentityCommutativePredictionContextOperands(x, y);
     PredictionContext result;
     if (joinContexts.TryGetValue(operands, out result))
     {
         return result;
     }
     result = PredictionContext.Join(x, y, this);
     result = GetAsCached(result);
     joinContexts[operands] = result;
     return result;
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:17,代码来源:PredictionContextCache.cs


示例14: Look

 public virtual IntervalSet Look(ATNState s, PredictionContext ctx)
 {
     return Look(s, null, ctx);
 }
开发者ID:hustsii,项目名称:antlr4cs,代码行数:4,代码来源:LL1Analyzer.cs


示例15: AppendContext

 public override PredictionContext AppendContext(PredictionContext suffix, PredictionContextCache
      contextCache)
 {
     return suffix;
 }
开发者ID:hustsii,项目名称:antlr4cs,代码行数:5,代码来源:EmptyPredictionContext.cs


示例16: ActionATNConfig

 protected internal ActionATNConfig(LexerActionExecutor lexerActionExecutor, ATNConfig c, ATNState state, PredictionContext context, bool passedThroughNonGreedyDecision)
     : base(c, state, context)
 {
     if (c.SemanticContext != SemanticContext.None)
     {
         throw new NotSupportedException();
     }
     this.lexerActionExecutor = lexerActionExecutor;
     this.passedThroughNonGreedyDecision = passedThroughNonGreedyDecision;
 }
开发者ID:EvgeniyKo,项目名称:antlr4cs,代码行数:10,代码来源:ATNConfig.cs


示例17: ActionSemanticContextATNConfig

 public ActionSemanticContextATNConfig(LexerActionExecutor lexerActionExecutor, SemanticContext semanticContext, ATNConfig c, ATNState state, PredictionContext context, bool passedThroughNonGreedyDecision)
     : base(semanticContext, c, state, context)
 {
     this.lexerActionExecutor = lexerActionExecutor;
     this.passedThroughNonGreedyDecision = passedThroughNonGreedyDecision;
 }
开发者ID:EvgeniyKo,项目名称:antlr4cs,代码行数:6,代码来源:ATNConfig.cs


示例18: Look

 public virtual IntervalSet Look(ATNState s, PredictionContext ctx)
 {
     return Look(s, s.atn.ruleToStopState[s.ruleIndex], ctx);
 }
开发者ID:rharrisxtheta,项目名称:antlr4cs,代码行数:4,代码来源:LL1Analyzer.cs


示例19: AppendContext

 public override PredictionContext AppendContext(PredictionContext suffix, PredictionContextCache contextCache)
 {
     return AppendContext(this, suffix, new PredictionContext.IdentityHashMap());
 }
开发者ID:sharwell,项目名称:antlr4cs,代码行数:4,代码来源:ArrayPredictionContext.cs


示例20: AddEmptyContext

 protected internal override PredictionContext AddEmptyContext()
 {
     PredictionContext[] parents = new PredictionContext[] { parent, EmptyFull };
     int[] returnStates = new int[] { returnState, EmptyFullStateKey };
     return new ArrayPredictionContext(parents, returnStates);
 }
开发者ID:hustsii,项目名称:antlr4cs,代码行数:6,代码来源:SingletonPredictionContext.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# PredictionInput类代码示例发布时间:2022-05-24
下一篇:
C# PredicateExpression类代码示例发布时间: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