0.3.4 • Published 6 years ago

bs-little-parser v0.3.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

bs-little-parser

Little parser combinator for BuckleScript or Reason.

Usage

open BsLittleParser.Parser

let input = BsLittleParser.Input.{text = "abcabc  abc"; index = 0; whitespace = " "}

let abc = stringParser "abc"

let () =
  input
  |> rep abc
  |> Js.log

Type Input.t has a whitespace which specify a character sequence should be ignored.

Parsers

parserdescription
str sexpect string
chr cexpect char
regex rexpect regex
p <*> qexecute q only if p succeeds
p <|> qexecute q only if p fails
p <* qsame with <*> but throw the result of q away
p *> qsame with <*> but throw the result of p away
p >> fnqapply the result of p to fnq then execute the return parser
p ^^ fnapply the result of p to fn
rep prepeat p
rep1 prepeat p at least once
opt pexecute p zero or once
andPred pexecute p without consuming the input
notPred psucceeds only if p fails without consuming the input

License

MIT

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.1.0

6 years ago