Commits

Anonymous committed 641d609

Extracted the _new_list method.

  • Participants
  • Parent commits e51c3de

Comments (0)

Files changed (1)

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

         );
 }
 
+sub _new_list
+{
+    my $self = shift;
+    my $contents = shift;
+
+    return _new_node(
+        {
+            t => "List",
+            contents => $contents,
+        }
+    );
+}
+
 sub _parse_opening_tag
 {
     my $self = shift;
          character => $sayer,
          para => XML::Grammar::Fiction::FromProto::Node::Paragraph->new(
             children =>
-            XML::Grammar::Fiction::FromProto::Node::List->new(
-                contents => $what,
-                )
+            $self->_new_list($what),
             ),
     };
 }
     return
         XML::Grammar::Fiction::FromProto::Node::Paragraph->new(
             children =>
-            XML::Grammar::Fiction::FromProto::Node::List->new(
-                contents => $what,
-                )
+            $self->_new_list($what),
         );
 }
 
         XML::Grammar::Fiction::FromProto::Node::Saying->new(
             character => $first->{character},
             children => 
-                XML::Grammar::Fiction::FromProto::Node::List->new(
-                    contents => [ $first->{para}, @others ],
-                ),
+                $self->_new_list([ $first->{para}, @others ]),
         );
 }
 
 
     return XML::Grammar::Fiction::FromProto::Node::Description->new(
         children => 
-            XML::Grammar::Fiction::FromProto::Node::List->new(
-                contents =>
+        $self->_new_list(
             [
-            map { 
-            XML::Grammar::Fiction::FromProto::Node::Paragraph->new(
-                children =>
-                    XML::Grammar::Fiction::FromProto::Node::List->new(
-                        contents => $_,
-                        ),
-                    )
-            } @paragraphs
+                map { 
+                XML::Grammar::Fiction::FromProto::Node::Paragraph->new(
+                children => $self->_new_list($_),
+                )
+                } @paragraphs
             ],
-        ),
+        )
     );
 }