diff --git a/source/tlang/compiler/symbols/comments.d b/source/tlang/compiler/symbols/comments.d index 13ec4bb4..851f17a4 100644 --- a/source/tlang/compiler/symbols/comments.d +++ b/source/tlang/compiler/symbols/comments.d @@ -24,6 +24,11 @@ public struct ParamDoc public struct ReturnsDoc { string description; + + public string getDescription() + { + return this.description; + } } public struct ExceptionDoc @@ -233,6 +238,28 @@ private class CommentParser } } + bool parseReturn(ref string returnDescription) + { + string gotDescription; + bool foundDescription; + while(getch(c)) + { + gotDescription ~= c; + prog; + foundDescription = true; + } + + if(foundDescription) + { + returnDescription = gotDescription; + return true; + } + else + { + return false; + } + } + while(getch(c)) { @@ -268,6 +295,24 @@ private class CommentParser return false; } } + // @return + else if (paramType == "return") + { + string returnDescr; + if(parseReturn(returnDescr)) + { + DEBUG("hool"); + DocStr tmp; + tmp.type = DocType.RETURNS; + tmp.content.returns = ReturnsDoc(returnDescr); + ds = tmp; + return true; + } + else + { + return false; + } + } // Unknown @ else { @@ -394,4 +439,19 @@ public final class Comment return d; } + + public bool getReturnDoc(ref ReturnsDoc retDoc) + { + // TODO: Use niknaks flter + foreach(DocStr d; getDocStrings()) + { + if(d.type == DocType.RETURNS) + { + retDoc = d.content.returns; + return true; + } + } + + return false; + } } \ No newline at end of file