Open robrix opened 9 years ago
For debugging. I wrote this one, which is pretty bad:
func log<T>(parser: Parser<T>.Function, message: String = "") -> Parser<T>.Function { return { println("parsing from \($0) \(message)") let result = parser($0) println("got \(result) \(message)") return result } }
This should actually append into a logging context which is only printed when parsing fails.
It should also indent, and print the grammar (although that’s difficult at best).
For debugging. I wrote this one, which is pretty bad:
This should actually append into a logging context which is only printed when parsing fails.
It should also indent, and print the grammar (although that’s difficult at best).