Closed pbrisbin closed 8 years ago
For another project, I bridge the combinators and parsers with code that resembles:
parsed :: Parsec [Token] () c -> Text -> Either String c
parsed p = tokenize >=> bimap show id . runParser (p <* eof) () "<testcase>"
Not sure the bimap is strictly required, just made writing testcases easier i think.
Pushed some WIP commits. Probably won't get back to this until later in the week. Thanks for the quick comments.
@clord I think this is at a good weigh-point to get some review and possibly merge before continuing. Note: I left some debt in the form of -fno-warn
pragmas in the interest of not muddying the diff. As we get further along, I'll address them the Right Way.
Currently this passes 50 of the decoder test cases. And the 28 failures are all at the tokenizing step, so addressing them will be a slight change of gears, which is why I think this is a good merge point.
This implementation only goes far enough to test the bool decoder case out of toml-test, but that case does pass.
The code base seemed oriented to a separate tokenization and parsing phase, but it feels a bit cumbersome the way I'm proceeding so I want to make sure it was the intended direction before going too far.
Please let me know what you think.