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

156 Commits

Author SHA1 Message Date
Nikita Popov
6930feac43 Add some tests for pretty printing expressions 2015-01-18 19:57:09 +01:00
Nikita Popov
0a445c7656 Test lexer returning invalid token 2015-01-18 00:11:10 +01:00
Nikita Popov
9689763e20 Cover both DONT_TRAVERSE_CHILDREN cases 2015-01-18 00:10:01 +01:00
Nikita Popov
4071c4645d Add NodeTraverser::DONT_TRAVERSE_CHILDREN support 2015-01-11 22:13:58 +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
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
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
2438848487 Add support for doc comments in builders 2014-12-13 13:44:40 +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
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
7fbdb79a08 Fix whitespace when printing trait alias modifiers 2014-11-03 16:16:15 +01:00
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