ATNWithBypassAlts property

ATN ATNWithBypassAlts

The ATN with bypass alternatives is expensive to create so we create it lazily.

@throws UnsupportedOperationException if the current parser does not implement the {@link #getSerializedATN()} method.

Implementation

ATN get ATNWithBypassAlts {
  if (serializedATN == null) {
    throw UnsupportedError(
        'The current parser does not support an ATN with bypass alternatives.');
  }

  if (bypassAltsAtnCache == null) {
    final deserializationOptions = ATNDeserializationOptions(false);
    deserializationOptions.setGenerateRuleBypassTransitions(true);
    bypassAltsAtnCache = ATNDeserializer(deserializationOptions).deserialize(serializedATN);
  }

  return bypassAltsAtnCache!;
}