|Re: [pdt-dev] remove project notion from all php lexers|
Dawid your answer gave me some ideas.
For now, we (mainly PHPStructuredEditor in a dedicated thread) tell (in a hacky way) which highlighter should be used (depending on the provided project value). In all other cases we default to most recent PHP version with some default settings regarding ASP tags handling,...
Right way to do (I think) would be:
one (and only one) highlighter is used and it's the
highlighter who tells us in which php version the found tokens are supported.
We already use this concept in classes SimpleProposal and PHPSimpleTypes.
For example, after document scanning,
- the token XYZ was found and the highlighter tells us this token was supported from version 5.4 and deprecated in version 7.0 (but still valid)
- the token ABC was found and the highlighter tells us this token was supported from version 5.4 and invalid since version 7.0
- the token FOO was found and it has no version restrictions
- the token BAR was found and it's valid since version 5.1
We let then a semantic highlighter decide how to highlight those tokens depending on the version of the current project.
If there are complicated structures that were added (for example heredocs) after a specific php version, they should also be managed by separated highlighters, but maybe we could also encode this information somehow in the tokens (for example tell that some tokens act like begin-end sections and allow specific tokens in their section bodies).
That's just an unfinished idea for now ;)
Date: Fri, 12 Aug 2016 02:01:12 -0700
Subject: Re: [pdt-dev] remove project notion from all php lexers
I like idea when lexers/parsers are haven't connection to specific project. Rather than some kind of API IPHPSettings ;)
Wy we need for highlighters for each php version for now:
1. New keywords should be highlighted based on php version.
2. Highlighting after short echo "<?=" should be always enabled since 5.4, on older version only when short tags are enabled
3. ASP tags are perfectly valid until 5.6. So yes, it's still required for 5 - 5.6
4. Context sensitive keywords, since PHP for ex. "forEach" can be used as method name. It's not clear what will happen in next PHP versions. I personally prefer correct highlighting in this cases..
Maybe in the future (couple years later), when we drop PHP 5.* support will be able to keep one highlighter between PHP Versions with configurable keyword visibility. Or maybe it's possible to write one universal, confgurable highlighter for ex. in ANTLRv4 ?
From: Michal Niewrzal <michal.n@xxxxxxxx>
Reply: PDT Developers <pdt-dev@xxxxxxxxxxx>
Date: 11 August 2016 at 21:48:55
To: pdt-dev@xxxxxxxxxxx <pdt-dev@xxxxxxxxxxx>
Subject: [pdt-dev] remove project notion from all php lexers
_______________________________________________ pdt-dev mailing list pdt-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/pdt-dev