- Cleaned up
- Detect tabs as well
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-17 21:40:12 +02:00
parent fe54aebae2
commit 661cd02a22
1 changed files with 12 additions and 6 deletions

View File

@ -295,6 +295,11 @@ private class CommentParser
char c;
bool spacey(char c)
{
return c == ' ' || c == '\t';
}
bool parseParam(ref string paramName, ref string paramDescription)
{
bool gotParamName = false;
@ -304,14 +309,14 @@ private class CommentParser
while(getch(c))
{
if(c == ' ')
if(spacey(c))
{
prog;
continue;
}
else if(!gotParamName)
{
while(getch(c) && c != ' ')
while(getch(c) && !spacey(c))
{
foundParamName ~= c;
prog;
@ -351,7 +356,7 @@ private class CommentParser
bool foundDescription;
while(getch(c))
{
if(c == ' ' && !foundDescription)
if(spacey(c) && !foundDescription)
{
prog;
continue;
@ -376,16 +381,16 @@ private class CommentParser
while(getch(c))
{
if(c == ' ')
if(spacey(c))
{
prog();
continue;
}
else if(c == '@' && !foundType)
else if(c == '@')
{
string paramType;
prog();
while(getch(c) && c != ' ')
while(getch(c) && !spacey(c))
{
paramType ~= c;
prog();
@ -436,6 +441,7 @@ private class CommentParser
// Unknown @<thing>
else
{
WARN(format("Unknown docstring type '%s'", paramType));
return false;
}
}