Permalink
Browse files

DocumentationComment: Add JavaDoc parsing

  • Loading branch information...
SanketDG committed Jun 25, 2016
1 parent 99fa059 commit fc2e3bfc49b227664fd6dd853d4d00a77c579415
@@ -57,6 +57,9 @@ def parse(self):
elif self.language == "python" and self.docstyle == "doxygen":
return self._parse_documentation_with_symbols(
("@param ", " "), "@return ")
elif self.language == "java" and self.docstyle == "default":
return self._parse_documentation_with_symbols(
("@param ", " "), "@return ")
else:
raise NotImplementedError(
"Documentation parsing for {0.language!r} in {0.docstyle!r}"
@@ -3,3 +3,7 @@ doc-marker = """, , """
[PYTHON3]
doc-marker = """, , """
[JAVA]
doc-marker1 = /**, \ *, \ */
doc-marker2 = /**, , \ */
@@ -154,3 +154,22 @@ def test_python_doxygen(self):
self.ReturnValue(desc='Nothing\n')]]
self.assertEqual(parsed_docs, expected)
class JavaDocumentationCommentTest(DocumentationCommentTest):
def test_java_default(self):
data = self.load_testdata("default.java")
parsed_docs = [doc.parse() for doc in
extract_documentation(data, "java", "default")]
expected = [[self.Description(
desc='\n Returns an String that says Hello with the name'
' argument.\n\n'),
self.Parameter(name='name',
desc='the name to which to say hello\n'),
self.ReturnValue(
desc=' the concatenated string\n')]]
self.assertEqual(expected, parsed_docs)
@@ -0,0 +1,12 @@
class HelloWorld {
/**
* Returns an String that says Hello with the name argument.
*
* @param name the name to which to say hello
* @return the concatenated string
*/
public String sayHello(String name) {
return "Hello, " + name;
}
}

0 comments on commit fc2e3bf

Please sign in to comment.