CommentBriefParser.h revision 2d44d77fed3200e2eff289f55493317e90d3398c
1//===--- CommentBriefParser.h - Dumb comment parser -------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines a very simple Doxygen comment parser. 11// 12//===----------------------------------------------------------------------===// 13 14 15#ifndef LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H 16#define LLVM_CLANG_AST_BRIEF_COMMENT_PARSER_H 17 18#include "clang/AST/CommentLexer.h" 19 20namespace clang { 21namespace comments { 22 23/// A very simple comment parser that extracts just the brief description or 24/// first paragraph. 25class BriefParser { 26 Lexer &L; 27 28 /// Current lookahead token. 29 Token Tok; 30 31 SourceLocation ConsumeToken() { 32 SourceLocation Loc = Tok.getLocation(); 33 L.lex(Tok); 34 return Loc; 35 } 36 37public: 38 BriefParser(Lexer &L); 39 40 /// Return \\brief paragraph, if it exists; otherwise return the first 41 /// paragraph. 42 std::string Parse(); 43}; 44 45} // end namespace comments 46} // end namespace clang 47 48#endif 49 50