Commit Graph

1181 Commits

Author SHA1 Message Date
Nikita Popov
f5de7f9894 FPPP: Check that nodes are nodes in pArray() 2017-10-18 15:42:01 +02:00
Wes
3193f7aae7 Fix documentation for "replaceNodes" option in NameResolver (#425) 2017-10-15 22:20:52 +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
57bc42517b Move IdentifierTest where it belongs
Ooops...
2017-10-06 15:07:35 +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
e3888cbe02 Move leading space out of pStmt_ElseIf
This is not part of the elseif itself and as such belongs in the
pStmt_If printer.
2017-10-06 14:52:52 +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
69aec6fb5b Add implementation of Myers differ
Intended to be used in the format-preserving pretty printer for
handling changes in node lists.
2017-10-05 21:53:45 +02:00
Nikita Popov
75880fbe2d Make code more explicit 2017-10-05 18:50:48 +02:00
Nikita Popov
65de924493 Add Identifier::toString()
For symmetry with the Name API.

Also add some missing unit tests.
2017-10-03 20:57:48 +02:00
Nikita Popov
eaee6687e0 Tweaks 2017-10-03 19:13:20 +02:00
Nikita Popov
f5f3b0d49d Add name resolution, pretty printing component docs
The docs are receiving too little love...
2017-10-03 19:09:59 +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
4b1d9667af Add constant expression evaluator (#402) 2017-09-30 18:56:44 +02:00
Nikita Popov
a02990a39a Remove PHP 5 substr() workaround
In PHP 7 it no longer returns false instead of '' in this case.
2017-09-29 17:51:44 +02:00
Nikita Popov
403a7c5315 Update changelog 2017-09-29 17:41:19 +02:00
Nikita Popov
cc328a4c9c Add get{Start,End}{Line,TokenPos,FilePos}() methods 2017-09-29 17:34:15 +02:00
Nikita Popov
3d4621bbea Don't return by ref from getAttribute()
This is not worth the few times where it might be useful.
2017-09-29 17:14:27 +02:00
Nikita Popov
d8f9173390 Add Node::getComments() method 2017-09-29 17:09:16 +02:00
Nikita Popov
df334eacaa Add back commented test
We're not testing HHVM anymore, and I've already fixed this bug
upstream.
2017-09-26 18:47:47 +02:00
Nikita Popov
5cfdc2e0a7 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
	test/PhpParser/ParserTest.php
2017-09-26 18:46:44 +02:00
Nikita Popov
5a9fbca54a Add attribute for namespace kinds (#417)
One of KIND_SEMICOLON or KIND_BRACED.
2017-09-26 18:45:05 +02:00
markbook2
4f8f773b9f Remove leftover property intialization in pretty printer (#416) 2017-09-17 15:25:14 +08:00
markbook2
69ed40e401 Don't continue of searching if a global namespace declaration is found 2017-09-15 21:53:21 +08:00
Nikita Popov
ec8692fb9e Fix InlineHTML indentation 2017-09-03 19:02:07 +02:00
Nikita Popov
b1cd07a7b5 Extract TokenStream class from pretty printer 2017-09-03 18:54:22 +02:00
Nikita Popov
61e624bc9d Replace noIndent mechanism in pretty printer
Instead store newline with indentation in $nl property and use it
where needed.

The implementation should be changed to compilet indentLevel and
fpIndentLevel, I don't think these need to be kept separate.
2017-09-03 18:11:25 +02:00
Nikita Popov
31065389f1 Remove workarounds for reserved keyword method names
No longer necessary in PHP 7.
2017-09-02 20:08:20 +02:00
Nikita Popov
829c6c3c71 Add initial changelog for version 4.0 2017-09-02 20:03:10 +02:00
Nikita Popov
e145102345 Merge branch '3.x' 2017-09-02 19:11:27 +02:00
Nikita Popov
a1e8e1a30e Release PHP-Parser 3.1.1 2017-09-02 19:10:46 +02:00
Nikita Popov
efd39a67a2 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Builder/Trait_.php
	test/PhpParser/Builder/TraitTest.php
2017-08-29 23:20:47 +02:00
Nikita Popov
d77e6cd6e9 Allow TraitUse statements in trait builder
Fixes #413.
2017-08-29 23:18:59 +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
9373a8e9f5 Implement JsonDecoder
Converts JSON representation back into node tree.
2017-08-18 23:56:12 +02:00
TomasVotruba
e2e99f269b Add strict_types to lib code 2017-08-18 23:00:13 +02:00
Nikita Popov
7b36ca3b6c Add isSpecialClassName() method to Identifier and Name 2017-08-15 22:59:52 +02:00
Nikita Popov
d97cc3d96e Add toLowerString() method to Name and Identifier
Avoids patterns like strtolower((string) $name) when using
strict types.
2017-08-15 22:49:16 +02:00
TomasVotruba
6ab69a7dc9 [cs] apply short array to bin/php-parse 2017-08-15 22:25:39 +02:00
TomasVotruba
af12807451 [cs] apply same to tests 2017-08-13 21:14:28 +02:00
TomasVotruba
9d599040b7 [cs] spaces 2017-08-13 21:14:28 +02:00
TomasVotruba
05e6725b7a [cs] use strict comparison where allowed 2017-08-13 21:14:28 +02:00
TomasVotruba
ec535ea14e [cs] use PHP 5.4 short array, since PHP 7.0 is min version 2017-08-13 21:14:28 +02:00
TomasVotruba
58bf92e4f7 [cs] remove unused imports 2017-08-13 21:14:28 +02:00
Tomáš Votruba
a664b28248 travis: add dash to make command format united (#407)
Prevents possible error when adding a second line
2017-08-13 14:04:53 +02:00