[RFC][DISCUSSION] Context Sensitive lexer
| From: | Marcio Almada | Date: | Fri, 20 Feb 2015 07:29:18 +0000 |
| Subject: | [RFC][DISCUSSION] Context Sensitive lexer | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-83272@lists.php.net to get a copy of this message | ||
Hi internals,
I'd like to put the "Context Sensitive Lexer" RFC into discussion phase:
RFC: https://wiki.php.net/rfc/context_sensitive_lexer
TL;DR commit: https://github.com/marcioAlmada/php-src/commit/c01014f9
PR: https://github.com/php/php-src/pull/1054
PHP currently has ~64 globally reserved words. Not infrequently, these
reserved words end up clashing with legit alternatives to userland API
declarations. This RFC proposes minimal changes to have a context sensitive
lexer with support for semi-reserved words on PHP7 without causing
maintenance issues.
This could be especially useful to:
- Reduce the surface of BC breaks whenever new keywords are introduced
- Avoid restricting userland APIs. Dispensing the need for hacks like
unecessary magic method calls or prefixed identifiers.
The patch is 98% finished, the entire test suite is passing. I'm still
adding more tests to it but the hard part is done. So it's time to discuss!
Sincerely,
Márcio Almada