Documentation

expression.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

expression()  : Parser
Build an expression parser from a term parser and an expression table.
binaryOperator()  : BinaryOperator
A binary operator in an expression. The operands of the expression will be passed into $transform to produce the output of the expression parser.
unaryOperator()  : UnaryOperator<TSymbol, TExpressionAST>
A unary operator in an expression. The operands of the expression will be passed into $transform to produce the output of the expression parser.
leftAssoc()  : LeftAssoc
rightAssoc()  : RightAssoc
nonAssoc()  : NonAssoc
prefix()  : Prefix
postfix()  : Postfix

Functions

expression()

Build an expression parser from a term parser and an expression table.

expression(Parser $term, array<string|int, mixed> $expressionTable) : Parser
Parameters
$term : Parser
$expressionTable : array<string|int, mixed>
Tags
template
template
psalm-param

Parser<TTerm> $term

psalm-param

list<ExpressionType> $expressionTable

psalm-return

Parser<TExpressionAST>

psalm-pure
Return values
Parser

binaryOperator()

A binary operator in an expression. The operands of the expression will be passed into $transform to produce the output of the expression parser.

binaryOperator(Parser $symbol, callable $transform[, string $label = "" ]) : BinaryOperator
Parameters
$symbol : Parser
$transform : callable
$label : string = ""
Tags
template
template
psalm-param

Parser<TSymbol> $symbol

psalm-param

pure-callable(TExpressionAST, TExpressionAST):TExpressionAST $transform

psalm-param

string $label

psalm-return

BinaryOperator<TSymbol, TExpressionAST>

psalm-pure
Return values
BinaryOperator

unaryOperator()

A unary operator in an expression. The operands of the expression will be passed into $transform to produce the output of the expression parser.

unaryOperator(Parser $symbol, callable $transform[, string $label = "" ]) : UnaryOperator<TSymbol, TExpressionAST>
Parameters
$symbol : Parser
$transform : callable
$label : string = ""
Tags
template
template
psalm-param

Parser<TSymbol> $symbol

psalm-param

callable(TExpressionAST):TExpressionAST $transform

psalm-param

string $label

psalm-pure
Return values
UnaryOperator<TSymbol, TExpressionAST>

leftAssoc()

leftAssoc(BinaryOperator ...$operators) : LeftAssoc
Parameters
$operators : BinaryOperator
Tags
template
template
psalm-param

non-empty-list<BinaryOperator<TSymbol, TExpressionAST>> $operators

psalm-return

LeftAssoc<TSymbol, TExpressionAST>

psalm-pure
Return values
LeftAssoc

rightAssoc()

rightAssoc(BinaryOperator ...$operators) : RightAssoc
Parameters
$operators : BinaryOperator
Tags
template
template
psalm-param

non-empty-list<BinaryOperator<TSymbol,TExpressionAST>> $operators

psalm-return

RightAssoc<TSymbol, TExpressionAST>

psalm-pure
Return values
RightAssoc

nonAssoc()

nonAssoc(BinaryOperator $operator) : NonAssoc
Parameters
$operator : BinaryOperator
Tags
template
template
psalm-param

BinaryOperator<TSymbol, TExpressionAST> $operator

psalm-return

NonAssoc<TSymbol, TExpressionAST>

psalm-pure
Return values
NonAssoc

prefix()

prefix(UnaryOperator ...$operators) : Prefix
Parameters
$operators : UnaryOperator
Tags
template
template
psalm-param

non-empty-list<UnaryOperator<TSymbol, TExpressionAST>> $operators

psalm-return

Prefix<TSymbol, TExpressionAST>

psalm-pure
Return values
Prefix

postfix()

postfix(UnaryOperator ...$operators) : Postfix
Parameters
$operators : UnaryOperator
Tags
template
template
psalm-param

non-empty-list<UnaryOperator<TSymbol, TExpressionAST>> $operators

psalm-return

Postfix<TSymbol, TExpressionAST>

psalm-pure
Return values
Postfix

        
On this page

Search results