Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging combinator #45

Open
robrix opened this issue Dec 18, 2014 · 0 comments
Open

Logging combinator #45

robrix opened this issue Dec 18, 2014 · 0 comments
Milestone

Comments

@robrix
Copy link
Owner

robrix commented Dec 18, 2014

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).

@robrix robrix added this to the 1.0 milestone Dec 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant