Commits

Anonymous committed ed85564

Extract the method _top_is from three places.

Comments (0)

Files changed (1)

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Screenplay/FromProto/Parser/QnD.pm

 {
     my $self = shift;
 
-    return $self->_in_para() && ($self->_top_tag->name() eq "p");
+    return $self->_in_para() && ($self->_top_is('p'));
 }
 
 
 {
     my $self = shift;
 
-    return $self->_in_saying() && ($self->_top_tag->name() eq "saying");
+    return $self->_in_saying() && ($self->_top_is('saying'));
+}
+
+sub _top_is
+{
+    my ($self, $want_name) = @_;
+
+    return ($self->_top_tag->name eq $want_name);
 }
 
 sub _top_is_desc
 {
     my $self = shift;
 
-    return ($self->_top_tag->name() eq "desc");
+    return $self->_top_is('desc');
 }
 
 around '_pop_tag' => sub {