/////////////////////////////////////////////////
/**
* ドキュメントコメントを挿入する
**/
var jumpToY = parseInt(Editor.ExpandParameter("$y"));
var curLineText = Editor.GetLineStr(jumpToY);
Editor.Jump(jumpToY, 0);
curLineText = curLineText.replace(/,/g, " , ");
var strs = curLineText.split("");
var i;
// alert(curLineText);
curLineText = "";
var iscomment = 0;
var isparse = 0;
var isTop = 1;
var indent = "";
var isFunc = 0;
for(i = 0; i < strs.length; i++)
{
if(isTop)
{
if(strs[i] == " " || strs[i] == " ")
{
indent += strs[i];
}
else
isTop = 0;
}
if(strs[i] == '/' && i + 1 < strs.length && strs[++i] == '*')
{
iscomment = 1;
}
else if(iscomment)
{
if(strs[i] == '*' && i + 1 < strs.length && strs[++i] == '/')
{
curLineText += " ";
iscomment = 0;
}
continue;
}
else if(!isparse)
{
if(strs[i] == '(')
isparse = 1;
}
else if(strs[i] == ')')
break;
else if(strs[i] == "*" || strs[i] == '&')
continue;
else
{
curLineText += strs[i];
}
}
strs = curLineText.split(/[ \t]+/);
// alert(strs);
var isVoid = 0;
var space = " ";
var buffer = indent + "/**\r\n";
buffer += indent + " *\r\n" + indent + " **\r\n";
var ins = 0;
var hasParam = 0;
for(i = 0; i < strs.length; i++)
{
if(strs[i] == "void")
{
isVoid = 1;
}
else if((strs[i] == "," || strs[i] == '=') && 0 < i)
{
hasParam++;
ins = strs[i - 1].length;
// " "
buffer += indent;
buffer += " * @param\t" + strs[i - 1];
if(ins < 15)
buffer += space.substr(0, 15 - ins);
buffer += ": \r\n";
}
}