In sending you the link, I noticed the documentation is insufficient, and fixed that. It may take a while to make its way into a release, but here it is on Github <https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/pod/Semantics.pod#bailing-out-of-parse-evaluation>. The "bail out" is what it sounds like, it occurs right in the middle of one of your actions, and as soon as you call it, the parse is over -- it's totally destructive.
Your other suggestions are possible, but require some advanced trickery, so this may be something you wish to come back to later in your researches. On Tue, Dec 30, 2014 at 5:13 PM, Zeev Atlas <[email protected]> wrote: > The "bail out" method seems to be of interest, but it is scarcely > documented. Is there any better documentation. When is it issued? Could > the parsing continue after that method from a different point? I have no > problem to program it as elaborately as needed, but I have no idea what > could it do besides of spitting a message. > > Thank you > ZA > > On Tuesday, December 30, 2014 4:35:29 PM UTC-5, Jeffrey Kegler wrote: >> >> Off the top of my head, and not 100% sure it's helpful in your context, >> but here goes: >> >> A technique I'd like to see used more is "error rules" -- rules which >> represent things which should *not* appear in the parse. These have not >> been used much because traditional parsers have trouble enough parsing a >> full set of correct rules, so that any technique that involves more rules >> is very problematic. >> >> Marpa::R2 has a special "bail out" static method >> <https://metacpan.org/pod/Marpa::R2::Semantics#Bailing-out-of-parse-evaluation>, >> which can be used in the semantic action of an error rules. >> >> On Tue, Dec 30, 2014 at 1:06 PM, Zeev Atlas <[email protected]> wrote: >> >>> Is there a way to tell Marpa to ignore a certain, obviously wrong, >>> element in the input. >>> >>> Case in mind a language that by at large adhere with the BNF, but a >>> vendor added some extensions without publishing the proper BNF and I would >>> like to postpone doing that task for various reasons. >>> >>> Example: SQL Server variety of SQL 2003, keyword TOP: >>> >>> SELECT TOP 5 column1, column2 FROM table1; >>> >>> This is a valid SQL 2003 SELECT statement except of the 'TOP 5' >>> >>> What I have in mind is something like this >>> >>> my $grammar = Marpa::R2::Scanless::G->new( { source => \$dsl, Handlers >>> => {UNKNOWNTOKEN => \&handle_unknowntoken}}); >>> >>> Now handle_unknowntoken could potentially see the rest of the input from >>> the point where the unknown token was found, report it, make it into spaces >>> and return to the module with a code that say, continue anyway with what >>> you see, or die the way the module is doing now. >>> >>> I do not know whether this option is available in any shape or whether >>> it is at all feasible. >>> >>> Thanks >>> ZA >>> >>> >>> -- >>> 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]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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]. > For more options, visit https://groups.google.com/d/optout. > -- 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]. For more options, visit https://groups.google.com/d/optout.
