New $slr->g1_location_to_span() method

5 views
Skip to first unread message

Jeffrey Kegler

unread,
May 17, 2013, 12:46:38 PM5/17/13
to Marpa Parser Mailing LIst
Jean-Damien requested a $slr->g1_location_to_span() method.  It's in commit d1332c18d6f8aac4c9b33be945bea41d071a866c, and is even tested a bit. :-)  It is simple:
sub Marpa::R2::Scanless::R::g1_location_to_span {
    my ( $self, $g1_location ) = @_;
    my $thin_self = $self->[Marpa::R2::Inner::Scanless::R::C];
    return $thin_self->span( $g1_location );
}
It returns an *array* of two values: ($start, $length).  In situations where you think of input stream location as a single number, you'll usually conceptualize it as the end of this span: $start+$length.  G1 location 0 (Earley set 0) is a special case: it returns (0,0).\

-- jeffrey



Durand Jean-Damien

unread,
May 17, 2013, 1:02:58 PM5/17/13
to marpa-...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages