parse method
Consumes and returns the next event.
Implementation
Event parse() {
try {
if (isDone) throw StateError('No more events.');
var event = _stateMachine();
return event;
} on StringScannerException catch (error) {
throw YamlException(error.message, error.span);
}
}