nikic
b49c55c9e5
Cover NodeTraverser and bugs it found
...
a) ->traverseNode() now operates on a clone of the node, otherwise the original node will be modified too
b) before nodes were passed to the following visitor unchanged, even though they were already changed in the tree
2011-12-02 17:52:03 +01:00
nikic
8c2bf0373c
Some more test improvements (+ fixes)
2011-11-27 21:50:19 +01:00
nikic
3a4cc1a0f0
Do not distribute debug parser anymore
...
The debug parser (and the debug y.output) can be still built using rebuildParser.php?debug.
2011-11-27 21:48:34 +01:00
nikic
6ef6e1dab3
Cover errors (and fix errors for namespace names)
2011-11-27 12:58:20 +01:00
nikic
80d090ea14
Fix __halt_compiler with newline after closing tag
...
The newline after the closing tag is now not returned as part of the remaining text (PHP eats one newline after ?>).
2011-11-27 11:21:06 +01:00
nikic
933bebb9b8
Fix parsing of special int syntaxes
...
Also add the means to test code parsing.
2011-11-26 16:09:39 +01:00
nikic
adfa67cdcf
[5.4] Add direct dereferencing of new expression
...
(new A)->b(), (new A)->b, (new A)[0]. The feature is not implemented fully compliant (implemented as a `variable`, not `expr_without_variable`: Awaiting input on that on internals@.
2011-11-21 18:43:35 +01:00
nikic
3b02facf0c
Add an example
2011-11-12 18:29:50 +01:00
nikic
2ec6ae4b03
Make NameResolver add namespacedName subnodes
2011-11-12 13:24:59 +01:00
nikic
c44f6375ef
Start adding more extensive documentation
2011-11-12 13:07:12 +01:00
nikic
c94a4767df
Add tests for XML serialization
...
Also fix the invalid namespace URIs I used.
2011-11-06 18:09:32 +01:00
nikic
d9452e611a
Fix NameResolver for parameters without typehints
2011-11-06 17:16:40 +01:00
nikic
b84553e011
Add XML serialization and unserialization support
...
The unserializiation implementation currently is very hacky => needs some refactoring.
2011-11-06 17:07:38 +01:00
nikic
4e656fc58d
[5.4] Add full array dereferencing support
2011-11-04 07:40:48 +01:00
nikic
6ecae86981
[5.4] Add support for traits
2011-10-30 12:03:29 +01:00
nikic
613aa84f80
[5.4] Add support for static closures
...
This adds another property to Expr_Closure named "static". It's true for static closures and false otherwise.
2011-10-29 00:16:29 +02:00
nikic
c88d227597
Move some uses of the toArray() macro
...
Previously it was applied both to the result of inner_statement_list and statement, whereas only the latter required it.
2011-10-28 23:59:00 +02:00
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
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
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
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
9fba1df4e0
Circumvent token_get_all bug with b"$var"
2011-10-19 18:09:13 +02:00
nikic
69b298c4b5
Recognize halt_compiler() ?> (without ;)
2011-10-18 18:03:28 +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
nikic
a551bbc5a4
Add PHPParser_Node interface
2011-09-21 21:43:19 +02:00
nikic
3583c1955f
Improve NodeDumper performance and make testAgainstDirectory more friendly
2011-09-06 17:10:58 +02:00
nikic
847cdbc5c6
Swap argument order for ArrayItem
2011-09-02 19:49:46 +02:00
nikic
393221ce63
Some minor improvements (performance and exception wise) for the node traverser
2011-08-31 21:19:31 +02:00
nikic
63525d36e7
Fix / improve some method doc docomments / signatures
2011-08-22 17:38:05 +02:00
nikic
9cc2cf322b
Iterate replacement nodes using all visitors apart from the one having made the replacement
2011-08-20 16:16:59 +02:00
nikic
17a81b5c8f
Properly parse escape sequences:
...
* Add support for oct and hex escape sequences
* Take used quote type into account when parsing encapsed strings
2011-08-20 10:40:27 +02:00
nikic
05c514f9c5
Instantiate a Node_Name for 'static', too. Fix some doc comments.
2011-08-19 17:44:42 +02:00
nikic
299893066d
Fix NodeTraverser by putting to-be-deleted and to-be-merged nodes into the same queue. Additionally do not further iterate queued nodes.
2011-08-19 17:19:27 +02:00
nikic
ca51472c2f
Move Variable to Expr_Variable, move Stmt_FuncParam to Param (as it is used both in stmts and expr and both in funcs and methods)
2011-08-14 18:51:42 +02:00
nikic
bd602afc3a
Add specialized constructor for lambdas, too
2011-08-14 18:26:06 +02:00
nikic
96350be172
Implement the debug parser by extending the normal parser. That way there is no need to repeat all action codes and lookup tables twice.
2011-08-14 15:36:15 +02:00
nikic
297c9ac290
Use moriyoshi's fork of kmyacc, which fixes most of the issues of kmyacc with PHP
2011-08-14 14:52:24 +02:00
nikic
e0fe21287d
Add specialized constructors for all expression nodes apart from lambda
2011-08-11 10:25:51 +02:00
nikic
f412b3915f
Rename cast nodes and give them a common Expr_Cast parent (with specialized constructor)
2011-08-11 09:20:25 +02:00
nikic
284f32f475
Add specialized constructor for binary operators
2011-08-11 08:57:13 +02:00
nikic
22b507e9f4
Rename Bin[ary] to Bitwise (which is the correct name)
2011-08-11 08:42:28 +02:00
nikic
344913d44b
Add specialized constructors for assignment operations
2011-08-11 08:35:10 +02:00
nikic
d9a23f2dc7
Add specialized constructors for Expr_Array*, make Variable an Expr
2011-08-11 08:13:01 +02:00
nikic
c06cbb53dc
Make for-loop formatting nicer
2011-08-11 07:53:55 +02:00
nikic
690b505a7a
Make array_pair an extra grammar rule, for cleaner grammar and correct $line
2011-08-10 11:24:20 +02:00
nikic
818eb3940b
Allow to pass a string to the constructor of Node_Name
2011-08-09 15:23:18 +02:00
nikic
f67ff50550
Give all Scalar nodes and the special nodes Name and Variable specialized constructors for easier use
2011-08-09 15:07:05 +02:00
nikic
800bb9d94a
Remove unused files
2011-08-09 14:24:26 +02:00
nikic
ae46aeda7f
Don't save whether a string is binary anymore. The binary flag isn't going to be used in the next couple of years, so it doesn't make sense to unnecessarily complicate things.
2011-08-09 14:19:44 +02:00
nikic
197b8e6967
Don't save quote type for strings anymore (as it is irrelevant for script execution)
2011-08-09 14:12:15 +02:00
nikic
567f7c3536
Add possibility to delete and merge nodes in traverser
2011-08-09 12:32:18 +02:00
nikic
f00701fd8a
Use classes for visitors
2011-08-09 09:28:58 +02:00
nikic
ffecbf8ca5
Let the pretty printing methods for statements decide for themselves whether or not they add a semicolon. Only automatically add semicolons for expressions.
2011-08-04 18:44:21 +02:00
nikic
684a638f46
Add possibility to pretty print expressions to PrettyPrinter
2011-08-04 18:19:45 +02:00
nikic
29bac2a120
Further Name node methods
2011-08-04 16:30:04 +02:00
nikic
664be2871a
Make the resolve type of a name a normal subnode (type)
2011-08-04 13:59:56 +02:00
nikic
9c53838b1f
Properly handle fully qualified and relative names
2011-08-04 13:53:23 +02:00
nikic
2703f42933
If the short alias syntax is used compute the alias instead of setting it to null
2011-08-04 12:58:12 +02:00
nikic
12e61cb3ea
Allow use of normal dollar variables in .pre.phpy (by transforming them to #hash variables for kmyacc)
2011-08-04 12:16:31 +02:00
nikic
eaa9e62900
Add checks against use of self / parent class names and static constructors
2011-08-04 12:03:34 +02:00
nikic
217280c9ba
Add getLast and toString (and __toString) methods to Node_Name
2011-08-04 12:02:14 +02:00
nikic
dd2404b57a
Rename "ns" to "name" in Stmt_UseUse
2011-08-04 12:01:03 +02:00
nikic
962c4dc0f0
Add some more unit tests
2011-07-13 23:07:05 +02:00