8a1acbe4e1
Add await support
2021-12-15 14:09:31 +01:00
e472ac72c2
Update tests
2021-12-15 14:09:30 +01:00
Nikita Popov
4122ff3a91
Make NullsafeMethodCall extend from CallLike
2021-11-14 17:43:29 +01:00
Nikita Popov
4bfc4595ed
Support reserved keywords as enum cases
...
Fixes #807 .
2021-10-17 20:20:35 +02:00
Nikita Popov
08501991d4
Don't make VariadicPlaceholder an expression
...
And don't store it in an Arg.
2021-09-12 21:59:26 +02:00
Shalvah
632ead3a82
Print comma before comments for new array item ( #805 )
...
Print comma before rather than after comments. Also switch to multiline mode if inserting an item with comments.
Fixes #804 .
2021-09-12 21:51:25 +02:00
Nikita Popov
13549aa794
Add support for first-class callables
...
I'm somewhat unsure about the AST structure here.
VariadicPlaceholder is not a general expression. Maybe Arg->expr
should be Expr|VariadicPlaceholder? Or possibly the call arguments
should be an array of Arg|VariadicPlaceholder?
2021-09-03 17:18:40 +02:00
Nikita Popov
def24f2224
Add support for explicit octal literals
2021-09-03 16:29:30 +02:00
Nikita Popov
cfeb195205
Add test for new in initializer
...
This already works because we don't validate initializer contents,
everything is accepted from a parser perspective.
2021-09-03 15:10:29 +02:00
Nikita Popov
ace6c67a8a
Add support for intersection types
2021-09-03 15:06:33 +02:00
Nikita Popov
9aebf377fc
Allow multiple modifiers for property promotion
...
Fixes issue #800 .
2021-08-08 19:12:44 +02:00
Máté Kocsis
55c4269232
Add support for new PHP 8.1 modifiers ( #796 )
...
Implement support for readonly properties (https://wiki.php.net/rfc/readonly_properties_v2 ) and
final class contstants (https://wiki.php.net/rfc/final_class_const ).
2021-07-21 12:43:29 +02:00
Nikita Popov
c758510a37
Add support for PHP 8.1
...
With the introduction of intersection types, PHP now lexes the
token '&' either as T_AMPERSAND_(NOT_)FOLLOWED_BY_VAR_OR_VARARG.
This completely breaks parsing of any code containing '&'.
Fix this by canonicalizing to the new token format (unconditionally,
independent of emulation) and adjusting the parser to use the two
new tokens.
This doesn't add actual support for intersection types yet.
2021-07-09 16:52:58 +02:00
Bob Weinand
3fb73520c1
Add handling for Enum(Case)s in NameResolver
2021-07-03 15:09:11 +02:00
Nikita Popov
4848a0d734
Check for \r as newline in closing tag
...
Fixes #761 .
2021-04-25 22:42:18 +02:00
Nikita Popov
8eb194ea1f
Add never type
...
This should be recognized as Identifier instead of Name now.
2021-04-25 22:35:28 +02:00
Nikita Popov
e03d63cffb
Fix precedence of arrow functions
...
Arrow functions should have lowest precedence.
Fixes #769 .
2021-04-25 22:19:49 +02:00
Nikita Popov
ce91d139b5
Make sure match is one character long
2021-04-25 21:47:07 +02:00
Nikita Popov
33d7c8d3d8
Escape invalid UTF-8 in strings
...
To be friendlier to tooling that expects PHP files to be UTF-8
encoded, escape any sequences that are not legal under UTF-8.
2021-04-25 21:37:01 +02:00
Nikita Popov
6b409b96bb
Use hex escaping for special characters in strings
...
Apart from \0, using the \xHH notation is more typical.
2021-04-25 21:22:15 +02:00
Tomas Votruba
f68e1a43ff
[PHP 8.1] Add support for enums ( #758 )
...
RFC: https://wiki.php.net/rfc/enumerations
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-04-25 21:11:36 +02:00
Nikita Popov
38aa0920c9
Add test for UTF-8 in string
...
These should not get escaped.
2021-03-21 17:03:15 +01:00
Nikita Popov
d3d1ee470a
Fix #738 incorrect start line for traits
...
Empty productions are supposed to be assigned the start attributes
of the lookahead token. Currently, this happens by assigning above
the current stack position when the token it read.
This fails in a situation where we first reduce an empty production
higher up in the stack, and then again reduce an empty production
lower in the stack, without consuming the lookahead token in the
meantime.
Fix this by moving the assignment into the reduction phase. We
also need to do this for error productions, which are effectively
empty.
2020-12-20 10:52:47 +01:00
Nikita Popov
893a5bce3f
Fix #741 incorrect varvar positions
2020-12-19 22:03:43 +01:00
Tommy Quissens
c64986fa55
Allow both '{' and T_CURLY_OPEN as curly bracket ( #732 )
2020-12-03 18:42:00 +01:00
Nikita Popov
eff72eeffa
Fix #718 : PrettyPrinter breaks nested ternaries
...
Mark ternary as non-associative operator, as left-associative use
is deprecated in PHP 7.4 and removed in PHP 8.0.
2020-09-30 20:42:58 +02:00
Nikita Popov
88be6127fa
FPPP: Fix remove + add at start of list
2020-09-22 22:41:02 +02:00
Nikita Popov
8a97fa157f
Recover from missing semicolon after property or class const
...
Fixes #712 .
2020-09-19 23:11:36 +02:00
Nikita Popov
c7dc3ce552
Add basic FPPP support for attributes
2020-09-19 16:43:45 +02:00
Nikita Popov
8505acd151
Correctly handle ?-> in encapsed strings
...
Followup upstream change.
2020-09-19 15:47:14 +02:00
Tomas Votruba
4c22c62783
[PHP 8.0] Add attributes support ( #661 )
...
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes
containing `Attribute` nodes. The `attrGroup` subnode is added to all
nodes that can have attributes.
This is still missing FPPP support.
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-09-13 21:01:17 +02:00
Nikita Popov
35306de32f
Support visibility modifiers in namespaced names
...
Fixes #704 .
2020-08-29 16:35:31 +02:00
Nikita Popov
ad365b1beb
FPPP: Fix code block detection during removal
...
Instead of checking whether there is a {/} before/after the removed
note, check whether {/} occurs in the between-node range. Dropping
that is what we're really concerned about here.
2020-08-29 16:28:28 +02:00
Ondrej Mirtes
fd6052e37d
FPPP failing tests
2020-08-23 20:54:01 +02:00
Nikita Popov
bd722809f7
FPPP: Support removing nodes from start of list
2020-08-23 17:35:37 +02:00
Nikita Popov
8bcaa4261e
Add parens for new/instanceof with complex expression
...
This is not fully accurate because the rules for "new variables"
are different than the rules for dereferenceable LHS.
2020-08-09 22:07:33 +02:00
Nikita Popov
feb6bf7a0c
Wrap class const LHS in parens if necessary
...
This looks like a very old bug in the pretty printer that showed
up in PHP 8 tests.
2020-08-09 21:41:30 +02:00
Nikita Popov
0cee2088ea
Remove self/parent/static restriction for namespace names
...
This no longer applies as of PHP 8.0.
2020-08-09 21:21:22 +02:00
Nikita Popov
78e08fc178
Allow keywords in namespace declaration
2020-08-09 21:19:59 +02:00
Nikita Popov
3aadc15e2e
Support keywords in namespaced names
2020-08-09 21:11:49 +02:00
Nikita Popov
a98350581c
Add support for throw expression
2020-08-09 20:52:55 +02:00
Nikita Popov
7f398769a0
Add support for static return type
2020-08-09 18:52:32 +02:00
Nikita Popov
98f7f39d1c
Add named argument support
...
Not adding any explicit FPPP support, as I don't think add/remove
of names can be handled any better than full reformatting.
2020-08-09 17:37:44 +02:00
Nikita Popov
23d9c17770
Add support for nullsafe operator
2020-08-09 12:08:05 +02:00
Nikita Popov
a63b495fe6
Migrate grammar to use PHP 8 T_NAME_* tokens
...
This will break everything on PHP < 8.
2020-07-23 12:01:50 +02:00
Nikita Popov
2d1998938c
[PHP 8.0] Support trailing comma in closure use list
...
RFC: https://wiki.php.net/rfc/trailing_comma_in_closure_use_list
2020-07-22 18:43:55 +02:00
Nikita Popov
17f478107a
Fix file name
2020-07-22 18:30:00 +02:00
Tomas Votruba
69c5d48afd
[PHP 8.0] Add match expressions ( #672 )
...
RFC: https://wiki.php.net/rfc/match_expression_v2
Upstream implementation: php/php-src#5371
Closes #671 .
2020-07-15 21:40:05 +02:00
Nikita Popov
4abc531213
Canonicalize to PHP 8 comment token format
...
The trailing newline is no longer part of the comment token.
2020-06-27 18:53:09 +02:00
TomasVotruba
b58b19ed1d
Add constructor promotion support
2020-06-27 17:57:47 +02:00