Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isUnary example
$stream
->
expect
(
/* Token::PUNCTUATION_TYPE */ 9, ')'
)
;
$stream
->
expect
(
/* Token::ARROW_TYPE */ 12
)
;
return
new
ArrowFunctionExpression
(
$this
->
parseExpression
(
0
)
,
new
Node
(
$names
)
,
$line
)
;
}
private
function
getPrimary
(
)
: AbstractExpression
{
$token
=
$this
->parser->
getCurrentToken
(
)
;
if
(
$this
->
isUnary
(
$token
)
)
{
$operator
=
$this
->unaryOperators
[
$token
->
getValue
(
)
]
;
$this
->parser->
getStream
(
)
->
next
(
)
;
$expr
=
$this
->
parseExpression
(
$operator
[
'precedence'
]
)
;
$class
=
$operator
[
'class'
]
;
return
$this
->
parsePostfixExpression
(
new
$class
(
$expr
,
$token
->
getLine
(
)
)
)
;
}
elseif
(
$token
->
test
(
/* Token::PUNCTUATION_TYPE */ 9, '('
)
)
{
$this
->parser->
getStream
(
)
->
next
(
)
;
$expr
=
$this
->
parseExpression
(
)
;
$this
->parser->
getStream
(
)
->
expect
(
/* Token::PUNCTUATION_TYPE */ 9, ')', 'An opened parenthesis is not properly closed'
)
;