getConflictingAlts method

BitSet getConflictingAlts(
  1. BitSet? reportedAlts,
  2. ATNConfigSet configs
)

Computes the set of conflicting or ambiguous alternatives from a configuration set, if that information was not already provided by the parser.

@param reportedAlts The set of conflicting or ambiguous alternatives, as reported by the parser. @param configs The conflicting or ambiguous configuration set. @return Returns reportedAlts if it is not null, otherwise returns the set of alternatives represented in configs.

Implementation

BitSet getConflictingAlts(BitSet? reportedAlts, ATNConfigSet configs) {
  if (reportedAlts != null) {
    return reportedAlts;
  }

  final result = BitSet();
  for (var config in configs) {
    result.set(config.alt);
  }

  return result;
}