1///|
2pub fn[A, B, C] 
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
::
(self : Parser[A], open~ : Parser[B], close~ : Parser[C]) -> Parser[A]
between
(
3
Parser[A]
self
:
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
],
4
Parser[B]
open
~ :
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter B

B
],
5
Parser[C]
close
~ :
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter C

C
]
6) ->
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
] {
7
Parser[B]
open
8 .
(self : Parser[B]) -> Parser[B]
discard_spaces
()
9 .
(x : Parser[B], y : Parser[A]) -> Parser[A]
discard_left
(
Parser[A]
self
.
(self : Parser[A]) -> Parser[A]
discard_spaces
())
10 .
(x : Parser[A], y : Parser[C]) -> Parser[A]
discard_right
(
Parser[C]
close
)
11 .
(self : Parser[A]) -> Parser[A]
discard_spaces
()
12} 13 14///| 15pub fn[A]
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
::
(self : Parser[A]) -> Parser[A]
round_bracket
(
Parser[A]
self
:
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
]) ->
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
] {
16
Parser[A]
self
.
(self : Parser[A], open~ : Parser[Char], close~ : Parser[Char]) -> Parser[A]
between
(
Parser[Char]
open
=
(ch : Char) -> Parser[Char]
char
('('),
Parser[Char]
close
=
(ch : Char) -> Parser[Char]
char
(')'))
17} 18 19///| 20pub fn[A]
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
::
(self : Parser[A]) -> Parser[A]
square_bracket
(
Parser[A]
self
:
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
]) ->
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
] {
21
Parser[A]
self
.
(self : Parser[A], open~ : Parser[Char], close~ : Parser[Char]) -> Parser[A]
between
(
Parser[Char]
open
=
(ch : Char) -> Parser[Char]
char
('['),
Parser[Char]
close
=
(ch : Char) -> Parser[Char]
char
(']'))
22} 23 24///| 25pub fn[A]
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
::
(self : Parser[A]) -> Parser[A]
curly_bracket
(
Parser[A]
self
:
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
]) ->
type Parser[A] (Input) -> (A, Input) raise ParseError
Parser
[

type parameter A

A
] {
26
Parser[A]
self
.
(self : Parser[A], open~ : Parser[Char], close~ : Parser[Char]) -> Parser[A]
between
(
Parser[Char]
open
=
(ch : Char) -> Parser[Char]
char
('{'),
Parser[Char]
close
=
(ch : Char) -> Parser[Char]
char
('}'))
27} 28