then-combinator: And(-then) combinator and variants

Description Usage Arguments Examples

Description

Success if both parsers return success.

Usage

1
2
3
4
5
6
7
8
9
p1 %then% p2

p1 %&% p2

p1 %join% p2

p1 %xthen% p2

p1 %thenx% p2

Arguments

p1

A parser.

p2

A parser.

Examples

1
2
3
4
5
6
7
p12 <- string("extract") %xthen% string("THIS")
p12("extractTHISpart")  # success:  list("THIS", "part"))
p12("BBCDE")  #   fail :  list()
p12 <- string("keepthis") %thenx% string("IGNORE")
p12("keepthisIGNORE")          # success:  list("keepthis", ""))
p12("keepthisIGNOREcontinue")  # success:  list("keepthis", "continue"))
p12("BBCDE")  # fail :  list()

kcf-jackson/combinatorParser documentation built on May 17, 2019, 4:22 a.m.