Documentation

sideEffects.php

This file is part of the Parsica library.

Copyright (c) 2020 Mathias Verraes mathias@verraes.net

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Table of Contents

Functions

emit()  : Parser
If the parser is successful, call the $receiver function with the output of the parser. The resulting parser behaves identical to the original one. This combinator is useful for expressing side effects during the parsing process. It can be hooked into existing event publishing libraries by using $receiver as an adapter for those. Other use cases are logging, caching, performing an action whenever a value is matched in a long-running input stream, .

Functions

emit()

If the parser is successful, call the $receiver function with the output of the parser. The resulting parser behaves identical to the original one. This combinator is useful for expressing side effects during the parsing process. It can be hooked into existing event publishing libraries by using $receiver as an adapter for those. Other use cases are logging, caching, performing an action whenever a value is matched in a long-running input stream, .

emit(Parser $parser, callable $receiver) : Parser

..

Parameters
$parser : Parser
$receiver : callable
Tags
template
psalm-param

Parser<T> $parser

psalm-param

callable(T): void $receiver

psalm-return

Parser<T>

Return values
Parser

        
On this page

Search results