Nikita Popov
2496cd38ad
Various docs fixes
2015-07-14 21:11:54 +02:00
Nikita Popov
ef9a154d09
Add support for unicode escape sequences
...
Only parsed if the PHP 7 parser is used.
2015-06-13 20:51:02 +02:00
Nikita Popov
0da72fad00
Support scalar type declarations
2015-06-13 20:16:09 +02:00
Nikita Popov
bc21514ecf
Move token constants into separate class
...
As these are shared between Php5 and Php7 parsers they should be
in some common place, otherwise we'd have to always reference either
one or the other.
2015-06-13 18:39:55 +02:00
Nikita Popov
61e060694d
Implement generalized yield operator
...
And split tokens.y off, so I don't waste time debugging this again...
2015-06-13 18:11:40 +02:00
Nikita Popov
602b9807eb
Import some UVS tests
2015-06-13 15:42:09 +02:00
Nikita Popov
d18dcc0c7f
Implement UVS
2015-06-13 14:59:24 +02:00
Nikita Popov
74c57eef0e
Test PHP 5 and PHP 7 parsers
...
At this point they should return the same result.
2015-06-13 13:56:45 +02:00
Nikita Popov
fdbddc4b8c
Add Multiple parser
2015-06-13 13:38:24 +02:00
Nikita Popov
ca3b44bf60
Fork separate PHP 7 parser
...
Also add ParserInterface
2015-06-13 13:09:34 +02:00
Nikita Popov
dca46febc9
Implement semi-reserved identifiers
2015-06-13 12:47:13 +02:00
Nikita Popov
1a1bd1448d
Support mixed group use declarations
2015-06-13 11:27:38 +02:00
Nikita Popov
9620f79cdc
Add partial group use support
...
Supported via Stmt\GroupUse which has Name $prefix in addition to
the usual.
Still missing: Mixed group uses.
2015-06-12 23:05:28 +02:00
Nikita Popov
a0e7d5e0aa
Set correct number of s/r conflicts
2015-05-02 22:51:38 +02:00
Nikita Popov
51ec2a25fe
Move parser to Parser\Php5
...
Old name still exists.
2015-05-02 22:50:11 +02:00
Nikita Popov
9d42e4a2e2
Drop short array simulation from .phpy syntax
...
Instead use real short array syntax.
2015-05-02 22:30:44 +02:00
Nikita Popov
23bf4f0c13
Add some error documentation
2015-04-30 21:58:45 +02:00
Nikita Popov
57ac7e39bf
Drop name magic from rebuildParser.php
...
Now using explicitly imported names, instead of magically
prepending Name\.
Also remove trailing whitespace from generated file.
2015-04-30 19:20:38 +02:00
Nikita Popov
3b7d8e8b5d
Enable basic error recovery
...
Adding only a single recovery rule for now.
The API is now:
* throwOnError parser option must be disabled.
* List of Errors is available through $parser->getErrors(). This
method is available either way.
* If no recovery is possible $parser->parse() will return null.
(Obviously only if throwOnError is disabled).
2015-04-30 17:41:57 +02:00
Nikita Popov
e1a0ec3724
Add support for anonymous classes
...
Has not landed upstream yet, but syntax is unlikely to change.
2015-04-26 23:04:31 +02:00
Nikita Popov
ab80054e97
Add support for "yield from"
2015-04-26 11:56:02 +02:00
Nikita Popov
a6d2cd69f8
Clarify attribute assignment code
...
* Don't assign to attribute stack on reduce - why was that there
in the first place?
* Assign attributes to the position in the stack where the first
token of the production is, instead of one position earlier.
* Add a comment to clarify why we also assign attributes on read,
instead of just on shift.
2015-04-26 11:56:01 +02:00
Nikita Popov
6996db1e3a
Build node attributes inside semantic action methods
...
Minor performance improvement for parsing, also allows to access
attributes with higher granulity in the parser, though this is not
currently done.
* #n can now be used to access the stack position of a token. $n
is the same as $this->semStack[#n]. (Post-translate $n will
actually be the stack position.)
* $attributeStack is now $this->startAttributeStack and
$endAttributes is now $this->endAttributes.
* Attributes for a node are now computed inside the individual
reduction methods, instead of being passed as a parameter.
Accessible through the attributes() macro.
2015-04-26 11:55:59 +02:00
Nikita Popov
7a40498cb4
Regenerate parser
...
Also drop the error() parser macro.
2015-04-19 18:12:56 +02:00
Nikita Popov
65f1adbe65
Merge primary error recovery code
...
The grammar does not yet actually implement error recovery.
2015-04-19 18:11:05 +02:00
Nikita Popov
8982315b4e
Rename Cast\Object as well
...
As it will very likely be soft-reserved in PHP 7.
Old alias is still available, as usual.
2015-03-21 18:57:55 +01:00
Nikita Popov
0f556c16f5
Fix a few more Scalar\String_ occurances
...
Totally forgot that the parser uses macros...
2015-03-21 18:54:52 +01:00
Nikita Popov
7ec277e1e1
Replace another Scalar\String occurance
...
Also canonicalize NameResover tests to avoid those pesky CRLF
issues.
2015-03-21 18:47:20 +01:00
Nikita Popov
1a627872f0
Rename nodes for compat with PHP 7
...
The old names will still be available on PHP 5.x.
2015-03-20 21:49:38 +01:00
Nikita Popov
251e689283
Add support for spaceship operator (<=>) [PHP 7]
...
Added as Expr\BinaryOp\Spaceship.
2015-03-12 23:13:31 +01:00
Nikita Popov
01f4be6b4d
Add support for null coalesce operator (??) [PHP 7]
...
Added as Expr\BinaryOp\Coalesce.
2015-03-12 22:45:56 +01:00
Nikita Popov
3ad0d4b310
Add support for return type declarations [PHP 7]
...
This adds an additional "returnType" subnode to Stmt\Function_,
Stmt\ClassMethod and Expr\Closure, as well as the corresponding
support in the name resolver and pretty printer.
2015-03-12 22:16:12 +01:00
Thomas Ruiz
73cace360d
Implicit public should not generate as explicit public
2015-03-08 20:21:01 +01:00
nikic
3e1665bbbd
Disallow new without a class name
...
Fixes #137 .
2014-09-28 12:41:35 +02:00
nikic
452e1c0180
Add constant dereferencing, a list-minute 5.6 change
2014-08-31 16:14:36 +02:00
nikic
ef121e690c
Preserve case of "static" class name
2014-08-11 21:44:50 +02:00
nikic
6d1f77132c
Move Stmt\Namespace_::postprocess() to parser
2014-04-21 12:30:55 +02:00
nikic
947a897238
Make names in the parser more descriptive
...
And improve the code a tad bit in general.
I left YY2TBLSTATES and YYNLSTATES around, because I don't fully
understand their role in the action double indexing.
2014-04-20 23:05:51 +02:00
nikic
1edbc89749
Use normal properties instead of static ones
2014-04-20 00:34:31 +02:00
nikic
0faa844a75
Separate parser code from generated data
2014-04-20 00:19:35 +02:00
nikic
4743e9b0b8
Update constant scalar expression support
2014-04-19 22:53:13 +02: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
8c59f41d02
Remove inline Name[] creations
...
This ensures that the attributes on the Name nodes are correct.
2014-03-22 14:24:33 +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
Martin Hasoň
d6eac28955
Fixed typo
2014-02-12 14:12:55 +01:00