Commit Graph

858 Commits

Author SHA1 Message Date
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
Nikita Popov
48ec654d0c Make Expr\Error nodes empty
Resolves issue #359.
2017-02-26 23:38:32 +01:00
Nikita Popov
f291a19fd5 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php7.php
2017-02-26 23:13:21 +01:00
Nikita Popov
c12a4c8239 Fix start attribute assignment for Error in ClassConstFetch 2017-02-26 23:00:38 +01:00
Nikita Popov
86ea6fe8c4 Remove leftover code 2017-02-26 22:53:08 +01:00
Nikita Popov
dce34f37db Merge branch '3.x' 2017-02-26 22:51:27 +01:00
Nikita Popov
1b59e918f7 Perform NullableType resolution earlier
This makes sure function signatures are already fully resolved in
enterNode(). Resolves issue #360.
2017-02-26 22:50:31 +01:00
Nikita Popov
9cd9c0cd52 Drop XML serialization from php-parse
The class no longer exists, so this broke the script.
2017-02-23 21:18:04 +01:00
Matthew Brown
9857a545e2 Remove unused variables (#357) 2017-02-11 11:05:36 +01:00
Nikita Popov
54b61ebe7c Merge branch '3.x' 2017-02-10 21:20:30 +01:00
Nikita Popov
0bf561dfe7 Release PHP-Parser 3.0.4 2017-02-10 21:20:03 +01:00
Matthew Brown
329e90c239 Improve doc comments 2017-02-09 20:49:52 +01:00
Nikita Popov
9f5ec5a69a Merge branch '3.x'
Conflicts:
	lib/PhpParser/Parser/Php5.php
	lib/PhpParser/Parser/Php7.php
	test/code/parser/stmt/class/name.test
2017-02-09 20:38:33 +01:00
Nikita Popov
df98b0417b Handle "extends static" etc more gracefully
Use class_name production and emit the same error as for
"extends self" and "extends parent". It's weird that "extends
static" gives a different result than those two.
2017-02-09 18:43:09 +01:00
Nikita Popov
a8eb2fc675 Support recovery from invalid trailing commas 2017-02-09 00:35:12 +01:00
Nikita Popov
4a434fdc1b Merge branch '3.x' 2017-02-09 00:03:37 +01:00
Nikita Popov
d18ccfeec7 Use p() in pPrec() for easier extensibility 2017-02-09 00:03:00 +01:00
Nikita Popov
f8a2f6e760 Merge branch '3.x' 2017-02-08 23:55:16 +01:00
Jennifer Hodgdon
4e55897059 Change one function to protected 2017-02-08 23:55:02 +01:00
Jesse Schalken
41facc02ef Fix typo with-posititions => with-positions 2017-02-08 23:54:08 +01:00
Nikita Popov
865bfb2acf Merge branch '3.x'
Conflicts:
	grammar/php7.y
	lib/PhpParser/Parser/Php7.php
	test/code/parser/expr/uvs/globalNonSimpleVarError.test
	test/code/parser/stmt/namespace/groupUseErrors.test
2017-02-05 17:50:54 +01:00
Nikita Popov
62877b5d14 Recover from missing semicolons on statements 2017-02-05 17:47:56 +01:00
Nikita Popov
f4ea0270c8 Mark version 2.x as unsupported
No commits to this branch for five months, mark as unsupported.
2017-02-05 14:19:54 +01:00
Nikita Popov
8f623fb241 Use closures instead of methods for semantic actions
The dispatch using $this->{'reduceRule' . $rule}() is very expensive
because it involves
 * One allocation when converting $rule to a string
 * Another allocation when concatenating the two strings
 * Lowercasing during the method call
 * Various uncached method checks, e.g. visibility.

Using an array of closures for semantic action dispatch is
significantly more efficient.
2017-02-05 11:58:45 +01:00
Nikita Popov
3bbf8d8f7a Use local var for $stackPos
We're accessing $this->stackPos a lot, and property accesses are
much more expensive than local variable acesses. Its cheaper to
use a local var and pass it as an argument to semantic actions.
2017-02-05 11:57:21 +01:00
Nikita Popov
90b6d7cb5b Remove XML serializer 2017-02-04 01:10:09 +01:00
Nikita Popov
7fa5495d64 Merge branch '3.x' 2017-02-03 22:59:06 +01:00
Nikita Popov
5b8182cc0a Release PHP-Parser 3.0.3 2017-02-03 22:57:31 +01:00
Nikita Popov
af8b17bd75 Update changelog 2017-02-03 22:56:55 +01:00
Nikita Popov
42f046ec19 Deprecate XML serializer 2017-02-03 22:52:16 +01:00
Nikita Popov
987c61e935 Drop support for false return value in NodeTraverser 2017-02-03 22:36:57 +01:00
Nikita Popov
2b72bae3d9 Throw if NodeVisitor returns invalid value 2017-02-03 22:30:26 +01:00
Nikita Popov
2b6804aa50 Throw on nested array in NodeTraverser
The AST never uses deeply nested arrays, so don't support this in
the node traverser. Throw an exception instead.
2017-02-03 22:11:31 +01:00
Nikita Popov
d9911c8da5 Merge branch '3.x'
Conflicts:
	lib/PhpParser/Node/Expr/ClassConstFetch.php
	test/PhpParser/PrettyPrinterTest.php
2017-02-03 21:54:48 +01:00
Nikita Popov
d287c167bc Pretty print: Handle Error in ClassConstFetch 2017-02-03 21:53:02 +01:00
Nikita Popov
79afd56565 Add NodeFinder class
To simplify basic node finding operations.
2017-01-29 23:20:53 +01:00
Nikita Popov
5cc2750ebc Merge branch '3.x'
Conflicts:
	lib/PhpParser/NodeVisitor.php
2017-01-29 22:36:33 +01:00
Nikita Popov
58e7881e98 Implement NodeTraverser::STOP_TRAVERSAL
Conflicts:
	lib/PhpParser/NodeVisitor.php
2017-01-29 22:35:40 +01:00
Nikita Popov
e072c789d1 Merge branch '3.x'
Conflicts:
	test/PhpParser/PrettyPrinterTest.php
2017-01-29 21:57:37 +01:00
Nikita Popov
fd7ac25108 Throw if pretty-printing Error node 2017-01-29 21:56:21 +01:00
Nikita Popov
bfea338d36 Update doc comments after previous comment
Make some of the type annotations more accurate, and complete the
generated doc-comments to be complete (with description and
parameter annotations.)
2017-01-26 00:16:54 +01:00
Matthew Brown
e3b87f40aa Add non-void return types 2017-01-25 23:32:50 +01:00
Nikita Popov
70f86cb6cb Update NodeVisitor doc comments 2017-01-25 23:28:44 +01:00
Nikita Popov
13304d5991 Drop attribute poisoning in parser 2017-01-23 01:13:34 +01:00
Matthew Brown
7b441d2142 Fix issues reported by psalm 2017-01-23 01:06:46 +01:00
Nikita Popov
cb5dd28985 Don't include whitespace directly in catch/finally print 2017-01-21 21:25:48 +01:00
Nikita Popov
5e565e8046 Support insertion of nullable nodes
Still incomplete in some places and the formatting is not always
ideal.
2017-01-21 21:20:42 +01:00
Nikita Popov
b9b6aeeed9 Support format-preserving node removal
Take care of stripping surrouding tokens appropriately.
2017-01-21 17:52:50 +01:00
Nikita Popov
0607450f78 Add FinderVisitor
Allows finding nodes based on a filter callback.
2017-01-21 15:41:24 +01:00
Nikita Popov
aea3a9efe4 Add @property annotations for namespacedName 2017-01-20 23:45:54 +01:00