toNfa method

  1. @override
Nfa toNfa()
override

Compiles this AST node into a nondeterministic finite automaton (Nfa).

Implementation

@override
Nfa toNfa() {
  final start = NfaState(isEnd: false);
  final end = NfaState(isEnd: true);
  for (var i = startCodePoint; i <= endCodePoint; i++) {
    start.transitions[i] = end;
  }
  return Nfa(start: start, end: end);
}