luozongle01 commented on PR #2206:
URL: https://github.com/apache/zookeeper/pull/2206#issuecomment-2475410906

   Hi @kezhuw, These days, I have researched how JavaParser and Protobuf handle 
comments again.
   
   The 
[Comment#content](https://github.com/javaparser/javaparser/blob/master/javaparser-core/src/main/java/com/github/javaparser/ast/comments/Comment.java)
 method of Javaparser can retrieve the content inside the comment, which will 
remove the first layer`/**   */` or `/*   */` or `//` .  
   I think I might also be able to obtain the internal content of comments in 
this way for formatting purposes.
   
   The creatCommentFromToken method is the process of handling content
   
https://github.com/javaparser/javaparser/blob/master/javaparser-core/src/main/javacc-support/com/github/javaparser/GeneratedJavaParserTokenManagerBase.java
   
   <br>
   Then I also tested the process of protobuf handling comments.
   
   protobuf will format `/**  */` or `/*  */` or `//` as `/**  */`. 
   <img width="1338" alt="image" 
src="https://github.com/user-attachments/assets/dfd81b38-a7e8-46a1-a75a-9c6d50339808";>
   
   Will convert multi line comments nested within single line comments into 
`Html Entity`. (Because multi line comments cannot be nested within each other)
   
   <img width="1367" alt="image" 
src="https://github.com/user-attachments/assets/eae37bd6-dbc4-4e1a-8083-c49be44e7b4e";>
   
   <img width="1342" alt="image" 
src="https://github.com/user-attachments/assets/a7b62be8-128b-4eac-8f9d-a4c9c61b697c";>
   
   So I think I just need to handle the following single line comments and a 
few situations
   ```text
   /*       /*        /**         /**
             *                     *
             *                     *
   */        */        */          */
   ```
   For internal comments, I only need to convert`/*` and `*/` to `HTML Entity` 
(because multi line comments cannot be nested)
   
   So can I make further modifications this way or are there any issues I 
haven't thought of?


-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to