Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* [jmseparated_list(separator, X)] recognizes a possibly empty list of
- [X]'s, separated with [separator]'s. It produces a value of type
- ['a list] if [X] produces a value of type ['a]. The front element
- of the list is the first element that was parsed. *)
- %public %inline jmseparated_list(separator, X):
- xs = loption(jmseparated_nonempty_list(separator, X))
- { xs }
- (* [separated_nonempty_list(separator, X)] recognizes a nonempty list
- of [X]'s, separated with [separator]'s. It produces a value of type
- ['a list] if [X] produces a value of type ['a]. The front element
- of the list is the first element that was parsed. *)
- %public jmseparated_nonempty_list(separator, X):
- x = X
- { [ x ] }
- | x = X; separator; xs = jmseparated_list(separator, X)
- { x :: xs }
Add Comment
Please, Sign In to add comment