1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-27 12:24:39 +01:00
Commit Graph

227 Commits

Author SHA1 Message Date
Nikita Popov
7f8ff1b9a4 Add support for list reference assignments
RFC: https://wiki.php.net/rfc/list_reference_assignment
2018-03-10 16:48:20 +01:00
Nikita Popov
91a462ce76 PHP 7.3: Add support for trailing commas in calls
RFC: https://wiki.php.net/rfc/trailing-comma-function-calls
2018-03-10 16:41:20 +01:00
Nikita Popov
ad9c42b66a Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
2018-01-30 23:07:11 +01:00
Nikita Popov
08215e7646 Fix duplicate switch comment assignment
Fixes #469.
2018-01-30 23:06:20 +01:00
Nikita Popov
1cdb280a30 Merge branch '3.x' 2018-01-25 22:28:08 +01:00
Nikita Popov
d01fafcb40 Handle +(++$x) and -(--$x) as well 2018-01-25 22:27:37 +01:00
Nikita Popov
b85b6b3519 Merge branch '3.x'
Conflicts:
	lib/PhpParser/PrettyPrinter/Standard.php
2018-01-25 22:18:32 +01:00
Nikita Popov
94c715d97e Fix pretty printing of -(-$x) and +(+$x)
Fixes #459.
2018-01-25 22:17:35 +01:00
Nikita Popov
4dacbb8d39 FPPP: Fix indentation on list insertion
Use indentation of last list element, instead of indentation
before the insertion point.

Fixes #466.
2018-01-25 22:08:40 +01:00
Nikita Popov
92b39e3d1f Fix nNextFreeElement for arrays with trailing comma
Ugh.
2017-12-26 21:17:36 +01:00
Nikita Popov
1c7fd314d1 FPPP: Add heuristic for multi-line lists 2017-12-26 21:14:36 +01:00
Nikita Popov
8d3cb5f57b FPPP: Fallback if we must insert a block 2017-12-26 15:41:38 +01:00
Nikita Popov
de82a40d04 FPPP: Add broken InlineHTML test cases 2017-12-26 15:08:30 +01:00
Nikita Popov
a86151f24f FPPP: Fix fallback for inline HTML 2017-12-26 15:08:29 +01:00
Nikita Popov
4fcdac40d1 FPPP: Fix insertion of multiple elems at start 2017-12-02 15:10:15 +01:00
Nikita Popov
04feb90d79 Rename abc1.test to basic.test
And split off fixup.test.
2017-12-01 23:15:50 +01:00
Nikita Popov
dc3ace55c3 FPPP: Support insert at start of list node (#446) 2017-12-01 22:09:51 +01:00
Nikita Popov
e5453f0d46 Extract pSingleQuotedString as an extension point
And add some more string formatting tests.
2017-12-01 18:31:21 +01:00
Nikita Popov
336a49b428 FPPP: Fix comment indentation (#443) 2017-11-13 13:27:27 +01:00
Nikita Popov
4392a7b164 Fix PHP5 static call fixup
Variable nodes directly store the variable name as a string, they
don't use VarLikeIdentifier. So remove this wrapper if it exists.
2017-11-11 12:23:14 +01:00
Nikita Popov
6a2e1ae440 FPPP: Graceful handling of comment changes 2017-11-04 17:56:11 +01:00
Nikita Popov
56bc8ebb9b FPPP: Add support for removal from list nodes 2017-11-04 17:23:17 +01:00
Nikita Popov
b241a121a3 Fix trait alias to semi-reserved name parsing
This was missing the explicit construction of an Identifier node.
2017-10-29 14:15:48 +01:00
Nikita Popov
5900d78cc9 FPPP: Support anonymous classes (#432)
This is a huge hack... We temporarily create a new node with the
correct structure and use that for printing.

I think it would be better to always use a separate node type for
NewAnonClass, rather than using a combination of New and Class,
but this would require some larger changes, as this node type would
have to be both Expr and ClassLike, which is not possible right now,
as the latter is a class rather than an interface...
2017-10-29 12:26:12 +01:00
Nikita Popov
776275361a FPPP: Support modifier changes (#428)
I decided against introducing a node type for this. In the end it
would require special handling anyway.
2017-10-25 22:27:29 +02:00
Nikita Popov
f5de7f9894 FPPP: Check that nodes are nodes in pArray() 2017-10-18 15:42:01 +02:00
Nikita Popov
bbec051e51 FPPP: Consolidate indentation levels
A bit annoying that we have to keep $this->nl always synchronized.
2017-10-06 18:21:08 +02:00
Nikita Popov
f071b66013 Print comments of inserted statements 2017-10-06 17:58:56 +02:00
Nikita Popov
bb2ac91115 Move leading space out of pStmt_Else
Same as previous commit. Also add support for pStmt_If->else
insertion.
2017-10-06 14:56:59 +02:00
Nikita Popov
310155832a FPPP: Support insertion into list subnodes
With some rough edges...
2017-10-06 14:43:41 +02:00
Nikita Popov
ed8a744cd5 FPPP: Switch pArray() to use node list diffing 2017-10-06 12:02:00 +02:00
Nikita Popov
f6cc85a796 FPPP: Fall back if comment in list node changes (#420) 2017-10-02 21:18:13 +02:00
Nikita Popov
cc600b67f6 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
2017-10-01 16:55:54 +02:00
Nikita Popov
d418bf3951 Preserve comments on empty blocks (#382) 2017-10-01 16:54:43 +02:00
Nikita Popov
ec8692fb9e Fix InlineHTML indentation 2017-09-03 19:02:07 +02:00
Nikita Popov
fa12dc8a22 Merge branch '3.x' 2017-08-29 23:15:04 +02:00
Nikita Popov
a10780ca0d Handle Nop statement after brace-style namespace
Fixes #412.
2017-08-29 23:14:27 +02:00
Nikita Popov
46e7fea72d Merge branch '3.x'
Conflicts:
	test/PhpParser/Builder/ParamTest.php
2017-06-28 23:13:33 +02:00
Nikita Popov
4a7d011317 Add support for object type 2017-06-28 23:12:13 +02:00
Nikita Popov
4fea054ee0 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php7.php
2017-06-28 23:06:38 +02:00
Nikita Popov
7f862ac21c Add support for trailing comma in group use 2017-06-28 23:05:28 +02:00
Nikita Popov
3da189769c Distinguish between implicit/explicit alias
The UseUse::$alias node can now be null if an alias is not
explicitly given. As such "use Foo\Bar" and "use Foo\Bar as Bar"
are now represented differently.

The UseUse->getAlias() method replicates the previous semantics,
by returning "Bar" in both cases.
2017-04-28 21:05:01 +02:00
Nikita Popov
a6846e3b71 Always use Identifier nodes
The parser will now always generate Identifier nodes (for
non-namespaced identifiers). This obsoletes the useIdentifierNodes
parser option.

Node constructors still accepts strings and will implicitly create
an Identifier wrapper. Identifier implement __toString(), so that
outside of strict-mode many things continue to work without changes.
2017-04-28 20:57:32 +02:00
Nikita Popov
bc75ac2990 Merge branch '3.x' 2017-04-09 19:51:18 +02:00
Nikita Popov
c3cbf07946 Pretty printer: Preserve comments in arrays and calls
If call arguments or array contains comments, print it in multiline
form, so that comments may be preserved.
2017-04-09 19:49:47 +02:00
Nikita Popov
1ec5591574 Tweak node insertion formatting 2017-04-08 23:11:46 +02:00
Tyson Andre
b5935a4aff Fix a typo in NodeDumper for REQUIRE_ONCE (#367) 2017-03-17 11:35:48 +01:00
Nikita Popov
2beb4e7fd6 Merge branch '3.x'
Conflicts:
	lib/PhpParser/ParserAbstract.php
	test/code/parser/errorHandling/recovery.test
2017-02-26 23:47:27 +01:00
Nikita Popov
d5873b177b Adjust the end attributes on the stack as well 2017-02-26 23:45:14 +01:00
Nikita Popov
da97f78e25 Merge branch '3.x'
Conflicts:
	lib/PhpParser/ParserAbstract.php
	test/code/parser/errorHandling/recovery.test
2017-02-26 23:40:32 +01:00