Commits

Anonymous committed 243a9fd

Convert to a hash lookup.

Comments (0)

Files changed (1)

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

 # Whether we are inside a paragraph or not.
 has "_in_para" => (isa => "Bool", is => "rw", default => 0,);
 
+has '_tag_names_to_be_handled' =>
+(
+    is => 'ro',
+    isa => 'HashRef[Bool]',
+    lazy => 1,
+    builder => '_build_tag_names_to_be_handled',
+);
+
+sub _build_tag_names_to_be_handled
+{
+    my $self = shift;
+
+    return { map { $_ => 1 } @{$self->_list_valid_tag_events} };
+}
+
 sub _get_id_regex
 {
     return qr{[a-zA-Z_\-]+};
 {
     my ($self, $event) = @_;
 
-    foreach my $tag_name (@{$self->_list_valid_tag_events()})
+    if ($event->tag && exists($self->_tag_names_to_be_handled->{$event->tag}))
     {
-        if ($event->is_tag_of_name($tag_name))
-        {
-            return $self->_handle_specific_tag_event($event);
-        }
+        return $self->_handle_specific_tag_event($event);
     }
-
-    return;
+    else
+    {
+        return;
+    }
 }
 
 sub _handle_para_event
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.