Commit Graph

540 Commits

Author SHA1 Message Date
Nikita Popov
db3dafd64d Merge branch '1.x' 2015-06-05 18:57:04 +02:00
Suralc
bb2c5303ae Add a FunctionLike interface to Methods, Functions and Closures.
The elements listed above share common elements like parameters, possible return types and bodies.
2015-06-05 18:56:25 +02:00
Nikita Popov
5038dcc251 Merge branch '1.x' 2015-05-03 19:12:09 +02:00
David Prévot
69c00ebbe4 Make help output help2man-friendly
These changes follow regular advices for CLI output and allow help2man
to produce a meaningful manpage out of it.
2015-05-03 19:11:04 +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
5d1e3be7d4 Anonymize some callbacks 2015-05-02 22:35:15 +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
cc75dd3612 Drop support for PHP 7 aliases 2015-05-02 22:21:12 +02:00
Nikita Popov
5f621c5adc Drop support for legacy aliases from v0.9 2015-05-02 22:19:25 +02:00
Nikita Popov
29b9015f51 Drop support for old Node format 2015-05-02 22:17:34 +02:00
Nikita Popov
e6619f5514 Drop 5.4 support from emulative lexer 2015-05-02 22:13:55 +02:00
Nikita Popov
6b4a17b3e0 Set version to 2.0-dev. Drop PHP 5.3 support 2015-05-02 22:08:03 +02:00
Nikita Popov
30abe062f2 Update documentation link 2015-05-02 22:03:33 +02:00
Nikita Popov
dff239267f Release PHP-Parser 1.3.0 2015-05-02 17:40:40 +02:00
Nikita Popov
8b64195cf2 Try .17G print if .16G is not enough
This should be enough for all cases, because: A double has 53 bits
of mantissa (including the implicit 1 bit), which is 53*ln(2)/ln(10)
= 15.95 decimal digits. However the leading decimal digit may encode
less than the usual 3.32 bits, which will push this over the edge to
requiring 17 decimal digits.
2015-05-02 11:48:55 +02:00
Nikita Popov
9caa51b3a5 Add some more tests 2015-05-01 20:18:04 +02:00
Nikita Popov
5513073a53 Drop Lexer::getPosition()
This was a leftover from the original column info implementation.
2015-05-01 20:18:01 +02:00
Nikita Popov
659d26c231 Update changelog, fix typos 2015-05-01 19:57:10 +02:00
Nikita Popov
648800f07f Increase float pretty printing precision
This removes the reliance on the "precision" ini setting.
Furthermore the default of precision=14 is not sufficient.
2015-05-01 19:15:33 +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
272ab6c8d8 Add some recovery tests 2015-04-30 19:02:51 +02:00
Nikita Popov
0731b47655 Don't distinguish test-fail / test
With error recovery this is fluid. Using .test for everything.
2015-04-30 17:45:36 +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
a35c2a2067 Add column info to EOF errors
EOF errors are now located one past the end of the file.
2015-04-27 15:37:41 +02:00
Nikita Popov
55b2ead967 Make special class name checks case insensitive 2015-04-26 23:13:27 +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
66896dbde6 Poison attribute initializations in parser
Those should error if they end up being used.
2015-04-26 22:32:18 +02:00
Nikita Popov
338bc1f8e7 Fix "print" pretty-printing
Precedence was previously ignored.
2015-04-26 11:56:04 +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
e30c3ac01b Merge pull request #195 from GrahamCampbell/patch-1
Bump version to 1.3
2015-04-19 20:52:51 +02:00
Graham Campbell
a5477a4eaf Version bump 2015-04-19 17:57:38 +01: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
c8454271e1 Make column info 1-based 2015-04-18 21:20:45 +02:00
Nikita Popov
62f83a0dc2 Add column info for non-syntax errors where relatively precise
Should it also be added if only rough information is available? E.g.
spanning an entire class?
2015-04-18 13:27:58 +02:00
Nikita Popov
611fa5c7f1 Test parser position information (syntax errors) 2015-04-18 13:27:57 +02:00
Nikita Popov
4defbc2174 Make Error column info attribute based 2015-04-18 12:51:26 +02:00
Gerrit Addiks
33a39fae06 added column-numbers to syntax errors 2015-04-18 10:14:49 +02:00
Nikita Popov
e4eab9ec0c Simplify code
The new class couldn't already exist at that point - if it did, the
old name would have been aliased already and the autoloader wouldn't
trigger.
2015-04-03 22:30:30 +02:00
Nikita Popov
6aaa87f143 Fix PHP 7 alias registration
This fixes the case where the old name is used before the new one
is ever used, e.g. when manually constructing nodes, as opposed to
parsing them.

The previous approach would try to register the alias from OLD to
NEW. This would trigger autoloading on NEW and afterwards it would
register the alias from OLD to NEW. Afterwards the alias registration
which originally triggered the autoload would run, thus redeclaring
the class.

TL;DR aliases suck, closes #192.
2015-04-03 22:22:39 +02:00
Nikita Popov
08f97eb4ef Release PHP-Parser 1.2.2 2015-04-03 16:33:59 +02:00
Markus Malkusch
8d18848fb0 Don't set unserialize_callback_func in Autoloader::register() as it has side effects even when the library is not used 2015-04-03 16:25:33 +02:00
Nikita Popov
805078e0a9 Add missing type hints 2015-03-28 18:14:24 +01:00
Nikita Popov
52dafafd10 Resolve param type hints earlier
For convenience of concurrent visitors that want to perform
enterNode actions based on Stmt\Function_ etc.

Fixes #188.
2015-03-25 20:57:39 +01:00
Nikita Popov
dba7524b37 Release PHP-Parser 1.2.1 2015-03-24 20:10:28 +01:00
Nikita Popov
617bf0aa41 Fix registering of PHP 7 aliases
The previous approach was causing issues, because "instanceof"
does not invoke the autoloader.
2015-03-24 20:04:50 +01:00