Commits

Anonymous committed 6ca6e05

Extract the _handle_non_tag_text() method.

Comments (0)

Files changed (1)

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

     return;
 }
 
+sub _handle_non_tag_text
+{
+    my $self = shift;
+
+    if (! @{$self->_tags_stack()} )
+    {
+        XML::Grammar::Fiction::Err::Parse::CannotMatchOpeningTag->throw(
+            error => "Cannot match opening tag.",
+            'line' => $self->_get_line_num(),
+        );
+    }
+
+    my $contents = $self->_parse_text();
+
+    foreach my $event (@$contents)
+    {
+        $self->_handle_event($event);
+    }
+
+    return;
+}
+
 sub _parse_tags
 {
     my $self = shift;
         }
         else
         {
-            if (! @{$self->_tags_stack()} )
-            {
-                XML::Grammar::Fiction::Err::Parse::CannotMatchOpeningTag->throw(
-                    error => "Cannot match opening tag.",
-                    'line' => $self->_get_line_num(),
-                );
-            }
-            
-            my $contents = $self->_parse_text();
-
-            foreach my $event (@$contents)
-            {
-                $self->_handle_event($event);
-            }
+            $self->_handle_non_tag_text();
         }
     }