functionBody function

State functionBody(
  1. String type,
  2. State state,
  3. String acceptResult,
  4. String rejectResult,
)

Implementation

State functionBody(
    String type, State state, String acceptResult, String rejectResult) {
  const template = '''
{{@state}}
''';

  final automaton = Automaton(
    accept: 'return $acceptResult;',
    reject: 'return $rejectResult;',
    template: template,
  );

  final generator = AutomatonGenerator(automaton);
  final start = generator.generate(type, state);
  return start;
}