Browse Source

Added ability to parse multi-line formal comments

Shaddock Heath 9 years ago
parent
commit
4d7ce8fb75
1 changed files with 29 additions and 1 deletions
  1. 29 1
      Source/ToolCore/JSBind/JSBHeaderVisitor.h

+ 29 - 1
Source/ToolCore/JSBind/JSBHeaderVisitor.h

@@ -353,7 +353,7 @@ public:
         {
         {
             const Token &tcomment = unit_->commentAt(i);
             const Token &tcomment = unit_->commentAt(i);
             unsigned line;
             unsigned line;
-            unit_->getPosition(tcomment.utf16charOffset, &line);
+            unit_->getPosition(tcomment.utf16charsEnd(), &line);
 
 
             if (line ==  function->line() - 1)
             if (line ==  function->line() - 1)
             {
             {
@@ -376,6 +376,34 @@ public:
 
 
             }
             }
 
 
+            if (comment[0] == '/' && comment[1] == '*' && comment[2] == '*')
+            {
+                int index = 3;
+                bool foundStar = false;
+                String docString = jfunction->GetDocString();
+                while(comment[index])
+                {
+                    // did we find a star in the last loop?
+                    if (foundStar)
+                    {
+                        // We have a an end of block indicator, let's break
+                        if (comment[index] == '/' && foundStar)
+                            break;
+
+                        // This is just a star in the comment, not an end of comment indicator.  Let's keep it
+                        docString += '*';
+                    }
+                    
+                    foundStar = comment[index] == '*';
+
+                    if (!foundStar)
+                        docString += comment[index];
+
+                    index++;
+                }
+                jfunction->SetDocString(docString);
+            }
+
         }
         }