skipMany1 function

State skipMany1(
  1. State state
)

Creates State that source generates code which will perform state computations until the next state computation fails.

This operation will completes successfully if at least the first state computation will complete successfully.

Implementation

State skipMany1(State state) {
  const template = '''
var {{tmp}} = false;
while (true) {
  {{@state}}
}
if ({{tmp}}) {
  {{@accept}}
}
{{@reject}}
''';
  const automaton = Automaton(
    accept: '{{tmp}} = true;\ncontinue;',
    reject: 'break;',
    result: 'null',
    template: template,
  );
  const generator = AutomatonGenerator(automaton);
  final start = generator.generate('void', state);
  return start;
}