Commit Graph

495 Commits

Author SHA1 Message Date
Dmitry Stogov
4bd22cf1c1 Improved zend_string API (Francois Laupretre)
Squashed commit of the following:

commit d96eab8d79
Author: Francois Laupretre <francois@tekwire.net>
Date:   Fri Jun 26 01:23:31 2015 +0200

    Use the new 'ZSTR' macros in the rest of the code.

    Does not change anything to the generated code (thanks to compat macros) but cleaner.

commit b352643910
Author: Francois Laupretre <francois@tekwire.net>
Date:   Thu Jun 25 13:45:06 2015 +0200

    Improve zend_string API

    Add missing methods
2015-06-29 16:44:54 +03:00
Nikita Popov
a684e6adb2 Drop unnecessary %prec
Leftover from a previous implementation
2015-06-20 13:10:51 +02:00
Xinchen Hui
438d17e74e Even fake token better to be in upper case 2015-05-26 18:11:07 +08:00
Bob Weinand
31f3eeb0c5 Fix tokenizer test due to recent changes 2015-05-26 00:17:27 +02:00
Bob Weinand
69b54ba926 Also unreserve T_CLASS 2015-05-25 22:58:30 +02:00
Bob Weinand
36c3c47434 Set %expect to 0 in parser (Using %prec) 2015-05-25 20:26:57 +02:00
Bob Weinand
21ccdf6304 Rebuild scanner, add NEWS/UPGRADING 2015-05-25 19:00:08 +02:00
Márcio Almada
110759386e ext tokenizer port + cleanup unused lexer states
we basically added a mechanism to store the token stream during parsing
and exposed the entire parser stack on the tokenizer extension through
an opt in flag: token_get_all($src, TOKEN_PARSE).

this change allows easy future language enhancements regarding context
aware parsing & scanning without further maintance on the tokenizer
extension while solves known inconsistencies "parseless" tokenizer
extension has when it handles `__halt_compiler()` presence.
2015-04-30 03:03:29 -03:00
Márcio Almada
a75decd452 implement context sensitive language with lexical feedback
The implementation has no regression risks, has an even smaller footprint
compared to the previous attempt involving a pure lexical approach, is higly
predictable and higly configurable.

To turn a word semi-reserved you only need to edit the "SEMI_RESERVED" parser rule,
it's an inclusive list of all the words that should be matched as T_STRING on specific contexts.
Example:

```
method_modifiers function returns_ref indentifier '(' parameter_list ')' ...
```

instead of:

```
method_modifiers function returns_ref T_STRING '(' parameter_list ')' ...
```

TODO: port ext tokenizer
2015-04-30 03:03:29 -03:00
Nikita Popov
f2f890a256 More cleanup (mainly retab) 2015-04-26 15:54:30 +02:00
krakjoe
49608e0608 Rebase Joe's anon classes implementation 2015-04-26 15:04:22 +02:00
Bob Weinand
f3e124d58d Merge branch 'coroutineDelegation' of https://github.com/bwoebi/php-src 2015-04-14 17:58:58 +02:00
Nikita Popov
a8bf1c5d8f Throw ParseException from lexer
Primarily to avoid getting fatal errors from token_get_all().

Implemented using a magic E_ERROR token, which the lexer emits to
force a parser failure.
2015-04-02 16:31:17 +02:00
Xinchen Hui
eeb8eced9b Improved parser (make use_type reuseable) 2015-03-16 18:43:36 +08:00
Márcio Almada
22d6cc7c8c fix compilation warnings, rename batch_use to group_use 2015-03-08 12:50:57 -03:00
Márcio Almada
344fc25b12 require trailing T_NS_SEPARATOR #1005 2015-03-07 17:59:48 -03:00
Márcio Almada
fbde890ee2 allow non mixed use declarations, CC @nikic #1005
```
use function N\S { foo, bar, etc };
use const N\S { FOO, BAR, ETC };
```

Related tests:

```
make test -j4 TESTS="-m Zend/tests/ns_0{88..92}*.phpt"
```

All namespace tests:

```
make test -j4 TESTS="Zend/tests/ns_*.phpt"
```
2015-03-07 17:59:48 -03:00
Márcio Almada
275e7276c1 first implementation of batch use compilation 2015-03-07 17:59:48 -03:00
Bob Weinand
b4a142ab97 Added yield from operator 2015-03-07 00:28:12 +01:00
Nikita Popov
fcdb6e0811 WIP 2015-02-28 21:20:37 +01:00
Stanislav Malyshev
3551083c2c Merge branch 'pull-request/1007'
* pull-request/1007:
  Fix associativity to match Perl
  Blast off to space.
2015-02-18 08:48:17 +01:00
Márcio Almada
e9f99e3d71 Márcio Almada remove dead tokens: T_CHARACTER, T_BAD_CHARACTER. 2015-02-08 21:44:44 -03:00
Andrea Faulds
d8b7a4480b Fix associativity to match Perl 2015-01-29 17:56:09 +00:00
Andrea Faulds
797dee59cd Blast off to space. 2015-01-29 17:56:09 +00:00
Levi Morrison
c8576c5a46 Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Nikita Popov
4d3e4d3bf9 Remove assignment of new by reference 2015-01-26 21:00:22 +01:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Guilherme Blanco
d51fb69c01 Removed parsing support traits to have extends and implements. 2015-01-09 15:45:02 +01:00
Guilherme Blanco
f48c232740 Decoupled class declaration statement into more granular pieces. 2015-01-09 15:45:01 +01:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
bb66f385d0 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (37 commits)
  NEWS
  NEWS
  Fix bug #68601 buffer read overflow in gd_gif_in.c
  Fixed compilation warnings
  Removed unnecessary checks
  pcntl_signal_dispatch: Speed up by preventing system calls when unnecessary
  Merged PR #911.
  Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before.
  Updated NEWS
  Updated NEWS
  Updated NEWS
  Fix bug #68532: convert.base64-encode omits padding bytes
  Updated NEWS
  Updated NEWS
  Updated NEWS
  Fixed Bug #65576 (Constructor from trait conflicts with inherited constructor)
  Updated NEWS
  Updated NEWS
  Fix MySQLi tests
  Fixed gd test
  ...
2014-12-13 19:43:45 +01:00
Guilherme Blanco
094d409b3d Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before. 2014-12-12 17:29:54 +01:00
Dmitry Stogov
e087d3ac7f Merge branch 'master' into native-tls
* master: (23 commits)
  move the test to the right place
  fix TS build and C89 compat
  updated NEWS
  Fixed bug #68545 NULL pointer dereference in unserialize.c
  Updated NEWS
  Updated NEWS
  Updated NEWS
  NEWS
  Fix bug #68526 Implement POSIX Access Control List for UDS
  Improved basic zval copying primitives: ZVAL_COPY_VALUE(), ZVAL_COPY(), ZVAL_DUP()
  Wrap RETURN_VALUE_USED() with EXPECTED() or UNEXPECTED() macros according to more frequent usage patterns.
  Improved ASSIGN_<OP>, ASSIGN_DIM and UNSET_DIM
  drop dead/unused code
  simplified code
  Move ZVAL_DEREF() and make_real_object() into slow paths.
  Pass znode_op structure by value (it fits into one word) instead of pointer to structure.
  Move checks for references into slow paths.
  Improved ASSIGN_DIM and ASSIGN_OBJ
  Fixed typo
  Move checks for references into slow paths of handlers or helpers. Remove duplicate opcode handlers.
  ...
2014-12-10 23:24:11 +03:00
Nikita Popov
c6d0c55a23 Fix arrow operator precedence
I accidentially added => as the highest-precedence operator...
2014-12-07 23:00:48 +01:00
Anatol Belski
c6bad96f30 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits)
  NEWS
  add test for bug #68381
  Fixed bug #68381 Set FPM log level earlier during init
  proper dllexport
  move to size_t where zend_string is used internally
  fix some datatype mismatches
  return after the warning, to fix uninitialized salt usage
  fix datatype mismatches
  add missing type specifier
  fix datatype mismatches
  fix unsigned check
  "extern" shouldn't be used for definitions
  joined identical conditional blocks
  simplify fpm tests
  SEND_VAR_NO_REF optimization
  Add test for bug #68442
  Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode
  Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client
  Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments.
  Add new FPM test for IPv4/IPv6
  ...

Conflicts:
	win32/build/config.w32
2014-11-18 21:18:52 +01:00
Anatol Belski
cf581178e7 fix "inconsistent dll linkage" warning caused by bison
stdlib.h might not be always using _STDLIB_H, that will move bison
to redeclare the malloc/free prototypes.
2014-10-29 15:30:00 +01:00
Anatol Belski
d9d16d2e68 fix datatype mismatch warnings 2014-10-29 15:29:59 +01:00
Anatol Belski
c00424e427 bring back all the TSRMLS_FETCH() stuff
for better comparability with the mainstream
2014-10-15 09:37:55 +02:00
Anatol Belski
d624b0d5eb Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (26 commits)
  Micro optimization
  Drop unused INIT_STRING opcode
  Drop unused RAISE_ABSTRACT_ERROR opcode
  CT substitute unqualified true/false/null in namespaces
  Fix a couple compile warnings
  fix test filename
  one more test to illustrate transfer of an arbitrary data amount throug pipes
  fix tests on linux
  better test cleanup
  Use more readable inline functions
  increase the polling period to not to break existing behaviours
  updated NEWS
  Fixed bug #51800 proc_open on Windows hangs forever
  Fixed segfault
  Set an LDAP error code when failing ldap_bind due to null bytes
  Fix segmentation fault in debug_backtrace()
  Drop support for GMP 4.1
  Make gmp_setbit and gmp_clrbit return values consistent
  removed *.dsw and *.dsp files
  Opcache compatibility for coalesce operator
  ...
2014-10-01 01:33:46 +02:00
Anatol Belski
06d0230a0f cleanup TSRMLS_FETCH 2014-09-26 09:58:19 +02:00
Anatol Belski
d11734b4b0 reworked the patch, less new stuff but worky
TLS is already used in TSRM, the way exporting the tsrm cache through
a thread local variable is not portable. Additionally, the current
patch suffers from bugs which are hard to find, but prevent it to
be worky with apache. What is done here is mainly uses the idea
from the RFC patch, but

- __thread variable is removed
- offset math and declarations are removed
- extra macros and definitions are removed

What is done merely is

- use an inline function to access the tsrm cache. The function uses
  the portable tsrm_tls_get macro which is cheap
- all the TSRM_* macros are set to placebo. Thus this opens the way
  remove them later

Except that, the logic is old. TSRMLS_FETCH will have to be done once
per thread, then tsrm_get_ls_cache() can be used. Things seeming to be
worky are cli, cli server and apache. I also tried to enable bz2
shared and it has worked out of the box. The change is yet minimal
diffing to the current master bus is a worky start, IMHO. Though will
have to recheck the other previously done SAPIs - embed and cgi.

The offsets can be added to the tsrm_resource_type struct, then
it'll not be needed to declare them in the userspace. Even the
"done" member type can be changed to int16 or smaller, then adding
the offset as int16 will not change the struct size. As well on the
todo might be removing the hashed storage, thread_id != thread_id and
linked list logic in favour of the explicit TLS operations.
2014-09-25 18:48:27 +02:00
krakjoe
b3aebda9ea native tls initial patch 2014-09-20 20:22:14 +01:00
Nikita Popov
69e7c9d89c Initial coalesce operator implementation 2014-09-16 19:14:46 +01:00
Nikita Popov
545fd5168e Don't distinguish between ast/list in parser
This removes the need to use $<ast>{n} or $<list>$ casts in the
reduction actions.

Keeping the distinction in the parser doesn't really give us any
benefit and only makes changing the grammar harder.
2014-08-29 21:02:10 +02:00
Nikita Popov
25d57aace3 Introduce optional_expr 2014-08-29 18:51:58 +02:00
Nikita Popov
c6a5c3c6c5 Remove parenthesis_expr
This was necessary previously to handle yields, now it only clutters
up the grammar.
2014-08-29 18:46:46 +02:00
Nikita Popov
7722d2c584 Simplify argument production 2014-08-29 18:42:05 +02:00
Nikita Popov
f3b629c982 Move =&new deprecation message into compiler 2014-08-26 23:36:53 +02:00
Nikita Popov
f8abb9a462 Handle remaining magic constants in parser as well
As far as I can see the !filename case cannot occur, so I dropped
it.
2014-08-26 23:36:52 +02:00