haidubogdan opened a new issue, #7803:
URL: https://github.com/apache/netbeans/issues/7803

   ### Apache NetBeans version
   
   Apache NetBeans 23
   
   ### What happened
   
   I've worked on a plugin for blade templates which required Php Embeddings.
   
   During the development I always had an issue that the plugin freeze when the 
file contained an php embedded text with ":" character.
   Ex: 
   ```
   @test($x ?: $y)
   ```
   Any action like delete, typing on this snippet would trigger a complete 
**freeze** for Netbeans.
   
   ### Language / Project Type / NetBeans Component
   
   PHP
   
   ### How to reproduce
   
   Have a custom language which will contain Php Embedding language like 
`PHPTokenId.languageInPHP()`.
   Have a text wrapped in parenthesis or brackets which will contain a colon 
character ":".
   
   ```
   @test($x ?: $y)
   ```
   Any action like delete, typing on this snippet would trigger a **freeze**.
   
   In order to help with the fix / debugging I've created a forked **netbeans** 
branch from my blade plugin on 
https://github.com/haidubogdan/netbeans/tree/php_blade_for_brace_matcher_issue
   
   ### Did this work correctly in an earlier version?
   
   Apache NetBeans 18
   
   ### Operating System
   
   Windows OS
   
   ### JDK
   
   17
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   After some investigation I found the issue to be on **PhpBracesMatcher**.
   On line 113 there is a condition that when the text contains a ":" character 
a while loop will be executed as long it detects a **PHP_TOKEN** lexer token. 
Parenthesis or brackets are matched as **PHP_TOKEN** PhpTokenId.
   In a full embedded context this would be fine as the first token for a php 
lexer is always "<?" but in a in language embedded context like we can have for 
blade templates  the text with ":" character wrapped in parenthesis will 
trigger an infinite loop
   
   
![image](https://github.com/user-attachments/assets/e97ca51b-eb7c-4d89-ab55-aa2233f2c8a1)
   
   ### Are you willing to submit a pull request?
   
   Yes


-- 
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

Reply via email to