1. Shlomi Fish
  2. Fiction-XML

Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 7425577

Extracted _parse_opening_tag_attrs .

  • Participants
  • Parent commits fda90b1
  • Branches default

Comments (0)

Files changed (1)

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

View file
     );
 }
 
+sub _parse_opening_tag_attrs
+{
+    my $self = shift;
+
+    my $l = $self->_curr_line_ref();
+
+    my @attrs;
+
+    while (my ($name, $val) = $$l =~ m{\G\s*($id_regex)="([^"]+)"\s*}cg)
+    {
+        push @attrs, { 'key' => $name, 'value' => $val, };
+    }
+
+    return \@attrs;
+}
+
 sub _parse_opening_tag
 {
     my $self = shift;
     }
     my $id = $1;
 
-    my @attrs;
-
-    while ($$l =~ m{\G\s*($id_regex)="([^"]+)"\s*}cg)
-    {
-        push @attrs, { 'key' => $1, 'value' => $2, };
-    }
+    my $attrs = $self->_parse_opening_tag_attrs();
 
     my $is_standalone = 0;
     if ($$l =~ m{\G\s*/\s*>}cg)
         name => $id,
         is_standalone => $is_standalone,
         line => $self->_get_line_num(),
-        attrs => \@attrs,
+        attrs => $attrs,
     );
 }