We need to notice and observe the @ActionScript(name="foo") annotations when
slurping comments from Java source files. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4408 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -515,6 +515,7 @@ public class ActionScriptSource
|
|||||||
String name = m.group(1);
|
String name = m.group(1);
|
||||||
String comment = accum.toString();
|
String comment = accum.toString();
|
||||||
accum.setLength(0);
|
accum.setLength(0);
|
||||||
|
|
||||||
// set the comment on the specified method
|
// set the comment on the specified method
|
||||||
updateComment(publicConstructors, name, comment);
|
updateComment(publicConstructors, name, comment);
|
||||||
updateComment(protectedConstructors, name, comment);
|
updateComment(protectedConstructors, name, comment);
|
||||||
@@ -541,6 +542,24 @@ public class ActionScriptSource
|
|||||||
String name = m.group(1);
|
String name = m.group(1);
|
||||||
String comment = accum.toString();
|
String comment = accum.toString();
|
||||||
accum.setLength(0);
|
accum.setLength(0);
|
||||||
|
|
||||||
|
// look through the comment for an @ActionScript
|
||||||
|
// annotation; oh the hackery
|
||||||
|
if (comment.indexOf("@ActionScript") != -1) {
|
||||||
|
StringBuilder combuf = new StringBuilder();
|
||||||
|
for (String cline : StringUtil.split(comment, "\n")) {
|
||||||
|
if ((m = JANNOTATION.matcher(cline)).matches()) {
|
||||||
|
name = m.group(1);
|
||||||
|
} else {
|
||||||
|
if (combuf.length() > 0) {
|
||||||
|
combuf.append("\n");
|
||||||
|
}
|
||||||
|
combuf.append(cline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
comment = combuf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
// set the comment on the specified method
|
// set the comment on the specified method
|
||||||
updateComment(publicStaticMethods, name, comment);
|
updateComment(publicStaticMethods, name, comment);
|
||||||
updateComment(publicMethods, name, comment);
|
updateComment(publicMethods, name, comment);
|
||||||
@@ -718,7 +737,10 @@ public class ActionScriptSource
|
|||||||
!funcName.equals("writeObject")) {
|
!funcName.equals("writeObject")) {
|
||||||
curmem.definition = line.trim();
|
curmem.definition = line.trim();
|
||||||
}
|
}
|
||||||
curmem.setComment(accum.toString());
|
String ncomment = accum.toString();
|
||||||
|
if (!StringUtil.isBlank(ncomment)) {
|
||||||
|
curmem.setComment(ncomment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
accum.setLength(0);
|
accum.setLength(0);
|
||||||
|
|
||||||
@@ -952,6 +974,9 @@ public class ActionScriptSource
|
|||||||
protected static Pattern JMETHOD = Pattern.compile(
|
protected static Pattern JMETHOD = Pattern.compile(
|
||||||
"\\s+(?:public|protected|private).* ([a-zA-Z]\\w*) \\(.*");
|
"\\s+(?:public|protected|private).* ([a-zA-Z]\\w*) \\(.*");
|
||||||
|
|
||||||
|
protected static Pattern JANNOTATION = Pattern.compile(
|
||||||
|
".*@ActionScript\\(name=\"(\\w+)\"\\).*");
|
||||||
|
|
||||||
protected static Pattern ASFIELD = Pattern.compile(
|
protected static Pattern ASFIELD = Pattern.compile(
|
||||||
"\\s+(?:public|protected|private)" +
|
"\\s+(?:public|protected|private)" +
|
||||||
"(?:\\s+static)?(?:\\s+var|\\s+const)?" +
|
"(?:\\s+static)?(?:\\s+var|\\s+const)?" +
|
||||||
|
|||||||
Reference in New Issue
Block a user