murmour/mparser

add a non_space parser

martindemello opened this issue · 3 comments

i found myself defining this a couple of times; it's probably worth having as a standard char parser, especially if i've made some subtle mistake :)

let non_space : (char, unit) parser = none_of " \t\r\n"

A good suggestion! Perhaps it would be better to add a not combinator?

val not: (char, 's) t -> (char, 's) t

You could then use not space instead of non_space.

yeah, that would be even better. (i actually went and looked for a not combinator in the docs when i was trying to implement non_space, then forgot about doing it that way)

Since not is a standard OCaml builtin, I chose to name the new function is_not. I've added non_space as well, for better messages and performance.

A minor release should hit OPAM soon.

(insider leak: a major release is in the works)