Introduce an on_event_context passed to the on_event hook. Use this
context to pass along the token array. Previously this was stored
in a non-tls global :/
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
This turned out to be rather inconvenient after all. Instead just
return the same output we did on PHP 5. If people want to have an
error, use TOKEN_PARSE.
Added Throwable interface that exceptions must
implement in order to be thrown. BaseException
was removed, EngineException renamed to
Error, and TypeException and ParseException
renamed to TypeError and ParseError. Exception
and Error no longer extend a common base
class, rather they both implement the Throwable
interface.
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.
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
Introduce helper macro FC(x) for CG(file_context).x.
end_compilation() now handled by file_context_end().
While at it, dropped zval wrapper for ticcks.
Renamed compiler_context to oparray_context. Introduced per-file
file_context. Moved import tables into the file_context.
context_stack no longer exists, instead keeping backups of contexts
on C stack. Same for file contexts.
TODO: Move more things out of CG into file_context. There should be
a number of other things that we should not try to reuse in nested
compilations.
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.
As per https://wiki.php.net/rfc/remove_alternative_php_tags.
Removes:
* <% opening tag
* %> closing tag
* <%= short opening tag
* /<script\s+language\s*=\s*(php|"php"|'php')\s*>/i opening tag
* /</script>/i closing tag
* asp_tags ini directive
The three assignments above this line are still broken - they assume
that byte offsets in one encoding directly map to byte offsets in
another encoding.
I'm fixing the length here because it is the one causing out-of-bounds
reads and is easy to fix. For the others we'd have to actually compute
new offsets.