Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:29

0001 //===--- CommentBriefParser.h - Dumb comment parser -------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines a very simple Doxygen comment parser.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 
0014 #ifndef LLVM_CLANG_AST_COMMENTBRIEFPARSER_H
0015 #define LLVM_CLANG_AST_COMMENTBRIEFPARSER_H
0016 
0017 #include "clang/AST/CommentLexer.h"
0018 
0019 namespace clang {
0020 namespace comments {
0021 
0022 /// A very simple comment parser that extracts "a brief description".
0023 ///
0024 /// Due to a variety of comment styles, it considers the following as "a brief
0025 /// description", in order of priority:
0026 /// \li a \or \\short command,
0027 /// \li the first paragraph,
0028 /// \li a \\result or \\return or \\returns paragraph.
0029 class BriefParser {
0030   Lexer &L;
0031 
0032   const CommandTraits &Traits;
0033 
0034   /// Current lookahead token.
0035   Token Tok;
0036 
0037   SourceLocation ConsumeToken() {
0038     SourceLocation Loc = Tok.getLocation();
0039     L.lex(Tok);
0040     return Loc;
0041   }
0042 
0043 public:
0044   BriefParser(Lexer &L, const CommandTraits &Traits);
0045 
0046   /// Return the best "brief description" we can find.
0047   std::string Parse();
0048 };
0049 
0050 } // end namespace comments
0051 } // end namespace clang
0052 
0053 #endif
0054