def __str__(self): output = ["{"] for k, v in self.__dict__.items(): value = str(v) output.append(indent(quote(k) + ":" + value)) output.append("}") return "\n".join(output)
def match(expr, start, end, string, tokens): print("> Matched " + quote(string[start:end]) + "between " + f"[{start}, {end}] for" + " " * stack_depth() + text(expr) + " -> " + str(tokens))
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))
def _defaultExceptionDebugAction(expr, loc, string, cause): print(" Except " + quote(text(cause)))
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))
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))