Esempio n. 1
0
 public virtual ATN GetATNWithBypassAlts()
 {
     string serializedAtn = SerializedAtn;
     if (serializedAtn == null)
     {
         throw new NotSupportedException("The current parser does not support an ATN with bypass alternatives.");
     }
     lock (bypassAltsAtnCache)
     {
         ATN result = bypassAltsAtnCache.Get(serializedAtn);
         if (result == null)
         {
             ATNDeserializationOptions deserializationOptions = new ATNDeserializationOptions();
             deserializationOptions.SetGenerateRuleBypassTransitions(true);
             result = new ATNDeserializer(deserializationOptions).Deserialize(serializedAtn.ToCharArray());
             bypassAltsAtnCache.Put(serializedAtn, result);
         }
         return result;
     }
 }
Esempio n. 2
0
        public virtual ATN GetATNWithBypassAlts()
        {
            int[] serializedAtn = SerializedAtn;

            if (serializedAtn == null)
            {
                throw new NotSupportedException("The current parser does not support an ATN with bypass alternatives.");
            }
            lock (this)
            {
                if (bypassAltsAtnCache != null)
                {
                    return(bypassAltsAtnCache);
                }
                ATNDeserializationOptions deserializationOptions = new ATNDeserializationOptions();
                deserializationOptions.GenerateRuleBypassTransitions = true;
                bypassAltsAtnCache = new ATNDeserializer(deserializationOptions).Deserialize(serializedAtn);
                return(bypassAltsAtnCache);
            }
        }