Glad it worked out. The Ruby Slippers tends to be the most fun way to solve issues. :-)
Btw, I call lexemes which should never be found, "unicorns", and usually declare them like this: unicorn ~ [^\d\D] The pattern says to find a character which is not a decimal digit, but also not not a decimal digit. Clearly never gonna match. On Thu, Dec 3, 2020 at 11:34 AM Dean S <[email protected]> wrote: > > 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 > . > -- 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/CA%2B2Wrv8KZjbcvYWNHdXMLguXiX%2B42c7jsVFtJzc0xVjNUc5WVw%40mail.gmail.com.
