Commits

Anonymous committed 5bf3092

Extracted the ->_add_to_top_tag method.

  • Participants
  • Parent commits 2602abf

Comments (0)

Files changed (1)

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

     return shift(@{$self->_events_queue()});
 }
 
+sub _add_to_top_tag
+{
+    my ($self, $child) = @_;
+
+    $self->_tags_stack->[-1]->append_child($child);
+
+    return;
+}
+
 sub _curr_line :lvalue
 {
     my $self = shift;
             $open->detach_children(),
         );
 
-    $self->_tags_stack->[-1]->append_child( $new_elem );
+    $self->_add_to_top_tag($new_elem);
 
     $self->_in_para(0);
 
 {
     my ($self, $event) = @_;
 
-    $self->_tags_stack->[-1]->append_child( $event->{'elem'});
+    $self->_add_to_top_tag( $event->{'elem'});
 
     return;
 }
 
     if (@{$self->_tags_stack()})
     {
-        $self->_tags_stack->[-1]->append_child($new_elem);
+        $self->_add_to_top_tag($new_elem);
+
         return;
     }
     else
     {
         my $text = $self->_consume_up_to(qr{-->});
 
-        $self->_tags_stack->[-1]->append_child(
+        $self->_add_to_top_tag(
             $self->_new_node({ t => "Comment", text => $text, })
         );