Commits

Anonymous committed f015d79

Extract the _main_loop_iter into XmlIterator.

We defined another function - _main_loop_iter_body with the specialised logic.

  • Participants
  • Parent commits 2f0bceb

Comments (0)

Files changed (3)

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

     return ($is_tag_cond, $is_close);
 }
 
-sub _main_loop_iter
+sub _main_loop_iter_body
 {
     my $self = shift;
 
-    if ($self->_look_ahead_for_comment())
-    {
-        return;
-    }
-
     $self->skip_space();
 
     $self->_ret_tag(scalar($self->_look_for_and_handle_tag()));

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

     return $self->_flush_ret_tag();
 }
 
+sub _main_loop_iter
+{
+    my $self = shift;
+
+    # This is an assert.
+    if (!defined(${$self->curr_line_ref()}) && (! @{$self->_events_queue()}))
+    {
+        Carp::confess (qq{Reached EOF.});
+    }
+    
+    if ($self->_look_ahead_for_comment())
+    {
+        return;
+    }
+
+    return $self->_main_loop_iter_body();
+}
+
 =head1 NAME
 
 XML::Grammar::Fiction::FromProto::Parser::XmlIterator - line iterator base

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

     return ($is_tag_cond, $is_close);
 }
 
-sub _main_loop_iter
+sub _main_loop_iter_body
 {
     my $self = shift;
 
-    # This is an assert.
-    if (!defined(${$self->curr_line_ref()}) && (! @{$self->_events_queue()}))
-    {
-        Carp::confess (qq{Reached EOF.});
-    }
-    
-    if ($self->_look_ahead_for_comment())
-    {
-        return;
-    }
-
     my ($l, $p) = $self->curr_line_and_pos();
 
     if ($$l eq "\n")