Anonymous avatar Anonymous committed adccb0c

Refactoring: removed a call to _with_curr_line_ref().

Comments (0)

Files changed (1)

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

 {
     my $self = shift;
 
-    # Now Lisp got nothing on us.
-    return $self->_with_curr_line(
-        sub {
-            # $l is a reference to the string of the current
-            # line
-            my $l = shift;
+    # $l is a reference to the string of the current line
 
-            my $p = pos($$l);
-            if ($$l !~ m{\G<($id_regex)}cg)
-            {
-                print "Before : " . substr($$l, 0, $p) . "\n";
-                Carp::confess("Cannot match opening tag at line " . $self->_get_line_num());
-            }
-            my $id = $1;
+    my $l = $self->_curr_line_ref();
+    my $p = pos($$l);
 
-            my @attrs;
+    if ($$l !~ m{\G<($id_regex)}cg)
+    {
+        print "Before : " . substr($$l, 0, $p) . "\n";
+        Carp::confess("Cannot match opening tag at line " . $self->_get_line_num());
+    }
+    my $id = $1;
 
-            while ($$l =~ m{\G\s*($id_regex)="([^"]+)"\s*}cg)
-            {
-                push @attrs, { 'key' => $1, 'value' => $2, };
-            }
+    my @attrs;
 
-            my $is_standalone = 0;
-            if ($$l =~ m{\G\s*/\s*>}cg)
-            {
-                $is_standalone = 1;
-            }
-            elsif ($$l !~ m{\G>}g)
-            {
-                Carp::confess (
-                    "Cannot match the \">\" of the opening tag at line " 
-                        . $self->_get_line_num()
-                );
-            }
-            
-            return
-            {
-                name => $id,
-                is_standalone => $is_standalone,
-                line => $self->_get_line_num(),
-                attrs => \@attrs,
-            };
-        }
-    );
+    while ($$l =~ m{\G\s*($id_regex)="([^"]+)"\s*}cg)
+    {
+        push @attrs, { 'key' => $1, 'value' => $2, };
+    }
+
+    my $is_standalone = 0;
+    if ($$l =~ m{\G\s*/\s*>}cg)
+    {
+        $is_standalone = 1;
+    }
+    elsif ($$l !~ m{\G>}g)
+    {
+        Carp::confess (
+            "Cannot match the \">\" of the opening tag at line " 
+                . $self->_get_line_num()
+        );
+    }
+    
+    return
+    {
+        name => $id,
+        is_standalone => $is_standalone,
+        line => $self->_get_line_num(),
+        attrs => \@attrs,
+    };
 }
 
 sub _get_line_num
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.