JavaDocParser { public JavaDocCommentNode comment() { JavaDocCommentNode result = new JavaDocCommentNode(); while (!isEof()) { int start = idx; HtmlTagStartNode node = htmlTagStart(); if (node != null) { result.children.add(node); continue; } idx = start; nextCp(); } return result; } JavaDocParser(String source);  JavaDocParser(String source, int sourceStart, int sourceEnd); JavaDocCommentNode comment(); HtmlTagStartNode htmlTagStart(); List<HtmlTagAttr> attrs(); void optWhitespace(); SourceString ident();  }
@Test public void testHtmlTagNoClosingParenthesis() { String source = ""; JavaDocCommentNode comment = new JavaDocParser(source).comment(); assertEquals(1, comment.children.size()); assertEquals(new HtmlTagStartNode(new SourceString(source, 6, 7), 5, 8), comment.children.get(0)); }
@Test public void testClosingTag() { String source = ""; JavaDocCommentNode comment = new JavaDocParser(source).comment(); assertEquals(1, comment.children.size()); assertEquals(new HtmlTagStartNode(new SourceString(source, 8, 9), 7, 10), comment.children.get(0)); }
@Test public void testImgRef() { JavaDocCommentNode comment = new JavaDocParser("*<img src=\"foo.png\" alt=\"\"/>*").comment(); assertEquals(1, comment.children.size()); HtmlTagStartNode ref = (HtmlTagStartNode) comment.children.get(0); assertEquals("img", ref.tagName.getValue()); assertEquals("src", ref.attrs.get(0).key.getValue()); assertEquals("foo.png", ref.attrs.get(0).value.getValue()); assertEquals(11, ref.attrs.get(0).value.start); assertEquals(18, ref.attrs.get(0).value.end); }
@Test public void testSimpleJavadoc() { String source = ""; JavaDocCommentNode comment = new JavaDocParser(source).comment(); assertEquals(0, comment.children.size()); }
@Test public void testHtmlTag() { String source = ""; JavaDocCommentNode comment = new JavaDocParser(source).comment(); assertEquals(1, comment.children.size()); assertEquals(new HtmlTagStartNode(new SourceString(source, 4, 5), 3, 6), comment.children.get(0)); }