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

161 Commits

Author SHA1 Message Date
nikic
c7c94f38f1 Stop using ArrayObject for nodes
Instead manually implement IteratorAggregate and define the required magic methods. The reasoning behind this is:
a) Extending ArrayObject is always risky, because a lot of magic which is known to be buggy is involved
b) This allows to lateron change the implementation for the nodes altogether, for example it could be changed to using real public fields instead of a $subNodes array.
2011-10-28 23:12:32 +02:00
nikic
126efbc056 Make more things optional
Make $stmts and $subNodes optional in most places
2011-10-28 19:14:06 +02:00
nikic
a3c24cf86c [API] Rename Stmt_Func to Stmt_Function 2011-10-28 19:08:01 +02:00
nikic
f202aa9814 [API] Make all constructors specialized
For nodes that accept many optional arguments I chose to keep the $subNodes argument, but provide default values instead.
2011-10-28 19:06:24 +02:00
nikic
5f0a1535ff Fix unit tests 2011-10-26 18:35:37 +02:00
nikic
25f37ccc28 [API] Rename LambdaFunc to Closure
The term "closure" is more commonly used in PHP, even if the function doesn't use() any variables.
2011-10-26 18:34:12 +02:00
nikic
734dbecbc9 Add some more constructors 2011-10-21 16:51:37 +02:00
nikic
82c495657e Remove zend_language_parser.y from distribution 2011-10-21 14:38:25 +02:00
nikic
7806bf025e [5.4] Add support for ClassName::{expr} 2011-10-21 14:09:41 +02:00
nikic
73cc546140 Slightly clean up scalar/static_sclar/common_sclar
name rule is now in common_scalar as it is shared. T_STRING_VARNAME is in encaps_var now.
2011-10-21 12:22:41 +02:00
nikic
ef9d0283e9 Add class_name_or_var nonterminal (to simplify)
class_name_or_var nonterminal is class_name | reference_variable
2011-10-21 11:50:03 +02:00
nikic
08ea0e3d56 [5.4] Add callable typehint
Need to refactor how typehints are saved. Saving array and callable typehints as strings isn't clean
2011-10-21 11:30:27 +02:00
nikic
ab982567d7 [5.4] Add support for short array syntax 2011-10-21 11:27:29 +02:00
nikic
1eb1118ee1 [5.4] Add object method array dereferencing
Other array dereferencing support will follow. Added this in advance as it simplified the code.
2011-10-21 11:12:51 +02:00
nikic
eae1abb6d7 [5.4] Add new tokens
This is to not throw noticed when parsing not yet supported code on 5.4
2011-10-21 11:12:34 +02:00
nikic
920f12f958 Allow __halt_compiler(); after braced namespaces 2011-10-20 23:06:38 +02:00
nikic
d9b5814074 run tests with all errors enabled 2011-10-20 22:36:10 +02:00
nikic
3233fdd24d Add support for ClassName::$$a() 2011-10-20 22:29:34 +02:00
nikic
aea2f67c52 Fix AST for ClassName::$methodName() 2011-10-20 22:16:25 +02:00
nikic
dc4182277f Exclude fatal errors one some files from PHP tests 2011-10-19 20:04:57 +02:00
nikic
9fba1df4e0 Circumvent token_get_all bug with b"$var" 2011-10-19 18:09:13 +02:00
nikic
460f981e84 Improve tests
* Script is now at test_old/run.php and is CLI only
* Accepts a test type (Symfony or PHP) and a path to the test files as arguments
* For the PHP testsuite files that expect a parse error are not tested (though Fatal errors are tested, so there are still 49 parse test failures)
* Removed testExpressions.php as this is covered in the PHP testsuite
2011-10-19 17:55:37 +02:00
nikic
69b298c4b5 Recognize halt_compiler() ?> (without ;) 2011-10-18 18:03:28 +02:00
nikic
afdfb6bf08 Make test_old able to run PHP testsuite 2011-10-17 17:49:24 +02:00
nikic
7078252444 Fix pretty printing of whole-numbered floats
This time properly. Only remaining problem is that floats like 1e1000 are printed as INF. This may or may not be acceptable. The value will be the same, but the tests will signal a diff failure.
2011-10-16 15:39:23 +02:00
nikic
b77d66e5bd Fix pretty print of ${$a}[0] 2011-10-16 15:25:40 +02:00
nikic
4ce618643f Fix escaping in pretty print of ShellExec 2011-10-16 15:19:50 +02:00
nikic
9ed77427a2 Rename Expr_List to Expr_AssignList 2011-10-16 14:49:13 +02:00
nikic
43f9c37c7f Add operator precedence for list() assignments 2011-10-16 14:44:39 +02:00
nikic
7f82d20cca Fix pretty printing of whole-numbered floats 2011-10-16 14:36:45 +02:00
nikic
6fc85143ca Fix parsing of $$$a 2011-10-16 14:30:22 +02:00
nikic
f30320b9b2 Fix Stmt_List pretty printing for nested list()s 2011-10-16 14:11:23 +02:00
nikic
527265cdf7 Fix Stmt_DeclareDeclare pretty printing 2011-10-16 13:38:23 +02:00
nikic
df657b703e Rename caseList to cases in Node_Stmt_Switch 2011-10-15 19:30:48 +02:00
nikic
2d57f52d24 Add more specialized constructors 2011-10-15 19:28:15 +02:00
nikic
a7a7dfce18 Remove useless condition from Throw printer 2011-09-30 19:30:33 +02:00
nikic
535cf21b73 Swap argument order for Node_Case
$cond is now the first parameter and is not optional.
2011-09-30 19:19:17 +02:00
nikic
b7a034cd9f Remove redundant check in NameResolver 2011-09-29 18:51:12 +02:00
nikic
53d33345e1 Simplify resolveOtherName logic 2011-09-28 20:29:19 +02:00
nikic
ab72f98570 Add NameResolver
The NameResolver visitor tries to resolve all names to fully qualified names. It will resolve all non-dynamic names, apart from unqualified function and constant names. The latter can not be resolved properly without running the code.
2011-09-28 20:14:27 +02:00
nikic
62183807ee Add test coverage for Node_Name
And fix bugs found while doing so.
2011-09-28 18:11:28 +02:00
nikic
92f793001b Fix some readme + doccomment typos 2011-09-28 16:26:51 +02:00
nikic
d53173c2f3 Don't use references in NodeTraverser
Stop using reference magic in the NodeTraverser. Instead use normal return values. Additionally enfore that an array is passed to ->traverse().
2011-09-24 23:39:05 +02:00
nikic
d5f148b43f Merge Node_Name and Node_Name_Normal 2011-09-24 23:31:18 +02:00
nikic
df7cb44eed Use seperate Name node classes instead of type subnode 2011-09-24 16:53:40 +02:00
nikic
858545732c Add shared Node_Const
Node_Const is shared between Node_Stmt_ClassConst and Node_Stmt_Const. Maybe one could generalize it to a Node_NameToValue to share it with Node_Stmt_Declare too.
2011-09-23 21:00:59 +02:00
nikic
8bd8e815c9 Add missing doc and pretty print for Stmt_Declare 2011-09-23 18:53:11 +02:00
nikic
ea65ea7a32 Make some doc comments more precise
Additionally add two further constructors
2011-09-23 18:45:29 +02:00
nikic
ee4e55dc75 Move Node_Expr_FuncCallArg to Node_Arg (just like Node_Param) 2011-09-22 20:34:35 +02:00
nikic
06b7d63406 Add specialized constructors for statement nodes with only one subnode 2011-09-22 20:27:12 +02:00