summaryrefslogtreecommitdiff
path: root/Zend/zend_language_parser.y
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-5.4' into PHP-5.5Dmitry Stogov2013-01-091-2/+2
|\ | | | | | | | | * PHP-5.4: Fixed compilator bug that might cause jump depended on unitialized value
| * Merge branch 'PHP-5.3' into PHP-5.4Dmitry Stogov2013-01-091-2/+2
| |\ | | | | | | | | | | | | * PHP-5.3: Fixed compilator bug that might cause jump depended on unitialized value
| | * Fixed compilator bug that might cause jump depended on unitialized valueDmitry Stogov2013-01-091-2/+2
| | |
| | * Happy New YearXinchen Hui2013-01-011-1/+1
| | |
| | * - Year++Felipe Pena2012-01-011-1/+1
| | |
| | * - Avoid zend_do_ticks() call for each statement in parsingFelipe Pena2011-06-121-3/+3
| | |
| | * - Year++Felipe Pena2011-01-011-1/+1
| | |
| * | Happy New YearXinchen Hui2013-01-011-1/+1
| | |
* | | Happy New YearXinchen Hui2013-01-011-1/+1
| | |
* | | Merge branch 'PHP-5.4' into PHP-5.5Dmitry Stogov2012-12-251-7/+7
|\ \ \ | |/ / | | | | | | | | | * PHP-5.4: Traits refactoring
| * | Traits refactoringDmitry Stogov2012-12-251-7/+7
| | |
* | | Add missing zend_do_free callNikita Popov2012-12-191-1/+1
| | | | | | | | | | | | | | | This is a followup to d53f1bf8ab. When the yield *statement* is used its return value still needs to be freed.
* | | Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-261-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: Zend/zend_language_parser.y Zend/zend_vm_execute.skl
| * | | Support list in foreachXinchen Hui2012-08-251-2/+2
| | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/foreachlist
* | | | Remove implementation stubs for yield delegationNikita Popov2012-08-251-3/+0
| | | | | | | | | | | | | | | | | | | | I decided to leave out yield delegation for an initial proposal, so remove the stubs for it too.
* | | | Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-201-11/+11
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging master to fix Windows build Conflicts: Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_vm_def.h
| * | | Merge branch 'pull-request/31'Stanislav Malyshev2012-08-191-3/+3
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * pull-request/31: Fix lexing of nested heredoc strings in token_get_all()
| | * | | Fix lexing of nested heredoc strings in token_get_all()Nikita Popov2012-03-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #60097. Before two global variables CG(heredoc) and CG(heredoc_len) were used to track the current heredoc label. In order to support nested heredoc strings the *previous* heredoc label was assigned as the token value of T_START_HEREDOC and the language_parser.y assigned that to CG(heredoc). This created a dependency of the lexer on the parser. Thus the token_get_all() function, which accesses the lexer directly without also running the parser, was not able to tokenize nested heredoc strings (and leaked memory). Same applies for the source-code highlighting functions. The new approach is to maintain a heredoc_label_stack in the lexer, which contains all active heredoc labels. As it is no longer required, T_START_HEREDOC and T_END_HEREDOC now don't carry a token value anymore. In order to make the work with zend_ptr_stack in this context more convenient I added a new function zend_ptr_stack_top(), which retrieves the top element of the stack (similar to zend_stack_top()).
| * | | | Add functions declarations, use tabsXinchen Hui2012-08-141-8/+8
| | | | |
* | | | | Merge remote-tracking branch 'php-src/master' into addGeneratorsSupportNikita Popov2012-08-131-11/+25
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just an intial merge. It does not yet make generators and finally work together. Conflicts: Zend/zend_language_scanner.c Zend/zend_language_scanner_defs.h Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_execute.skl Zend/zend_vm_opcodes.h
| * | | | Implemented 'finally' keywords for phpXinchen Hui2012-08-131-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/finally FR: https://bugs.php.net/bug.php?id=32100 and I have got some improvment ideas(performance), will implemented later. thanks
| * | | | Fixed invalid read in CONST_STRING dereference, reported by NikicXinchen Hui2012-07-261-1/+1
| | | | |
| * | | | Merge branch 'PHP-5.4'Xinchen Hui2012-06-261-1/+1
| |\ \ \ \ | | | |/ / | | |/| | | | | | | | | | | | * PHP-5.4: Fixed bug #62357 (compile failure: (S) Arguments missing for built-in function __memcmp).
| | * | | Fixed bug #62357 (compile failure: (S) Arguments missing for built-in ↵Xinchen Hui2012-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function __memcmp). Any C library function may be a macro, We should avoid using ZEND_STRS(L) as their arguments
| | * | | Improved traits implementation. Now to support __CLASS__ constant in traits ↵Dmitry Stogov2012-01-171-1/+2
| | | | | | | | | | | | | | | | | | | | php doesn't have to copy the complete compiled method, but can reuse the same code. The resolution of __CLASS__ constants in methods defined in traits are delayed till run-time. This approach also made possible to use __CLASS__ constant as default value for traits properties and method arguments.
| | * | | - Year++Felipe Pena2012-01-011-1/+1
| | | | |
| | * | | - Added class member access on instantiation (e.g. (new foo)->bar()) supportFelipe Pena2011-11-061-2/+29
| | | | |
| | * | | - Drop T_SCALAR_CASTFelipe Pena2011-08-161-1/+0
| | | | |
| | * | | Callable typehint following the rules of is_callable($arg, false);Hannes Magnusson2011-08-161-1/+3
| | | | |
| | * | | Added support for Class::{expr}() syntax (Pierrick)Dmitry Stogov2011-08-011-2/+2
| | | | |
| | * | | Added __TRAIT__ magic constant [TRAITS] [DOC]Stefan Marr2011-07-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # __TRAIT__ behaves like __CLASS__ more or less but is constraint to traits. # Since traits are not types, there are not many valid use cases, and trying # to use __TRAIT__ to make traits more like classes is discouraged.
| | * | | - add short array syntax as defined in ↵Pierre Joye2011-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | https://wiki.php.net/rfc/shortsyntaxforarrays, 2nd solution using => only
| | * | | - Changed zend_resolve_class_name() prototypeFelipe Pena2011-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | # No needed to pass fetch_type as pointer here
| | * | | - Fixed bug #55086 (Namespace alias does not work inside trait's use block)Felipe Pena2011-07-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | patch by: Pierrick
| | * | | - Fixed build on WindowsFelipe Pena2011-06-241-4/+8
| | | | |
| | * | | - Improved parse error messagesFelipe Pena2011-06-231-74/+194
| | | | |
| | * | | - Avoid zend_do_ticks() call for each statement in parsingFelipe Pena2011-06-121-3/+3
| | | | |
| | * | | scalar types cleanupStanislav Malyshev2011-06-031-5/+3
| | | | |
| * | | | Allow arbitrary expressions for empty()Nikita Popov2012-05-131-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change is as per RFC https://wiki.php.net/rfc/empty_isset_exprs. The change allows passing the result of function calls and other expressions to the empty() language construct. This is accomplished by simply rewriting empty(expr) to !expr. The change does not affect the suppression of errors when using empty() on variables. empty($undefinedVar) will continue not to throw errors. When an expression is used inside empty() on the other hand, errors will not be suppressed. Thus empty($undefinedVar + $somethingElse) *will* throw a notice. The change also does not make empty() into a real function, so using 'empty' as a callback is still not possible. In addition to the empty() changes the commit adds nicer error messages when isset() is used on function call results or other expressions.
* | | | | Remove reference restrictions from foreachNikita Popov2012-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | foreach only allowed variables to be traversed by reference. This never really made sense because a) Expressions like array(&$a, &$b) can be meaningfully iterated by-ref b) Function calls can return by-ref (so they can also be meaningfully iterated) c) Iterators could at least in theory also be iterated by-ref (not sure if any iterator makes use of this) With by-ref generators the restriction makes even less sense, so I removed it altogether.
* | | | | Require parenthesis around yield expressionsNikita Popov2012-07-221-43/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If yield is used in an expression context parenthesis are now required. This ensures that the code is unambiguos. Yield statements can still be used without parenthesis (which should be the most common case). Also yield expressions without value can be used without parenthesis, too (this should be the most common case for coroutines). If the yield expression is used in a context where parenthesis are required anyway, no additional parenthesis have to be inserted. Examples: // Statements don't need parenthesis yield $foo; yield $foo => $bar; // Yield without value doesn't need parenthesis either $data = yield; // Parentheses don't have to be duplicated foo(yield $bar); if (yield $bar) { ... } // But we have to use parentheses here $foo = (yield $bar); This commit also fixes an issue with by-ref passing of $foo[0] like variables. They previously weren't properly fetched for write. Additionally this fixes valgrind warnings which were caused by access to uninitialized memory in zend_is_function_or_method_call().
* | | | | Remove asterix modifier (*) for generatorsNikita Popov2012-07-201-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generators are now automatically detected by the presence of a `yield` expression in their body. This removes the ZEND_SUSPEND_AND_RETURN_GENERATOR opcode. Instead additional checks for ZEND_ACC_GENERATOR are added to the fcall_common helper and zend_call_function. This also adds a new function zend_generator_create_zval, which handles the actual creation of the generator zval from an op array. I feel like I should deglobalize the zend_create_execute_data_from_op_array code a bit. It currently changes EG(current_execute_data) and EG(opline_ptr) which is somewhat confusing (given the name).
* | | | | Add sceleton for yield* expressionNikita Popov2012-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | This does not yet actually implement any delegation.
* | | | | Add support for yielding keysNikita Popov2012-05-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keys are yielded using the yield $key => $value syntax. Currently this is implemented as a statement only and not as an expression, because conflicts arise considering nesting and use in arrays: yield yield $a => $b; // could be either yield (yield $a) => $b; // or yield (yield $a => $b); Once I find some way to resolve these conflicts this should be available as an expression too. Also the key yielding code is rather copy-and-past-y for the value yielding code, so that should be factored out.
* | | | | Allow to use yield without valueNikita Popov2012-05-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the generator is used as a coroutine it often doesn't make sense to yield anything. In this case one can simply receive values using $value = yield; The yield here will simply yield NULL.
* | | | | Add support for $generator->send()Nikita Popov2012-05-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yield now is an expression and the return value is the value passed to $generator->send(). By default (i.e. if ->next() is called) the value is NULL. Unlike in Python ->send() can be run without priming the generator with a ->next() call first.
* | | | | Add zend_do_suspend_if_generator callsNikita Popov2012-05-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | The execution of generator functions will be suspended right after the arguments were RECVed. This will be done in zend_do_suspend_if_generator.
* | | | | Add flag for generator functionsNikita Popov2012-05-191-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generator functions have to specify the * (asterix) modifier after the function keyword. If they do so the ZEND_ACC_GENERATOR flag is added to the fn_flags.
* | | | | Add T_YIELD "yield" keywordNikita Popov2012-05-151-0/+2
|/ / / /
* | | | Implement const array/string dereferenceXinchen Hui2012-04-171-2/+11
| |/ / |/| | | | | | | | RFC:https://wiki.php.net/rfc/constdereference