Before $slr->read() there is no input and therefore no parse, just a
recognizer. So $slr->ambiguous is undefined.
As for the rest, I don't have enough context to see what's going on -
I'm not sure anything is wrong. Could you give as small an example as
possible where something is happening that you think should not be
happening, describing the desired behavior?
-- jeffrey
On 09/30/2014 07:33 PM, Ron Savage wrote:
The docs for Marpa::R2::Scanless:R say, for ambiguous(), "This method
should be called after the read() method." I think that should
be somehow clarified. Consider this code (BTW the parse is ambiguous):
for
(
my $pos = $self -> recce -> read(\$string);
$pos < $length;
$pos = $self -> recce -> resume($pos)
)
{
#if ($self -> recce -> ambiguity_metric > 1)
#{
#$self -> log(notice => 'Ambiguous parse');
#}
#if ($ambiguous_status = $self -> recce -> ambiguous)
#{
#$self -> log(notice => "Parse is ambiguous: $ambiguous_status");
#}
@event = @{$self -> recce -> events};
#$self -> log(debug => 'Event count: ' . ($#event + 1) . ': ' .
join(', ', map{${$_}[0]} @event) . '.');
$event_name = ${$event[0]}[0];
($start, $span) = $self -> recce -> pause_span;
$lexeme_name = $self -> recce -> pause_lexeme;
$lexeme = $self -> recce -> literal($start, $span);
etc down to
}
read() is called, but if I uncomment either of those ifs /inside the
loop/ $self -> recce -> value returns undef.
Inside the loop, the first if prints nothing, but affects value().
Inside the loop, the 2nd prints 'No parse' each time thru the loop,
and affects value().
Now comment those both out, so the next discussion is only about calls
after the loop.
If I have the 1st if after the loop, it says:
Ambiguous parse.
If I have the 2nd if after the loop, it says:
Parse is ambiguous: Ambiguous symch at Glade=9, Symbol=<edge_statement>:
The ambiguity is from line 1, column 1 to line 1, column 2
Text is: ->
There are 2 symches
Symch 0 is a rule: edge_statement ::= edge_name attribute_definition
Symch 1 is a rule: edge_statement ::= edge_name
Parse failed. Error: value() called when recognizer is not in tree mode
The current mode is "forest"
Marpa::R2 exception at lib/MarpaX/Demo/StringParser.pm line 485.
--
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]
<mailto:[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.