toNfa method

  1. @override
Nfa toNfa()
override

Implementation

@override
Nfa toNfa() {
  final start = NfaState(isEnd: false);
  final end = NfaState(isEnd: true);

  final leftNfa = left.toNfa();
  start.epsilons.add(leftNfa.start);
  leftNfa.end.epsilons.add(end);
  leftNfa.end.isEnd = false;

  final rightNfa = right.toNfa();
  start.epsilons.add(rightNfa.start);
  rightNfa.end.epsilons.add(end);
  rightNfa.end.isEnd = false;

  return Nfa(start: start, end: end);
}