Nikita Popov
71438559ae
Update docs
2016-10-29 13:37:47 +02:00
Nikita Popov
c0f0edf044
Mark Name::$parts as deprecated
2016-10-22 17:05:00 +02:00
Nikita Popov
fa7357b483
Represent empty Name::slice() using null
...
Instead of a Name([]) dummy value, that is invalid in other
contexts.
2016-10-22 17:02:38 +02:00
Nikita Popov
91cb82d3d2
Explicitly support Name copy construction
...
It already worked beforehand by accident ... make clear it's
actually supported.
2016-10-22 16:41:58 +02:00
Nikita Popov
7672b974ff
Remove Name::append() and Name::prepend()
2016-10-22 00:25:15 +02:00
Nikita Popov
8489364528
Update changelog and upgrading guide
2016-10-21 23:26:51 +02:00
Nikita Popov
0d0accfa9f
Add setDocComment() to Node interface
...
Previously it was only part of NodeAbstract.
2016-10-21 23:26:51 +02:00
Matthew Brown
623bad2c8b
Type encapsulated string parts specifically
2016-10-21 11:46:54 +02:00
Matthew Brown
f66cf8f0dd
$name can be null for PHP 7 anonymous classes
2016-10-21 11:46:14 +02:00
Nikita Popov
4e25f51581
Fix php-parse script
2016-10-16 22:19:33 +02:00
Nikita Popov
a46b309975
Move constants into NodeTraverser class
...
Not that the interface makes much sense anyway, but these are
implementation details of a specific traverser.
2016-10-16 22:13:09 +02:00
Nikita Popov
f99a96e0a2
Introduce ErrorHandler
...
Add ErrorHandler interface, as well as ErrorHandler\Throwing
and ErrorHandler\Collecting. The error handler is passed to
Parser::parse(). This supersedes the throwOnError option.
NameResolver now accepts an ErrorHandler in the ctor.
2016-10-16 22:12:46 +02:00
Nikita Popov
90834bff8e
Add namespacedName attribute on runtime-resolved names
...
The NameResolver now adds a namespacedName attribute on function/
const names which cannot be statically resolved.
2016-10-11 19:44:22 +02:00
Nikita Popov
a910f6a247
Remove $separator arg from Name::toString()
2016-10-09 12:45:15 +02:00
Nikita Popov
caa5c0cc76
Graceful handling for "special" errors
...
Nearly all special errors are now handled gracefully, i.e. the
parser will be able to continue after encountering them. In some
cases the associated error range has been improved using the new
end attribute stack.
To achieve this the error handling code has been moved out of the
node constructors and into special methods in the parser.
2016-10-09 12:38:18 +02:00
Nikita Popov
5e5cb86e83
Remove support for node cloning in traverser
2016-10-09 00:41:55 +02:00
Nikita Popov
2be7838fc6
Correctly assign attrs for encaps vars
2016-10-08 23:58:39 +02:00
Nikita Popov
f6eb341b15
Fix GroupUse prefix attribute assignment
2016-10-08 23:55:46 +02:00
Nikita Popov
b2fe43cf7a
Next try...
2016-09-30 21:06:48 +02:00
Nikita Popov
648a246be0
Next try to fix HHVM build
2016-09-30 20:57:21 +02:00
Nikita Popov
2e5ae28c39
Don't use deprecated getMock()
2016-09-30 20:42:19 +02:00
Nikita Popov
5025d75160
Try to fix HHVM build
2016-09-30 20:33:56 +02:00
Nikita Popov
c79ea6d1d3
Support recovery from lexer errors
...
Lexer::startLexing() no longer throws, instead errors can be fetched
using Lexer::getErrors().
Lexer errors now also contain full line and position information.
2016-09-30 20:23:36 +02:00
Nikita Popov
e926efd62e
Fix regex
2016-09-30 19:17:10 +02:00
Nikita Popov
17d1e738fa
Don't use ~__EMU sequences in emulative lexer
...
These were necessary back in the day when we had to emulate some
complex functionality such as nowdoc strings. Now we can simply
directly translate certain token sequences.
The motivation for this change is to avoid preprocessing of the source
code, which would complicate offset-aware error handling inside the
lexer as offsets would no longer be correct.
2016-09-30 19:10:16 +02:00
Nikita Popov
9e5d3bbe25
Remove Error::(get|set)RawLine()
...
These have been superseded by Error::(get|set)StartLine().
2016-09-30 18:30:01 +02:00
Nikita Popov
f3c7dc9d89
Add Error::getMessageWithColumnInfo()
2016-09-30 18:24:43 +02:00
Nikita Popov
c5e0c3d7e2
Catch lexer errors in throwOnError=0 mode
2016-09-30 13:49:34 +02:00
Nikita Popov
ea47b6e0d6
Add NodeAbstract::setDocComment()
2016-09-17 20:51:22 +02:00
Nikita Popov
9e1c535b1d
Update builder tests to use "flags" instead of "type"
2016-09-17 20:51:22 +02:00
Graham Campbell
cfd207cae5
Use phpunit 5 if we can rather than 4 ( #301 )
2016-09-16 17:41:21 +02:00
Nikita Popov
f5d334d9bf
Release PHP-Parser 3.0.0 beta 1
2016-09-16 14:18:19 +02:00
Nikita Popov
f03823cde5
Merge branch '2.x'
...
Conflicts:
CHANGELOG.md
2016-09-16 14:08:58 +02:00
Nikita Popov
4dd659edad
Release PHP-Parser 2.1.1
2016-09-16 14:04:44 +02:00
Nikita Popov
1ab24d26ee
Add support for PHP 7.1 types to builders
...
This adds support for void, iterable and nullable types.
2016-09-16 13:53:13 +02:00
Nikita Popov
a7120116b0
Merge branch '2.x'
2016-08-30 22:38:34 +02:00
Nikita Popov
83f34e7fa4
Retain comments on blocks on first inner statement
2016-08-30 22:37:51 +02:00
Nikita Popov
d0cfb98133
Merge branch '2.x'
...
Conflicts:
lib/PhpParser/Parser/Php7.php
2016-08-30 22:14:09 +02:00
Nikita Popov
13f7321def
Forbid "=& new" in PHP 7 mode
2016-08-30 22:12:01 +02:00
Nat Zimmermann
46495abb49
Fix typo in grammar/README.md
2016-08-11 16:17:08 +02:00
Nikita Popov
f7cb00d6d3
Add missing canonicalization in test
2016-07-25 21:02:53 +02:00
Nikita Popov
7dae6c7a6b
Implement JsonSerializable for Nodes and Comments
...
Exposes the properties and adds an additional nodeType property.
2016-07-25 20:59:09 +02:00
Nikita Popov
2b209aaaf0
Add error recovery mode to php-parse script
2016-07-25 17:40:18 +02:00
Nikita Popov
977cbab8e7
Decrement errorState when recovering from -> error
...
It's likely that an error after -> will trigger another one due to
missing semicolon without shifting a single token. We prevent an
immediate failure in this case by manually setting errorState to 2,
which will suppress the duplicate error message, but allow error
recovery.
2016-07-25 17:37:54 +02:00
Nikita Popov
09086fbe0a
Support partial parsing of $foo->
...
Introduce Error node for this purpose.
2016-07-25 17:03:58 +02:00
Nikita Popov
ec614c95dd
Add hasLeadingNewline attribute to InlineHTML
...
Use this attribute to not print an extra newline if the original
code did not have it.
2016-07-25 16:44:25 +02:00
Nikita Popov
21b18eb294
Release version 3.0.0 alpha 1
2016-07-25 15:16:35 +02:00
Nikita Popov
faa09884db
Add upgrading information
2016-07-25 15:09:21 +02:00
Nikita Popov
b740076ab1
Remove deprecated Name::set*() methods
2016-07-25 14:50:37 +02:00
Nikita Popov
c9fea2ef67
Extend Name::slice() to support negative length+offset
2016-07-25 14:47:24 +02:00