mjc

org.multijava.mjdoc.mjdoc_142
Class MjTagParser

java.lang.Object
  extended byorg.multijava.mjdoc.mjdoc_142.MjTagParser

public class MjTagParser
extends Object

This class is a helper class to parse javadoc comments into the appropriate set of tags. A javadoc comment consists of some decriptive text followed by a tag section. The descriptive text is represented by a sequence of inline tags (typically Text and link tags). The tag section is a sequence of tags, each of which may have its own descriptive text (consisting of a sequence of Text and link and other inline tags).

This class is constructed with raw unprocessed text (consisting of the entire javadoc comment minus the optional white space and sequence of '*' characters that is ignored at the beginning of each line). The constructor does the parsing, so after successful construction, all the accessor methods provide various views into the structure of the javadoc comment.

Author:
David R. Cok

Field Summary
protected  String commentText
          The description portion of the javadoc comment (but ordinarily use the parsed version as contained in inlineTags).
protected  com.sun.javadoc.Tag[] firstSentenceTags
          The parsed descriptive text of the first sentence of the javadoc comment, represented as a sequence of Text and inline tags.
protected  com.sun.javadoc.Tag[] inlineTags
          The parsed descriptive text of the javadoc comment, represented as a sequence of Text and inline tags.
protected  com.sun.javadoc.Doc owner
          The Doc object to which the tag being parsed belongs.
protected  String rawComment
          A holder for the raw javadoc comment.
protected  com.sun.javadoc.SourcePosition sourcePosition
          The SourcePosition for the text being parsed; the current architecture does not preserve source position within a javadoc comment.
protected  com.sun.javadoc.Tag[] tags
          The tag portion of the javadoc comment, represented as a sequence of tags.
 
Constructor Summary
MjTagParser(com.sun.javadoc.Doc owner)
          A constructor for an empty javadoc comment.
MjTagParser(com.sun.javadoc.Doc owner, String s, com.sun.javadoc.SourcePosition pos)
          This constructor parses the input string into a descriptive portion (retrieved as a sequence of inline tags via the inlineTags() method), and a sequence of tags (retrieved via tags() ).
 
Method Summary
 String commentText()
          An accessor providing the unparsed text of the descriptive section of the javadoc comment.
protected  String firstSentence(String comment)
          Returns the summary sentence of the comment text.
 com.sun.javadoc.Tag[] firstSentenceTags()
          An accessor providing the summary sentence of the javadoc comment as a sequence of Text and inline tags.
 String getRawCommentText()
          An accessor providing the unparsed text of the full javadoc comment, as supplied to the constructor.
 com.sun.javadoc.Tag[] inlineTags()
          An accessor providing the parsed version of the descriptive section of the javadoc comment, as a sequence of Text and inline tags.
protected  void parse()
          The helper method that does the parsing of the raw comment text.
 com.sun.javadoc.SeeTag[] seeTags()
          An accessor providing the subset of the tag section of the javadoc comment that is the '@see' tags.
protected  int skipToFirstTag(char[] c)
           
protected  int skipToTag(char[] c, int j)
          A helper function that finds the end of a tag or the initial descriptive portion of a javadoc comment.
 com.sun.javadoc.Tag[] tags()
          An accessor providing the tags making up the tag section of the javadoc comment.
 com.sun.javadoc.Tag[] tags(String tagkind)
          An accessor providing the tags making up the tag section of the javadoc comment.
 com.sun.javadoc.Tag[] tags(String tagkind, com.sun.javadoc.Tag[] type)
          An helper method providing the tags making up the tag section of the javadoc comment that are of the given 'kind'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rawComment

protected String rawComment
A holder for the raw javadoc comment.


commentText

protected String commentText
The description portion of the javadoc comment (but ordinarily use the parsed version as contained in inlineTags).


sourcePosition

protected com.sun.javadoc.SourcePosition sourcePosition
The SourcePosition for the text being parsed; the current architecture does not preserve source position within a javadoc comment.


firstSentenceTags

protected com.sun.javadoc.Tag[] firstSentenceTags
The parsed descriptive text of the first sentence of the javadoc comment, represented as a sequence of Text and inline tags.


inlineTags

protected com.sun.javadoc.Tag[] inlineTags
The parsed descriptive text of the javadoc comment, represented as a sequence of Text and inline tags.


tags

protected com.sun.javadoc.Tag[] tags
The tag portion of the javadoc comment, represented as a sequence of tags.


owner

protected com.sun.javadoc.Doc owner
The Doc object to which the tag being parsed belongs.

Constructor Detail

MjTagParser

public MjTagParser(com.sun.javadoc.Doc owner,
                   String s,
                   com.sun.javadoc.SourcePosition pos)
This constructor parses the input string into a descriptive portion (retrieved as a sequence of inline tags via the inlineTags() method), and a sequence of tags (retrieved via tags() ). The input text should be the complete javadoc comment text, without the opening and closing comment markers or any ignored whitespace+'*' at the beginning of a line.


MjTagParser

public MjTagParser(com.sun.javadoc.Doc owner)
A constructor for an empty javadoc comment.

Method Detail

parse

protected void parse()
The helper method that does the parsing of the raw comment text.


skipToFirstTag

protected int skipToFirstTag(char[] c)

skipToTag

protected int skipToTag(char[] c,
                        int j)
A helper function that finds the end of a tag or the initial descriptive portion of a javadoc comment.

Parameters:
c - a char array that contains the text of the javadoc comment
j - the index representing the end of the previous tag or descriptive section (or 0)
Returns:
the end of the next tag or descriptive section.

firstSentence

protected String firstSentence(String comment)
Returns the summary sentence of the comment text. The argument is the comment text; the argument may have in-line tags, but not non-inline tags.


commentText

public String commentText()
An accessor providing the unparsed text of the descriptive section of the javadoc comment.


firstSentenceTags

public com.sun.javadoc.Tag[] firstSentenceTags()
An accessor providing the summary sentence of the javadoc comment as a sequence of Text and inline tags.


getRawCommentText

public String getRawCommentText()
An accessor providing the unparsed text of the full javadoc comment, as supplied to the constructor.


inlineTags

public com.sun.javadoc.Tag[] inlineTags()
An accessor providing the parsed version of the descriptive section of the javadoc comment, as a sequence of Text and inline tags.


seeTags

public com.sun.javadoc.SeeTag[] seeTags()
An accessor providing the subset of the tag section of the javadoc comment that is the '@see' tags.


tags

public com.sun.javadoc.Tag[] tags()
An accessor providing the tags making up the tag section of the javadoc comment.


tags

public com.sun.javadoc.Tag[] tags(String tagkind)
An accessor providing the tags making up the tag section of the javadoc comment.


tags

public com.sun.javadoc.Tag[] tags(String tagkind,
                                  com.sun.javadoc.Tag[] type)
An helper method providing the tags making up the tag section of the javadoc comment that are of the given 'kind'.


mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.