Commit Graph

451 Commits

Author SHA1 Message Date
Nikita Popov
e6e8867550 Fix class name resolution in traits 2014-07-19 23:36:01 +02:00
Nikita Popov
86f1004c4e Improve class name handling 2014-07-19 23:30:07 +02:00
Nikita Popov
291bcfe4f1 Port trait uses 2014-07-19 22:39:01 +02:00
Nikita Popov
fd7387a761 Handle class const doc comment
Property doc comments not yet handled
2014-07-19 15:20:35 +02:00
Nikita Popov
222430d99c Port class const decl 2014-07-19 15:13:50 +02:00
Nikita Popov
43d6e599cf Port property declarations 2014-07-19 14:54:56 +02:00
Nikita Popov
547331d24d Port methods
The duplicated magic method checks are ugly
2014-07-19 12:52:44 +02:00
Nikita Popov
adbddf4e5b Support static closures 2014-07-18 15:47:46 +02:00
Nikita Popov
405b97e8a9 Handle function doc comments 2014-07-18 15:23:16 +02:00
Nikita Popov
cdcf78f730 Fix lexer/compiler interdependency 2014-07-18 15:05:31 +02:00
Nikita Popov
359f99fe48 Use dedicated func_decl ast node
Functions need a bunch of extra info, that becomes inconvenient
to handle using the normal ast structure.
2014-07-18 14:57:00 +02:00
Nikita Popov
ae5ba9abfb Port closures 2014-07-18 12:58:24 +02:00
Nikita Popov
abfc8bd894 Port closure use 2014-07-18 12:30:39 +02:00
Nikita Popov
64a7132185 Port __METHOD__ 2014-07-16 23:23:25 +02:00
Nikita Popov
a75921dcb1 Port __FUNCTION__ to AST 2014-07-16 23:10:16 +02:00
Nikita Popov
f589713cc4 Preliminary function decl support
Problem: __FUNCTION__ etc don't work anymore, due to lexer/parser
interdependency.
2014-07-16 00:07:09 +02:00
Nikita Popov
1ee3277aba Port parameter defs
Has one bug re \self
2014-07-14 23:03:53 +02:00
Nikita Popov
47f0717a69 Rename params -> args 2014-07-13 13:11:55 +02:00
Nikita Popov
c58079b4fd Port static vars
Need to figure out the constant expr stuff
2014-07-12 17:00:53 +02:00
Nikita Popov
e367e68111 Port try/catch
Down to 50 failing Zend tests
2014-07-12 13:50:58 +02:00
Nikita Popov
32ca08f249 Fix leak 2014-07-11 15:33:39 +02:00
Nikita Popov
dde9faee2e Port switch 2014-07-11 15:31:47 +02:00
Nikita Popov
f12c1482a3 Port foreach 2014-07-11 12:16:21 +02:00
Nikita Popov
7f151465b2 Make inner_statement_list asty 2014-07-10 23:04:42 +02:00
Nikita Popov
4215969904 Port if (partial) 2014-07-10 16:38:04 +02:00
Nikita Popov
3be63fca48 Port for 2014-07-10 15:51:47 +02:00
Nikita Popov
80c44ad510 Support creating of ast nodes with >3 children 2014-07-10 15:18:08 +02:00
Nikita Popov
1738ee7e5a Port do/while 2014-07-10 14:46:22 +02:00
Nikita Popov
c7656c06cc Port while
Note: From here on everything is broken
2014-07-10 14:35:59 +02:00
Nikita Popov
68777b72b2 Expr stmts go through ast 2014-07-10 00:04:27 +02:00
Nikita Popov
1de1bc96a5 Make statement asty 2014-07-10 00:00:48 +02:00
Nikita Popov
117714d122 Port goto label 2014-07-09 23:46:22 +02:00
Nikita Popov
d14b763bb9 Make unticked_statement an ast node (usually NULL) 2014-07-09 23:39:21 +02:00
Nikita Popov
fc541418f2 Port goto 2014-07-09 23:11:32 +02:00
Nikita Popov
cc8a6fa91e Port break/continue 2014-07-09 23:05:21 +02:00
Nikita Popov
5bf0c28fe3 Port throw 2014-07-09 22:48:42 +02:00
Nikita Popov
289265402a Port echo 2014-07-07 21:14:14 +02:00
Nikita Popov
36c3cf3198 Port return statement 2014-07-07 21:06:02 +02:00
Nikita Popov
17c2d16d79 Refactor class name resolution as well 2014-07-04 23:45:20 +02:00
Nikita Popov
fdc318849a Shared name production for const / fn name 2014-07-04 23:08:05 +02:00
Nikita Popov
fb98dd31a0 Some refactoring of fn/const resolution 2014-06-28 22:27:06 +02:00
Nikita Popov
e198132542 Drop addition of weird \ prefix for FQ consts
Also fixes a resolution bug
2014-06-28 18:24:59 +02:00
Nikita Popov
111ad71d38 Rename ZEND_CONST to ZEND_AST_ZVAL 2014-06-28 18:03:26 +02:00
Nikita Popov
0e44f4c583 Remove obseleted grammar productions 2014-06-26 22:09:05 +02:00
Nikita Popov
dd60c8e0f1 Reuse expr for static_scalar 2014-06-26 22:02:54 +02:00
Nikita Popov
dd60b9bb91 Handle ::class in const expr via ast as well 2014-06-26 21:44:46 +02:00
Nikita Popov
080e8bffa5 Compile const refs to CONST 2014-06-26 16:56:50 +02:00
Nikita Popov
b83c70416b Compile class const refs to CONST zval 2014-06-26 16:35:30 +02:00
Nikita Popov
9c169d5a4d Remove static_scalar_base 2014-06-26 14:03:31 +02:00
Nikita Popov
31687ed5c7 Handle trait __CLASS__ in parser 2014-06-26 14:00:20 +02:00
Nikita Popov
7f01b6fcec Bring static scalar arrays in line 2014-06-26 13:20:39 +02:00
Nikita Popov
0237954778 Bring static scalar AST more in line with normal AST 2014-06-26 13:06:39 +02:00
Nikita Popov
1b84b87e78 Const eval unary pm (as previously) 2014-06-26 12:43:20 +02:00
Nikita Popov
508d146cd3 Move T_STRING_VARNAME handling 2014-06-21 20:11:31 +02:00
Nikita Popov
90d36554e2 Support string interpolation 2014-06-21 20:06:46 +02:00
Nikita Popov
b6789b1dd6 zend_ast_dynamic_ast returns new node 2014-06-21 19:31:08 +02:00
Nikita Popov
657762ee2b AST stage 2.4 2014-06-21 18:54:13 +02:00
Nikita Popov
232a922618 Support yield without parens
for now => is lowest-prec right-assoc
2014-06-19 13:48:49 +02:00
Nikita Popov
0ec49bba22 AST stage 1.9
Expressions (mostly) use the AST
2014-06-19 13:48:35 +02:00
Nikita Popov
258a733ed2 AST-based compiler: Stage 1 2014-06-14 15:22:18 +02:00
Nikita Popov
c8aa51f825 Accept static member fetch in new variable (BC) 2014-06-06 17:05:14 +02:00
Nikita Popov
e4e42df4e6 Allow only simple variables with global keyword 2014-06-04 17:15:16 +02:00
Nikita Popov
f4a11b66cc Merge and rename to member_name 2014-05-31 21:00:11 +02:00
Nikita Popov
8d7f5a403a Remove duplication 2014-05-31 20:58:44 +02:00
Nikita Popov
5c2120b6cf Forbid writing to temporary expressions 2014-05-31 19:41:39 +02:00
Nikita Popov
64e4c9eff1 Support directly calling closure 2014-05-31 17:18:37 +02:00
Nikita Popov
fd85f77857 Fix previous commit 2014-05-31 17:02:48 +02:00
Nikita Popov
64f80b3835 Introduce dereferencable_scalar to simplify future additions 2014-05-31 16:44:53 +02:00
Nikita Popov
f48241f734 Generalize static access syntax 2014-05-31 16:27:03 +02:00
Nikita Popov
ff475e9e76 Allow arrays + object access for new expressions 2014-05-31 00:37:03 +02:00
Nikita Popov
75c0db1119 Integrate combined scalar as dereferencable 2014-05-31 00:18:50 +02:00
Nikita Popov
46a2ca8324 Generalize expression dereferencing 2014-05-31 00:09:11 +02:00
Nikita Popov
5712f0e9bd Minor cleanup 2014-05-31 00:02:51 +02:00
Nikita Popov
87f8e758c8 Cleanup old grammar rules 2014-05-30 23:51:54 +02:00
Nikita Popov
295d07e373 Reintroduce new expression dereferencing 2014-05-30 23:44:30 +02:00
Nikita Popov
067fca0e89 Remove reference_variable indirection 2014-05-30 23:36:30 +02:00
Nikita Popov
e89958a634 Make function calls directly callable 2014-05-30 23:30:37 +02:00
Nikita Popov
667f8409c5 Recursive definition for object proprety fetches 2014-05-30 23:25:43 +02:00
Nikita Popov
a8c1595012 LTR static member access 2014-05-30 22:33:03 +02:00
Nikita Popov
b8b3b355be Use recursion for property fetches 2014-05-30 22:04:39 +02:00
Nikita Popov
46e35e3d5d Get rid of base_variable_with_function_calls 2014-05-30 21:14:18 +02:00
Nikita Popov
e2be2cee97 Temporarily disable complex variables in new expressions 2014-05-30 21:11:25 +02:00
Nikita Popov
95a3a12657 Change precedence of $ operator
$$foo['bar'] is now interpreted as ${$foo}['bar'] rather than
${$foo['bar']}.
2014-05-30 16:31:10 +02:00
Dmitry Stogov
0c6a6f0fba Re-applyed Bob's patch with minor fixes 2014-05-07 15:03:56 +04:00
Dmitry Stogov
4ecc527976 Reverted Bob's patch (it breaks many tests when run with opcache and needs to be fixed first). 2014-05-07 03:26:13 +04:00
Bob Weinand
f3c1881f1d Re-added fix for bug #66015 and adapted for phpng branch 2014-05-06 14:59:03 +02:00
Dmitry Stogov
17d027ed47 Split IS_BOOL into IS_FALSE and IS_TRUE 2014-04-30 18:32:42 +04:00
Dmitry Stogov
f9927a6c97 Merge mainstream 'master' branch into refactoring
During merge I had to revert:
	Nikita's patch for php_splice() (it probably needs to be applyed again)
	Bob Weinand's patches related to constant expression handling (we need to review them carefully)
	I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)

Conflicts:
	Zend/zend.h
	Zend/zend_API.c
	Zend/zend_ast.c
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_constants.c
	Zend/zend_exceptions.c
	Zend/zend_execute.c
	Zend/zend_execute.h
	Zend/zend_execute_API.c
	Zend/zend_hash.c
	Zend/zend_highlight.c
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner_defs.h
	Zend/zend_variables.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
	ext/date/php_date.c
	ext/dom/documenttype.c
	ext/hash/hash.c
	ext/iconv/iconv.c
	ext/mbstring/tests/zend_multibyte-10.phpt
	ext/mbstring/tests/zend_multibyte-11.phpt
	ext/mbstring/tests/zend_multibyte-12.phpt
	ext/mysql/php_mysql.c
	ext/mysqli/mysqli.c
	ext/mysqlnd/mysqlnd_reverse_api.c
	ext/mysqlnd/php_mysqlnd.c
	ext/opcache/ZendAccelerator.c
	ext/opcache/zend_accelerator_util_funcs.c
	ext/opcache/zend_persist.c
	ext/opcache/zend_persist_calc.c
	ext/pcre/php_pcre.c
	ext/pdo/pdo_dbh.c
	ext/pdo/pdo_stmt.c
	ext/pdo_pgsql/pgsql_driver.c
	ext/pgsql/pgsql.c
	ext/reflection/php_reflection.c
	ext/session/session.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/array.c
	ext/standard/basic_functions.c
	ext/standard/html.c
	ext/standard/mail.c
	ext/standard/php_array.h
	ext/standard/proc_open.c
	ext/standard/streamsfuncs.c
	ext/standard/user_filters.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_variables.c
	sapi/phpdbg/phpdbg.c
	sapi/phpdbg/phpdbg_bp.c
	sapi/phpdbg/phpdbg_frame.c
	sapi/phpdbg/phpdbg_help.c
	sapi/phpdbg/phpdbg_list.c
	sapi/phpdbg/phpdbg_print.c
	sapi/phpdbg/phpdbg_prompt.c
2014-04-26 00:32:51 +04:00
Nikita Popov
4912bec514 Fix zts 2014-04-22 19:39:13 +02:00
Nikita Popov
3d3a55cbcb Pass expected array size hint in INIT_ARRAY
To avoid unnecessary rehashes
2014-04-22 18:57:03 +02:00
Bob Weinand
ee2a7c7d41 Fixed disallowal of array usage in constants at run-time
Added at the same time the possibility of array dereferencing
to complete the set of features (useful application of arrays in constants)
2014-04-11 18:21:46 +02:00
Bob Weinand
f614fc6898 Fix bug #66015 by reverting "Removed operations on constant arrays." 2014-04-11 10:08:44 +02:00
Nikita Popov
20f2e5986e Fix ZTS build
This only makes it compile, it doesn't actually work, presumably
because interned strings are assumed in some places.
2014-04-09 23:41:16 +02:00
Dmitry Stogov
76cc99fe60 Refactored ZVAL flags usage to simplify various checks (e.g. Z_REFCOUNTED(), candidate for GC, etc) 2014-04-03 15:26:23 +04:00
Tjerk Meesters
3d1fa4cb17 Allow T_POW in constant expressions 2014-03-07 09:14:27 +08:00
Nikita Popov
2eae187949 Store arg_num in fcall entry
Instead of storing the argument number in the znode of the parameter
list, store it in fcall->arg_num. This mainly cleans up the parameter
parsing code, which previously had to duplicate all rules (this
becomes more excessive as more features are added, e.g. named params
would already require a minimum of 14 rules...)
2014-02-26 16:40:25 +01:00
Dmitry Stogov
ff162410f0 Fixed traits support 2014-02-25 01:18:06 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
datibbaw
aff56f3c45 add T_POW (**) operator
Fixed recognition of the operator

Added opcode, still doing multiply instead of pow()

opcode now always returns int(42)

The right answer, but always a float

Yanked code from pow() implementation.

Should not handle negative long as exponent ourselves

Added test cases from pow()

Moved precedence higher than '~'

Added GMP operator overloading

Added ZEND_ASSIGN_POW (**=) operator.

Added pow() as a language construct.

Adjusted test cases for changed precedence.

Reduced pow() to shell function around ZEND_API pow_function()

Reduced test case to only contain edge cases
Added overloading test case

Moved unary minus above T_POW

Revert "Added pow() as a language construct."

Bad bad bad idea.

This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02.

Reverted unary minus behaviour due to previous revert.
Convert arrays to int(0)
Exponent with array as a base becomes int(0)

Rebase against master

Fixed tokenizer test case
2014-02-06 14:41:21 +01:00
Nikita Popov
2c47dfbaeb Implement argument unpacking
RFC: https://wiki.php.net/rfc/argument_unpacking
2014-01-11 12:42:08 +01:00