Catch unmatched "[" in selector parser with a helpful error
[catagits/HTML-Zoom.git] / lib / HTML / Zoom / SelectorParser.pm
index d3a505a..9bc7bc3 100644 (file)
@@ -99,7 +99,12 @@ sub _raw_parse_simple_selector {
         sub {
           exists $_[0]->{attrs}{$attribute};
         }
-      }
+    };
+    
+    # none of the above matched, try catching some obvious errors:
+
+    # indicate unmatched square bracket:
+    /\G\[[^\]]*/gc and $_[0]->_blam('Unmatched [');
   }
 }