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

469 Commits

Author SHA1 Message Date
Nikita Popov
a2d7e8977a Use real properties for storing subnodes
Instead of storing subnodes in a subNodes dictionary, they are
now stored as simple properties. This requires declarating the
properties, assigning them in the constructor, overriding
the getSubNodeNames() method and passing NULL to the first argument
of the NodeAbstract constructor.

[Deprecated: It's still possible to use the old mode of operation
for custom nodes by passing an array of subnodes to the constructor.]

The only behavior difference this should cause is that getSubNodeNames()
will always return the original subnode names and skip any additional
properties that were dynamically added. E.g. this means that the
"namespacedName" node added by the NameResolver visitor is not treated
as a subnode, but as a dynamic property instead.

This change improves performance and memory usage.
2015-03-09 08:54:20 +01:00
Thomas Ruiz
73cace360d Implicit public should not generate as explicit public 2015-03-08 20:21:01 +01:00
Nikita Popov
c96636d192 Revert "Create .gitattributes with basic export-ignores"
This reverts commit 0dd2b9a74c.

Not having tests available causes issues for downstream
distributors. See issue #178.
2015-03-08 19:38:13 +01:00
Nikita Popov
d56ff5a351 Fix lexer tests for HHVM
HHVM does not throw warnings from token_get_all()
for invalid chars and unterminated comments. This
is not really integral functionality, so I'm okay
to just skip it to get a passing HHVM build.
2015-02-26 19:19:40 +01:00
Nikita Popov
3028bc8081 And make it work on PHP 5 as well... 2015-02-26 16:40:21 +01:00
Nikita Popov
91295a0790 Make tests compatible with PHP 7
When parsing on PHP 7 we will no longer be able to deal with
code that contains invalid octal literals. Currently we'll fatal,
after engine exceptions land we'll throw an exception instead.
2015-02-26 16:26:29 +01:00
Nikita Popov
d600c60779 Add PHP 7 to travis build 2015-02-26 15:25:34 +01:00
Hugo Fonseca
e3bc5b564d Added php shebang 2015-02-24 21:43:12 +01:00
Nikita Popov
53eac36a3f Merge pull request #175 from staabm/patch-1
prevent a unnecessary concat
2015-02-13 18:03:18 +01:00
Markus Staab
ce5c76d79b prevent a unnecessary concat
analog to b7ffdbbb92
2015-02-13 16:02:54 +01:00
Nikita Popov
b7ffdbbb92 Optimize node dumper
For very deeply nested node trees this extra concatenation makes a
huge difference...
2015-02-13 15:20:25 +01:00
Nikita Popov
8f1eacdab7 Increase recommended xdebug.max_nesting_level
Looks like 2000 is not quite enough for some cases...
2015-02-13 15:04:00 +01:00
Tom Rochette
1366e833a1 Move getMethods() to new ClassLike node
Class_, Interface_ and Trait_ extend the ClassLike node, which
provides the getMethods() method.
2015-01-31 22:59:38 +01:00
Nikita Popov
6930feac43 Add some tests for pretty printing expressions 2015-01-18 19:57:09 +01:00
Nikita Popov
54275ad181 Merge pull request #167 from GrahamCampbell/patch-1
Fixed branch alias
2015-01-18 12:54:05 +01:00
Graham Campbell
21ca7eaf1b Fixed branch alias 2015-01-18 11:46:36 +00:00
Nikita Popov
a86779198f Fix branch alias (maybe?) 2015-01-18 12:41:16 +01:00
Nikita Popov
ac05ef6f95 Release PHP-Parser 1.1 2015-01-18 12:29:59 +01:00
Nikita Popov
74251fca9f Update changelog 2015-01-18 00:11:19 +01:00
Nikita Popov
0a445c7656 Test lexer returning invalid token 2015-01-18 00:11:10 +01:00
Nikita Popov
a710f32a6a Make Node\Expr\BinOp an abstract class
Only the children should be used ...
2015-01-18 00:10:02 +01:00
Nikita Popov
9689763e20 Cover both DONT_TRAVERSE_CHILDREN cases 2015-01-18 00:10:01 +01:00
Nikita Popov
1a63a915f2 Merge pull request #163 from rmruano/gitattributes
Create .gitattributes with basic export-ignores
2015-01-11 22:34:05 +01:00
Nikita Popov
4071c4645d Add NodeTraverser::DONT_TRAVERSE_CHILDREN support 2015-01-11 22:13:58 +01:00
Nikita Popov
f56db26d8b Doc fixes 2015-01-11 21:39:02 +01:00
Rubén Moraleda
0dd2b9a74c Create .gitattributes with basic export-ignores 2015-01-09 21:19:19 +01:00
Nikita Popov
4cd2b95a23 Fix 5.3 build and some small cleanups 2014-12-19 18:54:56 +01:00
Nikita Popov
7ab88416ac Enforce Name|string for names in builders
While array (with name components) could technically be allowed (as
they are supported by the Name node itself), more likely than not
an array would due to incorrect usage of the API (e.g. array instead
of variadics).
2014-12-19 18:50:16 +01:00
Nikita Popov
ba625063e7 Support fully-qualified and ns-relative names in builders 2014-12-19 18:48:21 +01:00
Nikita Popov
b4b93ccb21 Add integration test for builders 2014-12-19 18:35:19 +01:00
Stepan Anchugov
01643e06d3 Add namespace builder 2014-12-19 18:19:33 +01:00
Nikita Popov
4387454fe0 Add trait builder (for completeness...) 2014-12-19 17:59:23 +01:00
Nikita Popov
55fdbc6dbc Extract common builder methods to abstract classes
Declaration for fns/classes in general and FunctionLike for
functions/methods in particular.
2014-12-19 17:47:51 +01:00
Nikita Popov
e69c9ee38c Fix attribute assigment test with crlf newlines 2014-12-19 17:28:22 +01:00
Nikita Popov
894c3f787d Add test for attribute assignment by parser
Weird that this wasn't tested yet...
2014-12-19 00:37:38 +01:00
Nikita Popov
a7797918b8 Update lexer docs for attribute options 2014-12-19 00:37:37 +01:00
Nikita Popov
46975107a7 Support token position attributes in lexer
Also change endFilePos semantics to refer to the last character that
is *included* in the token, rather than one past the last character.
This ensures that all end* attributes have the same semantics.
2014-12-19 00:37:36 +01:00
Nikita Popov
e0f3e8a492 Merge pull request #160 from jamiehannaford/patch-1
Fix apostrophe
2014-12-15 14:23:36 +01:00
Jamie Hannaford
158322e1e4 Fix apostrophe 2014-12-15 10:05:52 +00:00
Nikita Popov
2438848487 Add support for doc comments in builders 2014-12-13 13:44:40 +01:00
Stepan Anchugov
f5432a76b6 Add a a reference to PrettyPrinter to code generation doc
The `$prettyPrinter` variable was undefined in the doc.

Also, the PrettyPrinter was mentioned as `default`, but it's `Standard`, actually.
2014-12-13 13:06:36 +01:00
Nikita Popov
800d278369 Merge pull request #152 from Fullmetal5/master
Add line returns in php-parse help message
2014-11-27 21:30:29 +01:00
nikic
8507af6f4a Add missing require in tests
Test files aren't autoloaded, so this was order-dependent.
2014-11-27 21:01:56 +01:00
nikic
7c98ad6f9b Support file offsets in emulative lexer as well
Also run normal lexer tests against emulative lexer and fix a bug
in __halt_compiler() handling found as a result.
2014-11-27 20:57:38 +01:00
Máximo Cuadros Ortiz
d774dbc1b7 Add optional startFilePos and endFilePos attributes
The lexer can now optionally add startFilePos and endFilePos
attributes, which are offsets in to the lexed code string.

The end offset currently points one past the last character of
the token - this is pending further discussion.

The attributes are not added by default and have to be enabled
using the new 'usedAttributes' lexer option:

	$lexer = new Lexer([
		'usedAttributes' => [
			'comments', 'startLine', 'endLine',
			'startFilePos', 'endFilePos'
		]
	]);
2014-11-27 20:38:29 +01:00
Dexter Gerig
1a93cc3b9d Add line returns
Add line returns to the help message so that the terminal won't end up on the same line.
2014-11-25 19:03:35 -06:00
nikic
e26e63e9b0 Error on final or abstract properties 2014-11-13 20:25:52 +01:00
nikic
0f69f12b94 Use "public" visibility when not explicitly given
Fixes issue #143
2014-11-13 20:21:21 +01:00
nikic
a8ffc6fcfc Release PHP-Parser 1.0.2 2014-11-04 23:12:46 +01:00
nikic
7fbdb79a08 Fix whitespace when printing trait alias modifiers 2014-11-03 16:16:15 +01:00