Arne Blankerts
6fad8ff32a
Make NameResolver resolve trait alias and precedence names
2014-11-03 16:06:43 +01:00
nikic
66fd29cb58
Use stricter assertions where possible
2014-09-30 20:38:09 +02:00
nikic
69701430c1
Cover remaining constant scalar expressions
2014-09-28 13:05:23 +02:00
nikic
6dc24fa9f5
Fix coverage annotations
2014-09-28 12:49:12 +02:00
nikic
3e1665bbbd
Disallow new without a class name
...
Fixes #137 .
2014-09-28 12:41:35 +02:00
nikic
6423864160
Add Autoloader tests
2014-09-12 13:45:34 +02:00
nikic
fd064dac6c
Very that node type is valid in XML unserializer
2014-09-12 00:39:59 +02:00
nikic
d9bd550414
Fix XML unserializer
2014-09-12 00:37:21 +02:00
nikic
94eca2ce44
Remove deprecated Template and TemplateLoader
2014-09-12 00:25:30 +02:00
nikic
452e1c0180
Add constant dereferencing, a list-minute 5.6 change
2014-08-31 16:14:36 +02:00
nikic
6d0589d14f
Ensure that special class names are unqualified
...
Replicates the PHP error message
2014-08-11 22:04:52 +02:00
nikic
ef121e690c
Preserve case of "static" class name
2014-08-11 21:44:50 +02:00
Elliot Levin
c0340053d1
Fix case sensitivity for special class names
2014-08-11 21:41:54 +02:00
nikic
1f143393e5
Rewrite namespace handling code
...
Add a check for disallowed statements between braced namespaces
while at it.
2014-04-21 15:16:00 +02:00
nikic
4743e9b0b8
Update constant scalar expression support
2014-04-19 22:53:13 +02:00
nikic
91f6880734
Improve pretty printing of empty statement lists
...
The pStmts() method now also includes the leading \n, however only
if the statement list is non-empty.
2014-03-27 12:31:21 +01:00
nikic
a5e0bbcb62
Support use function/const in name resolver
2014-03-26 23:28:32 +01:00
nikic
3b7829b011
Add support for function and constant import (PHP 5.6)
2014-03-26 22:33:45 +01:00
nikic
bea89a0bf2
Add support for constant scalar expressions (PHP 5.6)
2014-03-26 21:48:12 +01:00
nikic
cda6f575f0
Add support for pow operator (PHP 5.6)
2014-03-26 19:18:16 +01:00
nikic
b5bcfa1168
Add support for argument unpacking (PHP 5.6)
2014-03-26 18:42:46 +01:00
nikic
96f1151ab2
Add support for variadic parameters (PHP 5.6)
2014-03-26 18:23:30 +01:00
nikic
f5be0d30f7
Guarantee that subnodes are always in the right order
2014-03-22 14:49:56 +01:00
Tomáš Polomský
c8c233f900
Correctly pretty print negative floats
2014-03-22 14:24:35 +01:00
nikic
70077039b4
Add Scalar\MagicConst->getName()
...
Return magic constant name, e.g. __CLASS__.
Resolves #95 .
2014-02-21 18:16:18 +01:00
nikic
1c8481bff6
Merge branch '0.9'
...
Conflicts:
lib/PhpParser/Lexer.php
lib/PhpParser/Node/Stmt/Class.php
lib/PhpParser/Node/Stmt/ClassMethod.php
lib/PhpParser/Node/Stmt/Interface.php
lib/PhpParser/Node/Stmt/Namespace.php
lib/PhpParser/Node/Stmt/UseUse.php
lib/PhpParser/Parser.php
2014-02-12 20:23:12 +01:00
Martin Hasoň
118f28344d
Synchronized error messages with native php error messages
2014-02-12 20:19:48 +01:00
nikic
f82862ec9c
Port library to use namespaces, with BC for old names
2014-02-06 20:29:35 +01:00
Jean-François Simon
7f4ab26732
Fix name resolver (class names are case insensitive)
2013-11-15 20:27:56 +01:00
Charles Sprayberry
700847e295
Add NodeTraverser::removeVisitor()
2013-09-28 13:21:30 +02:00
nikic
77c08a75c9
Fix pretty printing of include
expressions
2013-07-27 16:23:27 +02:00
Florent
12faad529e
Add interface builder
2013-05-23 15:14:58 +02:00
nikic
08f0cde6f9
Add prettyPrintFile() method
2013-04-15 20:53:23 +02:00
nikic
75ec7a3e78
Looks like I forgot to git add some files...
2013-02-14 21:49:08 +01:00
nikic
81d20bf10e
Pretty print namespaces in semicolon-style if possible
2013-01-15 18:21:42 +01:00
nikic
db18906dfc
Rename PrettyPrinter_Zend to PrettyPrinter_Default
2013-01-15 17:43:36 +01:00
nikic
fbaa1e5fc3
Add information on expected tokens to syntax errors
...
This now mimics the error messages provided by PHP itself (pre 5.4).
2013-01-15 17:30:14 +01:00
nikic
df17d62b40
Fix switch formatting
...
The switch cases were not indented and fall-through cases had an
unnecessary additional newline.
Patch by @pscheit (PR #39 ).
2012-10-31 17:46:48 +01:00
nikic
ac6f221c50
Better prededence and associativity handling in pretty printer
...
Previously the pretty printer added unnecessary and odd-looking parentheses
when several operators with the same precedence were chained:
'a' . 'b' . 'c' . 'd' . 'e'
// was printed as
'a' . ('b' . ('c' . ('d' . 'e')))
Another issue reported as part of #39 was that assignments inside closures
were wrapped in parentheses:
function() {
$a = $b;
}
// was printed as
function() {
($a = $b);
}
This was caused by the automatic precedence handling, which just regarded
the closure as an ordinal nested expression.
With the new system the $predenceMap of PrettyPrinterAbstract contains both
precedence and associativity and there is a new method pPrec() which prints
a node taking precedence and associativity into account.
For simpler usage there are additional function pInfixOp(), pPrefixOp() and
pPostfixOp().
Prints not going through pPrec() do not have any precedence handling (fixing
the closure issue).
2012-10-31 17:34:06 +01:00
nikic
9e43acee2c
Scalar_String::create() -> Scalar_String::parse()
...
Directly creating the node isn't necessary anymore, the token only needs
to be parsed. This makes it consistent with the other scalar parsing
methods and removes the need to pass $arguments around.
2012-10-19 15:17:08 +02:00
nikic
9d8e13b4a9
Fix Switch subnode order
...
Not that it makes much of a difference, but could have caused issues with
"out of order" visiting of nodes.
2012-10-19 14:54:56 +02:00
nikic
af5d288fb3
Add support for expressions in empty (PHP 5.5)
...
Apart from the grammar modifications this also renames the Empty subnode
from var to expr. This breaks BC.
2012-09-07 23:42:01 +02:00
nikic
f6c1ab6657
Adjust list and yield parsing, update prettyprinter
...
* nested list()s will now create nested List nodes (instead of just
nested arrays)
* yield $k => $v was parsed with key and value swapped. This is now fixed
* the pretty printer now works with the newly added language constructs
2012-09-07 23:41:59 +02:00
nikic
4259b44a84
Add support for constant dereferencing (PHP 5.5)
...
Examples: "foo"[2], [1, 2, 3][2]
2012-09-07 23:41:58 +02:00
nikic
417a8bb07e
Add support for yield expressions (PHP 5.5)
...
This adds a new Yield expression type, with subnodes key and value.
2012-09-07 23:41:57 +02:00
nikic
ae3774f0f2
Add support for finally clauses (PHP 5.5)
...
This adds a new finallyStmts subnode to the TryCatch node. If there is
no finally clause it will be null.
2012-09-07 23:41:56 +02:00
nikic
f8f1e17e41
Add support for list() in foreach (PHP 5.5)
...
Example: foreach ($coords as list($x, $y)) { ... }
This change slightly breaks backwards compatability, as it changes the
node structure for the previously existing `list(...) = $foo` assignments.
Those no longer have a dedicated `AssignList` node; instead they are
parsed as a normal `Assign` node with a `List` as `var`. Similarly the
use in `foreach` will generate a `List` for `valueVar`.
2012-09-07 23:41:55 +02:00
nikic
5a947e9843
Fix parsing of $foo =& new Bar;
...
By-reference assignments of new expressions are now parsed as AssignRef
(instead of just Assign).
Closes issue #31 .
2012-07-23 11:36:47 +02:00
nikic
eb5991227d
Add Class->getMethods() function
2012-07-07 16:24:07 +02:00
nikic
4137d7a7a8
Add modifier accessors for ClassMethod etc
2012-07-07 16:08:37 +02:00