Commit Graph

133 Commits

Author SHA1 Message Date
Nikita Popov
fcdb6e0811 WIP 2015-02-28 21:20:37 +01:00
Dmitry Stogov
6b779596d7 Implemented AST pretty-printer 2015-02-19 11:11:17 +03: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
Anatol Belski
8fb29d3f63 fix declaration 2015-01-20 11:30:03 +01:00
Sara Golemon
1010b0ea4f Provide compiler hook for altering the AST pre-compilation. 2015-01-19 10:43:57 -08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Andrea Faulds
2d069f640e Merge branch 'coalesce_operator'
* coalesce_operator:
  Extended coalesce operator test case for ordering/short-circuiting
  Ensure not evaluated twice
  Added test
  Initial coalesce operator implementation
2014-09-28 00:07:04 +01:00
Nikita Popov
51119054ff Test error conditions for ct class const refs
And fix a bug found while doing so...
2014-09-23 00:40:17 +02:00
Dmitry Stogov
5185baab3e Changed "inline" into "zend_always_inline" 2014-09-18 04:59:01 +04: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
6db293d5e0 Merge remote-tracking branch 'php-src/master' into ast
Conflicts:
	Zend/zend_compile.c
	Zend/zend_compile.h
	Zend/zend_globals.h
	Zend/zend_language_parser.y
	Zend/zend_language_scanner.c
	Zend/zend_language_scanner.l
	Zend/zend_types.h
2014-08-25 21:52:18 +02:00
Nikita Popov
cf7f0c412d zend_ast_create determined child count automatically 2014-07-28 18:18:47 +02:00
Nikita Popov
39d480e471 Remove zend_ast_create_unary etc 2014-07-28 17:59:12 +02:00
Nikita Popov
1d79fb308b Add zend_ast_list* variant to parser stack element 2014-07-28 15:10:58 +02:00
Nikita Popov
f29b84ab46 Minor cleanups in AST code 2014-07-28 14:51:08 +02:00
Nikita Popov
d3cb239305 Use separate node type for lists
This saves storing the children count for normal ast nodes.
2014-07-28 12:06:57 +02:00
Nikita Popov
21eb6807c9 Store lineno for zval ast nodes more efficiently 2014-07-27 13:25:32 +02:00
Nikita Popov
df42793cd2 Create namespace_name via AST 2014-07-26 21:53:50 +02:00
Nikita Popov
c07907121e zend_do_return -> zend_emit_final_return 2014-07-26 21:32:48 +02:00
Nikita Popov
4ca4b423be Make lexer return AST nodes 2014-07-26 21:22:54 +02:00
Nikita Popov
a51e00a8cd Add functions for create str/long ast directly 2014-07-26 19:01:14 +02:00
Nikita Popov
edd9fcab1e Fix leaks
Must find a good way to handle constant expressions...
2014-07-26 18:08:31 +02:00
Nikita Popov
b9be66ebf2 Implement declare() 2014-07-22 16:11:19 +02:00
Nikita Popov
3becdb3376 __halt_compiler() without haling compiler 2014-07-22 14:25:19 +02:00
Nikita Popov
8a2ff6b53d Partial NS port (semicolon, no errors) 2014-07-22 12:45:44 +02:00
Nikita Popov
b6c9eb21d4 Port constant declaration 2014-07-22 11:55:07 +02:00
Nikita Popov
37ac1b96ed Port use statement 2014-07-21 22:49:31 +02:00
Nikita Popov
b24bda6be1 Partial port of class declarations 2014-07-21 16:34:45 +02:00
Nikita Popov
461bce5222 Prepare zend_ast_decl for reuse with classes 2014-07-21 15:38:21 +02:00
Nikita Popov
291bcfe4f1 Port trait uses 2014-07-19 22:39:01 +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
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
8577f58e52 Store (bad) estimate of lineno with ast
Currently not used yet
2014-07-12 14:03:42 +02:00
Nikita Popov
e367e68111 Port try/catch
Down to 50 failing Zend tests
2014-07-12 13:50:58 +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
4215969904 Port if (partial) 2014-07-10 16:38:04 +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
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
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
111ad71d38 Rename ZEND_CONST to ZEND_AST_ZVAL 2014-06-28 18:03:26 +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
e26c6d663a Implement constant expression folding as a separate pass 2014-06-23 21:59:14 +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
55ab55c417 Add ability to specify additional attr in AST 2014-06-19 13:48:50 +02:00
Nikita Popov
89ecd73a04 Make ast->children a uint
Future optimization: only use uint for dynamic lists and use a
uchar or even an introspection function to get the child count.
2014-06-19 13:48:50 +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
98918fe65b Remove (&ast->u.child)[i] weirdness 2014-06-06 22:35:21 +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
Xinchen Hui
3f4c877bf7 Use better data structures (incomplete) 2014-02-11 19:33:18 +08:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Dmitry Stogov
5a87b7ff39 Fixed bug #66252 (Problems in AST evaluation invalidating valid parent:: reference. Constant expessions have to be evaluated in context of defining class). 2013-12-10 14:19:17 +04:00
Bob Weinand
152898ff28 Moved arrays again to "static_scalar:" & little cleanup 2013-11-07 16:39:47 +01:00
Dmitry Stogov
e0135014c3 Renaming 2013-11-07 10:22:49 +04:00
Dmitry Stogov
9647c61dc1 Constant expressions refactoring 2013-11-06 22:21:07 +04:00
Bob Weinand
466c5dd1fe Fixed mem leaks, added tests and ternary operator 2013-10-31 18:21:37 +01:00
Bob Weinand
2361745806 Working commit for constant scalar expressions (with constants).
Tests will follow.
2013-10-31 08:57:12 +01:00