Go bottom up, when using parsers combinatorics.
When starting with nimble_parsec, or parser combinatorics in general, it seems to be best to go “bottom up”. So always starting with the smalles piece and then expand from there. I used that approach in a small query DSL and on this site for the CodeOptions:
assert ~O<css run> == [lang: "css", run: true]
assert ~O<js hide> == [lang: "js", hide: true]
assert ~O<js run hide> == [lang: "js", run: true, hide: true]
assert ~O<js id=foobar> == [lang: "js", id: "foobar"]
assert ~O<js id=some/odd/id> == [lang: "js", id: "some/odd/id"]
assert ~O<js id="string with spaces"> == [lang: "js", id: "string with spaces"]
Also: I should reach for nimble_parsec sooner rather than later.
Always regret it when I start with RegEx and when that becomes tedious and reach for it then.