Ejemplo n.º 1
0
 def __getattr__(self, aname):
     """supported attributes by name are:
     - lineno - returns the line number of the exception text
     - col - returns the column number of the exception text
     - line - returns the line containing the exception text
     """
     if aname == "lineno":
         return lineno(self.loc, self.pstr)
     elif aname in ("col", "column"):
         return col(self.loc, self.pstr)
     elif aname == "line":
         return line(self.loc, self.pstr)
     else:
         raise AttributeError(aname)
Ejemplo n.º 2
0
def _try(expr, start, string):
    print("  Attempt " + quote(string, start) + " at loc " + text(start) +
          "(%d,%d)" % (lineno(start, string), col(start, string)) + " for " +
          " " * stack_depth() + text(expr))
Ejemplo n.º 3
0
def _defaultSuccessDebugAction(expr, start, end, string, tokens):
    print("> Matched " + quote(string[start:end]) + " at loc " + text(start) +
          "(%d,%d)" % (lineno(start, string), col(start, string)) + " for " +
          " " * stack_depth() + text(expr) + " -> " + str(tokens))
Ejemplo n.º 4
0
def _defaultStartDebugAction(expr, loc, string):
    print("  Attempt " + quote(string[loc:loc + 10] + "...") + " at loc " +
          text(loc) + "(%d,%d)" % (lineno(loc, string), col(loc, string)) +
          " for " + " " * stack_depth() + text(expr))
Ejemplo n.º 5
0
 def lineno(self):
     return lineno(self.loc, self.string)