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

1033 Commits

Author SHA1 Message Date
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
8d218110db Fix some doc comments 2012-09-07 23:41:54 +02:00
nikic
a590937fdf Merge pull request #33 from hakre/patch-1
Change to SPDX License Identifier (BSD-3-Clause) for composer
2012-08-07 09:40:19 -07:00
hakre
84b23a3eb5 Change to SPDX License Identifier (BSD-3-Clause) for composer
The composer validate command is now supporting SPDX license identifers.
2012-08-07 18:51:11 +03: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
a81cccff7f Release PHP-Parser 0.9.2 2012-07-07 22:23:25 +02:00
nikic
e90c8f17db Add installation instructions for different methods 2012-07-07 21:34:06 +02:00
nikic
25a7b2cbb9 Add note about xdebug.max_nesting_level 2012-07-07 16:43:23 +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
nikic
4972124468 Fix test failures due to precision differences
Travis 5.2 seems to have changed the float output precision, so a test was
failing. Now the numbers in the expected output are also provided by PHP,
so they should be the same.
2012-06-08 18:19:37 +02:00
nikic
44ed30957f Fix two tests which would fail on x64 2012-06-08 18:09:42 +02:00
nikic
35ec185558 Make $line argument for Comment optional
Also add setLine() method.
2012-06-08 17:55:35 +02:00
Jon Cave
0911b2e1ce Add line number information to comments
Line numbers are stored in the $line property of the PHPParser_Comment
and PHPParser_Comment_Doc classes and can be retrieved with getLine().
2012-06-06 14:33:38 +01:00
nikic
3f66b7ecac Update changelog 2012-05-12 14:15:24 +02:00
nikic
e16513a0eb Fix parsing of new expressions in parenthesis
The new dereferencing syntaxes (new Foo)->bar and (new Foo)['bar'] were
causing a shift/reduce conflict with the '(' expr ')' rule. When
(new Foo) was encountered (without dereference operators following) the
parser thus threw a parse error.

The fix simply adds a special '(' new_expr ')' rule to expr. This does not
remove the shift/reduce conflict itself, but makes it irrelevant.

This fixes issue #20.
2012-05-12 14:11:10 +02:00
nikic
25bbd69919 Improve some formatting 2012-05-12 00:09:53 +02:00
nikic
10fc22f518 Replace \N with .
Older PCRE versions (coming with PHP 5.2) don't support \N yet.
2012-05-11 20:38:05 +02:00
nikic
93392c82e0 Fix getAttribute signature in Node interface
This fixes a build failure on PHP 5.2.
2012-05-11 18:48:23 +02:00
nikic
dab2fd4b7a Fix comment reformatting on Linux
Remove the use of \R (with BSR_ANYCRLF) at two places, as it was causing
problems there.
2012-05-11 18:45:55 +02:00
nikic
cc4b8761e4 Update CHANGELOG 2012-05-11 17:58:59 +02:00
nikic
4f9dd7b1e2 Add more extensive Lexer component docs 2012-05-11 17:50:50 +02:00
nikic
107c7a262c Update docs 2012-05-11 16:44:13 +02:00
nikic
81e53ce0ff Insert comments when pretty printing
This changset also adds unit tests for Comments and adds a way to test the
pretty printer.
2012-05-11 16:18:14 +02:00
nikic
a824a2aba7 Fix $node->getDocComment()
getDocComment() now returns the last comment (given that it is a doc
comment). setDocComment() no longer exists, as it doesn't make sense
with the comment objects anymore. getAttribute() now returns by reference,
so it also works in reference contexts.
2012-05-06 18:24:26 +02:00
nikic
9d96dd1796 Adjust XML unserializer for new comments attribute 2012-05-06 18:12:02 +02:00
nikic
603582fe50 Add test coverage for two things 2012-05-06 17:58:31 +02:00
nikic
e587e3f4c6 Collect normal comments too, not only doc comments
Comments and doc comments are now saved in the 'comments' attribute, as an
array. The are instances of PHPParser_Comment[_Doc].
2012-05-06 17:49:04 +02:00
nikic
dd711f2a04 Generalize the attribute generation for nodes
Now two arrays are fetched from the lexer: $startAttributes and
$endAttributes. When constructing the attributes for a node, the
$startAttributes from the first token of the node and the $endAttributes
of the last token of the node are merged.

Now the end line is saved in the endLine attribute.
2012-05-05 17:34:27 +02:00
nikic
5438cc0d69 Add progress indicator for test_old.
I hate waiting for something without seeing at least *some* output.
2012-05-05 12:22:23 +02:00
nikic
101a6ddcfc Fix NameResolver to properly copy attributes 2012-05-04 10:18:50 +02:00
nikic
2f5ebf7c4d Store line and doc comment as attributes 2012-05-04 10:16:59 +02:00
nikic
c3cf3f29bd Adjust test_old to use new Lexer injection method 2012-05-04 10:16:52 +02:00
nikic
f66a672dd0 Start refactoring parser skeleton
The yacc parser skeleton with all those odd $yy short names is quite
non-obvious. This commits starts to refactor it a bit, to use more
obvious names and logic.
2012-05-04 10:16:49 +02:00
nikic
3701e02d32 Use inject-once approach for lexer
Now the lexer is injected only once when creating the parser. Instead of

    $parser = new PHPParser_Parser;
    $parser->parse(new PHPParser_Lexer($code));
    $parser->parse(new PHPParser_Lexer($code2));

you write:

    $parser = new PHPParser_Parser(new PHPParser_Lexer);
    $parser->parse($code);
    $parser->parse($code2);
2012-05-04 10:16:46 +02:00
nikic
271156f941 Fix typo 2012-05-04 10:16:44 +02:00
nikic
f33cd97a8d Merge pull request #22 from schmittjoh/resolveCatchType
fixes a bug where catch type was not resolved
2012-05-04 00:45:47 -07:00
nikic
3c2e68a354 Merge pull request #21 from ss23/patch-1
Update doc/1_Usage_of_basic_components.markdown
2012-05-04 00:44:47 -07:00
Johannes M. Schmitt
c2c7fdd13d fixes a bug were line number were lost 2012-05-03 23:58:47 -05:00
Johannes M. Schmitt
0dae07af6b fixes a bug where catch type was not resolved 2012-05-03 23:52:39 -05:00
Stephen Shkardoon
eb05d2b82d Update doc/1_Usage_of_basic_components.markdown 2012-05-04 15:33:48 +12:00
nikic
b1cc9ce676 Release version 0.9.1
This is in anticipation of doing some backwards compatability breaking
changes in the next version.
2012-04-24 00:52:11 +02:00
nikic
b42c9209c7 Fix PHP 5.2 build failure
lcfirst() isn't defined on PHP 5.2, so I added a fallback function, which
is defined in the bootstrap.php. Not sure whether that's the right place
to put it.
2012-04-23 22:17:06 +02:00
nikic
57249be44d Add changelog 2012-04-23 14:37:18 +02:00
nikic
db6b13378a Finish up code generation docs 2012-04-23 13:37:12 +02:00
nikic
9329c91591 Merge branch 'codeGeneration'
* codeGeneration:
  Add docs for templates
  Add a filesystem template loader.
  Add simple templating support.
  Add usage example for builders to docs
  Add function builder
  Add ability to specify arrays as default values
  Add property builder
  Add parameter builder
  Add method builder
  Add class builder
2012-04-23 13:32:16 +02:00
nikic
5b27fb40ce Fix line numbers for some list structures
When defining a list in the grammar the list elements have to get a separate
rule, otherwise they'll all be assigned the same line number.
2012-04-19 00:52:44 +02:00
nikic
e2a9745bf1 Make Serializer_XML::_serialize protected 2012-04-19 00:25:13 +02:00