196 lines
3.0 KiB
Plaintext
196 lines
3.0 KiB
Plaintext
# Booleans
|
|
|
|
<?php
|
|
True;
|
|
true;
|
|
TRUE;
|
|
false;
|
|
False;
|
|
FALSE;
|
|
?>
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(Boolean),
|
|
ExpressionStatement(Boolean),
|
|
ExpressionStatement(Boolean),
|
|
ExpressionStatement(Boolean),
|
|
ExpressionStatement(Boolean),
|
|
ExpressionStatement(Boolean),
|
|
TextInterpolation(PhpClose))
|
|
|
|
# Floats
|
|
|
|
<?php
|
|
|
|
1.0;
|
|
1E432;
|
|
1.0E-3432;
|
|
1423.0E3432;
|
|
.5;
|
|
6.674_083e11;
|
|
107_925_284.88;
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float),
|
|
ExpressionStatement(Float)
|
|
)
|
|
|
|
# Integers
|
|
|
|
<?php
|
|
|
|
1234;
|
|
1_234_456;
|
|
0123;
|
|
0123_456;
|
|
0x1A;
|
|
0x1A_2B_3C;
|
|
0b111111111;
|
|
0b1111_1111_1111;
|
|
0o123;
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer),
|
|
ExpressionStatement(Integer)
|
|
)
|
|
|
|
# Testing string scanner conformance
|
|
|
|
<?php echo "\"\t\\'" . '\n\\\'a\\\b\\' ?>
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
EchoStatement(echo, BinaryExpression(String(EscapeSequence, EscapeSequence, EscapeSequence), ConcatOp, String)),
|
|
TextInterpolation(PhpClose))
|
|
|
|
# Shell command
|
|
|
|
<?php
|
|
`ls -la`;
|
|
`ls`;
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(ShellExpression),
|
|
ExpressionStatement(ShellExpression))
|
|
|
|
# Heredocs
|
|
|
|
<?php
|
|
|
|
<<<HERE
|
|
foo #{bar}
|
|
HERE;
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
<<<HERE
|
|
foo #{bar}
|
|
HERE;
|
|
|
|
<<< HERE
|
|
foo #{bar}
|
|
HERE;
|
|
|
|
// Allow Heredoc as function argument
|
|
read(<<< HERE
|
|
foo #{bar}
|
|
HERE);
|
|
|
|
read(<<< HERE
|
|
foo #{bar}
|
|
HERE , true);
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(HeredocString),
|
|
TextInterpolation(PhpClose,Text,PhpOpen),
|
|
ExpressionStatement(HeredocString),
|
|
ExpressionStatement(HeredocString),
|
|
LineComment,
|
|
ExpressionStatement(
|
|
CallExpression(
|
|
Name,
|
|
ArgList(HeredocString)
|
|
)
|
|
),
|
|
ExpressionStatement(
|
|
CallExpression(
|
|
Name,
|
|
ArgList(
|
|
HeredocString,
|
|
Boolean
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
# Nowdocs
|
|
|
|
<?php
|
|
|
|
<<<'PHP'
|
|
<?php echo phpversion().PHP_SAPI;
|
|
PHP
|
|
|
|
?>
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(HeredocString),
|
|
TextInterpolation(PhpClose))
|
|
|
|
# Unicode escape sequences
|
|
|
|
<?php
|
|
|
|
"\u{61}"; // ASCII "a" - characters below U+007F just encode as ASCII, as it's UTF-8
|
|
"\u{FF}"; // y with diaeresis
|
|
"\u{ff}"; // case-insensitive
|
|
"\u{2603}"; // Unicode snowman
|
|
"\u{1F602}"; // FACE WITH TEARS OF JOY emoji
|
|
"\u{0000001F602}"; // Leading zeroes permitted
|
|
|
|
==>
|
|
|
|
Template(
|
|
TextInterpolation(PhpOpen),
|
|
ExpressionStatement(String(EscapeSequence)), LineComment,
|
|
ExpressionStatement(String(EscapeSequence)), LineComment,
|
|
ExpressionStatement(String(EscapeSequence)), LineComment,
|
|
ExpressionStatement(String(EscapeSequence)), LineComment,
|
|
ExpressionStatement(String(EscapeSequence)), LineComment,
|
|
ExpressionStatement(String(EscapeSequence)), LineComment)
|
|
|