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
Nikita Popov
818ef2e692
Make PrettyPrinter\Standard methods protected
...
I'm not sure how these ever ended up being public.
2016-07-25 14:27:03 +02:00
Nikita Popov
5f97b12576
Introduce explicit Finally node
2016-07-25 14:25:04 +02:00
Nikita Popov
1dea9111a2
NodeDumper: Resolve type for include/use as well
2016-07-25 14:04:04 +02:00
Nikita Popov
174e6c3cab
NodeDumper: Print modifiers as strings
2016-07-25 13:53:49 +02:00
Nikita Popov
eefcfeed23
Remove analyze.php
...
Has outlived its usefulness...
2016-07-25 13:38:05 +02:00
Nikita Popov
18129480ae
Rename $type subnode to $flags
...
Type makes it sound like a type-hint, and on a number of other nodes
$type is used for exactly that. Use $flags to hold modifiers instead.
2016-07-25 13:33:19 +02:00
Nikita Popov
1b1ff8995b
Update some PHP version numbers
2016-07-22 17:07:56 +02:00
Nikita Popov
867ae5148d
Bring Trait constructor in line with Class/interface
2016-07-22 17:01:51 +02:00
Nikita Popov
72e91845e4
Update changelog
2016-07-22 16:55:17 +02:00
Nikita Popov
537b59d4d1
PHP 7.1: Support multi-catch
...
Catch::$type is now an array Catch::$types.
2016-07-22 15:40:00 +02:00
Nikita Popov
7ff12b8fcb
Remove deprecated Comment methods
2016-07-09 22:00:39 +02:00
Nikita Popov
574665b45b
PHP 7.1: list() with keys
...
Expr\List will now contain ArrayItems instead of plain variables.
I'm reusing ArrayItem, because code handling list() must also handle
arrays, and this allows both to go through the same code path.
This also renames Expr\List->vars to ->items.
TODO: Should Expr\List be dropped in favor of Expr\Array with an
extra flag?
2016-07-09 21:55:55 +02:00
Nikita Popov
437890d386
PHP 7: Short destructuring syntax
...
Potentially the pretty printer should force use of [] in assignment
context, instead of relying on the existance of the right attribute.
2016-07-06 23:43:23 +02:00
Nikita Popov
1edf72c040
PHP 7: Support nullable types
...
Using a new NullableType node.
2016-07-06 18:36:18 +02:00
Nikita Popov
7a54aca468
Merge branch '2.x'
2016-07-06 02:21:57 +02:00
Nikita Popov
81f7da3b23
Fix computation of expected tokens in parse errors
2016-07-06 02:21:48 +02:00
Nikita Popov
5ea2a76d80
PHP 7.1: Class constant visibility support
2016-07-05 23:01:06 +02:00
Nikita Popov
5044fce1ff
PHP 7.1: Add void+iterable support
...
In PHP 7 mode, these will now be represented as strings 'void'
and 'iterable'.
2016-07-05 22:35:27 +02:00
Nikita Popov
038e11da4b
Remove support for PHP 5.4
2016-07-05 22:29:41 +02:00
Nikita Popov
225804c147
Targeting PHP-Parser 3.0
2016-07-05 22:24:52 +02:00
Nikita Popov
96cbd48df6
Improve error recovery quality
...
In particular, support recovering from a missing trailing semicolon,
while keeping the rest of the expression.
2016-04-20 16:47:50 +02:00
Nikita Popov
e45e31c218
Fix new.test and code test runner
...
Using only the basename leads to collisions...
2016-04-20 15:03:18 +02:00