Commits

Georg Brandl committed 6a48b74

RobotFramework lexer: fix two instances of "return ValueError" instead of "raise ValueError".

Comments (2)

  1. Pekka Klärck

    Wow, that was a pretty interesting bug. Assigning the returned ValueError into two variables caused a new ValueError and that masked the bug. Good catch!

Files changed (1)

pygments/lexers/_robotframeworklexer.py

     def _find_variable(self, string):
         max_end_index = string.rfind('}')
         if max_end_index == -1:
-            return ValueError('No variable end found')
+            raise ValueError('No variable end found')
         if self._is_escaped(string, max_end_index):
             return self._find_variable(string[:max_end_index])
         start_index = self._find_start_index(string, 1, max_end_index)
         if start_index == -1:
-            return ValueError('No variable start found')
+            raise ValueError('No variable start found')
         return start_index, max_end_index
 
     def _find_start_index(self, string, start, end):