haidubogdan commented on PR #9023:
URL: https://github.com/apache/netbeans/pull/9023#issuecomment-3625959751
> @haidubogdan thank you. It makes sense that this was not caught before as
for "normal" PHP situations this problem can't manifest. The scanning stops
when the first token with a ID <> `PHPTokenId.PHP_TOKEN` is found. That will be
`PHP_OPENTAG`. That will always be present as without it we don't get into PHP
mode. This needs the embedding case to happen. The problem manifests because
`LexUtilities.findPreviousToken` will report the first token if the target set
is not found.
>
> So the change makes sense to me. An alternative I would see is to guard
the `ts.movePrevious` inside the do-while loop like this:
>
> ```java
> if(! ts.movePrevious()) {
> break;
> }
> ```
>
> The `movePrevious` will report `false` and exit the loop for the first
element in the token sequence.
>
> What do you think?
@matthiasblaesing
Seems cleaner :) .
I will use this solution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists