clang 10.0.0git

CommentBriefParser.h
Go to the documentation of this file.
1 //===--- CommentBriefParser.h - Dumb comment parser -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a very simple Doxygen comment parser.
10 //
11 //===----------------------------------------------------------------------===//
12
13
14 #ifndef LLVM_CLANG_AST_COMMENTBRIEFPARSER_H
15 #define LLVM_CLANG_AST_COMMENTBRIEFPARSER_H
16
17 #include "clang/AST/CommentLexer.h"
18
19 namespace clang {
20 namespace comments {
21
22 /// A very simple comment parser that extracts "a brief description".
23 ///
24 /// Due to a variety of comment styles, it considers the following as "a brief
25 /// description", in order of priority:
26 /// \li a \or \\short command,
27 /// \li the first paragraph,
28 /// \li a \\result or \\return or \\returns paragraph.
29 class BriefParser {
30 Lexer &L;
31
32 const CommandTraits &Traits;
33
34 /// Current lookahead token.
35 Token Tok;
36
37 SourceLocation ConsumeToken() {
38 SourceLocation Loc = Tok.getLocation();
39 L.lex(Tok);
40 return Loc;
41 }
42
43 public:
44 BriefParser(Lexer &L, const CommandTraits &Traits);
45
46 /// Return the best "brief description" we can find.
47 std::string Parse();
48 };
49
50 } // end namespace comments
51 } // end namespace clang
52
53 #endif
54
CommentLexer.h
clang::comments::Lexer::lex
void lex(Token &T)
Definition: CommentLexer.cpp:750
clang::comments::Token::getLocation
SourceLocation getLocation() const LLVM_READONLY
Definition: CommentLexer.h:80
clang::comments::CommandTraits
This class provides information about commands that can be used in comments.
Definition: CommentCommandTraits.h:127
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::comments::Lexer
Comment lexer.
Definition: CommentLexer.h:220
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::comments::BriefParser::Parse
std::string Parse()
Return the best "brief description" we can find.
Definition: CommentBriefParser.cpp:62
clang::comments::Token
Comment token.
Definition: CommentLexer.h:55
clang::comments::BriefParser
A very simple comment parser that extracts "a brief description".
Definition: CommentBriefParser.h:29
clang::comments::BriefParser::BriefParser
BriefParser(Lexer &L, const CommandTraits &Traits)
Definition: CommentBriefParser.cpp:56