Commits

Anonymous committed 3c21096

minor cleanups

Comments (0)

Files changed (1)

pymeta/runtime.py

         if other.__class__ == self.__class__:
             return (self.position, self.error) == (other.position, other.error)
 
-
     def formatReason(self):
         if self.error is None:
             return ''
         """
         lines = input.split('\n')
         counter = 0
-        lineNo = 1
-        columnNo = 0
+        line_number = 1
+        column = 0
         for line in lines:
-            newCounter = counter + len(line)
-            if newCounter > self.position:
-                columnNo = self.position - counter
+            new_counter = counter + len(line)
+            if new_counter > self.position:
+                column = self.position - counter
                 break
             else:
                 counter += len(line) + 1
-                lineNo += 1
+                line_number += 1
         reason = self.formatReason()
-        return ('\n' + line + '\n' + (' ' * columnNo + '^') +
-                "\nParse error at line %s, column %s: %s\n" % (lineNo,
-                                                               columnNo,
+        return ('\n' + line + '\n' + (' ' * column + '^') +
+                "\nParse error at line %s, column %s: %s\n" % (line_number,
+                                                               column,
                                                                reason))
 
 class EOFError(ParseError):
         self.currentError = self.input.nullError()
 
     def considerError(self, error):
-        if error and  error[0] > self.currentError[0]:
+        if error and error[1] and error[0] > self.currentError[0]:
             self.currentError = error
 
-
     def superApply(self, ruleName, *args):
         """
         Apply the named rule as defined on this object's superclass.
         if r is not None:
             val, err = self._apply(r, ruleName, args)
             return val, ParseError(*err)
-
         else:
             raise NameError("No rule named '%s'" %(ruleName,))
     rule_apply = apply
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.