/* Function: TryToGetFirstBlockLine * If the iterator is on a line that starts with one of the <BlockTags>, extracts the components and returns true. * Use <GetBlockTag()> to get the complete block since it may span multiple lines. */ protected bool TryToGetFirstBlockLine(LineIterator lineIterator, out string tag, out TokenIterator startOfContent) { tag = null; startOfContent = default(TokenIterator); TokenIterator tokenIterator = lineIterator.FirstToken(LineBoundsMode.CommentContent); if (tokenIterator.Character != '@') { return(false); } tokenIterator.Next(); if (tokenIterator.FundamentalType != FundamentalType.Text) { return(false); } string possibleTag = tokenIterator.String; if (BlockTags.Contains(possibleTag) == false) { return(false); } tokenIterator.Next(); tokenIterator.NextPastWhitespace(); tag = possibleTag; startOfContent = tokenIterator; return(true); }
/* Function: HasAnyTag * Whether the passed block of text contains any Javadoc tags at all. */ protected bool HasAnyTag(TokenIterator start, TokenIterator end) { string text = start.Tokenizer.RawText; int endIndex = end.RawTextIndex; int textIndex = text.IndexOf('@', start.RawTextIndex, endIndex - start.RawTextIndex); while (textIndex != -1) { start.NextByCharacters(textIndex - start.RawTextIndex); start.Next(); if (textIndex > 0 && text[textIndex - 1] == '{') { if (InlineTags.Contains(start.String)) { return(true); } } else { if (BlockTags.Contains(start.String)) { return(true); } } textIndex = text.IndexOf('@', textIndex + 1, endIndex - (textIndex + 1)); } return(false); }