19 declare(strict_types=1);
49 new Ok(is_array($value) && !is_string(key($value)) ? current($value) : $value)
60 return new Custom(fn($input) => $this->
apply($parse, $input)->value());
80 return $this->primitives->simpleEither([
81 $this->
range(0x41, 0x5A),
82 $this->
range(0x61, 0x7A),
91 return $this->
range(0x30, 0x39);
96 return $this->primitives->simpleEither($this->
namesFromKeys($parsers));
105 return $this->primitives->simpleSequence($this->
namesFromKeys($parsers));
117 $max =
null === $max ?
null : max($min, $max) - $min;
119 return $this->primitives->simpleSequence([
120 ...array_fill(0, $min, $parse),
121 $this->primitives->until($max, $parse)
132 return $this->
transform->to($transformation, $parse);
142 function ($key) use ($array):
Closure {
143 $current = $this->primitives->parserFrom($array[$key]);
144 return is_string($key) ? $this->
transform->as($key, $current) : $current;
then(callable $f)
Get a new result from the callable or do nothing if this is an error.
namesFromKeys(array $array)
transformation(Transformation $transformation, Closure $parse)
consume(Closure $parse, Intermediate $intermediate)
It just checks if the given input is fully consumed after parsing and rejects the input otherwise...
repeat(int $min, ?int $max, $parse)
-type Continuation Closure(Result<Intermediate>): Result<Intermediate> -type Parser Closure(Intermedi...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
toTransformation(Closure $parse)
A result encapsulates a value or an error and simplifies the handling of those.
range(int $start, int $end)
-type Continuation Closure(Result<Intermediate>): Result<Intermediate> -type Parser Closure(Intermedi...
apply(Closure $parse, string $input)