That is looking like it will work great. I set "variable ~ '\0\0\0\0'" so that
it will never match but can be an expected terminal. Then, on a rejection
event, feed a variable if I can find one.
my $recce = Marpa::R2::Scanless::R->new({ grammar => $grammar, rejection =>
'event' });
for ( $recce->read(\$input); $recce->pos < length $input; $recce->resume ) {
if (grep 'variable' eq $_, @{ $recce->terminals_expected }) {
pos($input) = $recce->pos;
if ($input =~ /\G(\w+)/) {
$recce->lexeme_read('variable', $recce->pos, length($1), $1);
} else {
PARSE_ERROR($input, $recce->pos, $recce->terminals_expected);
}
} else {
say $recce->show_progress;
PARSE_ERROR($input, $recce->pos, $recce->terminals_expected);
}
}
Thanks!
- Dean
On 12/2/20 7:32 PM, Jeffrey Kegler wrote:
> One technique that is documented and tested and I believe should work is the
> Ruby Slippers. See the docs on this, but the basic idea would be, in the
> default lexer look only for commands. If the parse stops for lack of a
> lexeme, give it an LHS, and resume the parse. Otherwise, or if it also
> rejects LHS token, pass the failure on to the user.
>
--
You received this message because you are subscribed to the Google Groups
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/marpa-parser/c9c3d95a-e6ab-b41c-c514-26a6121b0d88%40gmail.com.