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


C# PredictionContext类代码示例

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


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


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