What I want, I think, is for the parser, having recognized one occurrence of job_statement, to at that point <commit> to it.
So, <commit> after each successfully parsed job_statement. Then offer an alternative that slurps up the rest of the file, as a dummy, to make the grammar match in the end.
I don't know Parse::RecDescent enough to express what I mean in code, so I'll try in Perl 6 rules, maybe that's sufficiently readable for you to translate it to your needs:
grammar Jobs {
token TOP { ^ '$JOBS' <job_def> $ }
role job_def {
[
<single_job_definiton> <commit>
|| .* # if there is no way to parse
# a job definition, dummy-parse
# the rest of the string to prevent
# outright failure
]+
}
}
Perl 6 - links to (nearly) everything that is Perl 6.