Re: Finding where a rule matches input stream

2018-08-06 Thread Durand Jean-Damien
Your CodeProcess::do_macro_match is still wrong, please read https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless/R.pod#g1_location_to_span() . "Mike's" workaround is quite correct, you have to "merge" the G1 start and end locations. Clearer code in attachment. Le samedi 4 août 2018

Re: Finding where a rule matches input stream

2018-08-06 Thread Jeffrey Kegler
The interface here is a series of layers that grew over the history of R2 -- there never really was any design so conventions change between each call. In other words, it's a mess. The emphasis in R2 is on backward compatibility so, alas, it won't improve. In R3 I redesigned G1 locations and

Re: Finding where a rule matches input stream

2018-08-04 Thread Michael Spertus
Hi Jeffrey, While that works for the simple example, it seems to fail for slightly more complex examples (Now I don''t feel bad about having had trouble with this to begin with!) The attached a program that demonstrates the problem and the (surprisingly messy) fix as shown by the following

Re: Finding where a rule matches input stream

2018-08-03 Thread Jeffrey Kegler
In the attached, I corrected the script, and added detailed comments about what is going on. Hope this helps! -- jeffrey On Fri, Aug 3, 2018 at 10:41 AM, Michael Spertus wrote: > Hi Jeffrey, > Unless I'm misreading what you are suggesting, that seems to give me the > same failure as in the

Re: Finding where a rule matches input stream

2018-08-03 Thread Michael Spertus
Hi Jeffrey, Unless I'm misreading what you are suggesting, that seems to give me the same failure as in the original post as in the code below. use Marpa::R2; > > my $dsl = <<'END_OF_DSL'; > :default ::= action => [name,values] > lexeme default = latm => 1 > > :start ::= matches > > matches ::=