Doxygen
Loading...
Searching...
No Matches
commentscan.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2015 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#ifndef COMMENTSCAN_H
17
#define COMMENTSCAN_H
18
19
#include <memory>
20
#include <stack>
21
22
#include "
types.h
"
23
#include "
construct.h
"
24
25
class
Entry
;
26
class
OutlineParserInterface
;
27
28
class
GuardedSection
29
{
30
public
:
31
GuardedSection
(
bool
parentVisible
)
32
:
m_parentVisible
(
parentVisible
) {}
33
void
setEnabled
(
bool
enabled) {
m_enabled
= enabled; }
34
bool
isEnabled
()
const
{
return
m_enabled
; }
35
void
setEnabledFound
() {
m_enabledFound
=
true
; }
36
bool
isEnabledFound
()
const
{
return
m_enabledFound
; }
37
bool
parentVisible
()
const
{
return
m_parentVisible
; }
38
void
setElse
() {
m_hasElse
=
true
; }
39
bool
hasElse
()
const
{
return
m_hasElse
; }
40
41
private
:
42
bool
m_parentVisible
;
43
bool
m_enabledFound
=
false
;
44
bool
m_enabled
=
false
;
45
bool
m_hasElse
=
false
;
46
};
47
48
using
GuardedSectionStack
= std::stack<GuardedSection>;
49
50
/** @file
51
* @brief Interface for the comment block scanner */
52
53
class
CommentScanner
54
{
55
public
:
56
CommentScanner
();
57
~CommentScanner
();
58
NON_COPYABLE
(
CommentScanner
)
59
60
/** Invokes the comment block parser with the request to parse a
61
* single comment block.
62
* @param[in] parser The language parse that invoked this function.
63
* The comment block parse may invoke
64
* ParserInterface::parsePrototype() in order to parse
65
* the argument of a @@fn command.
66
* @param[in] curEntry The Entry to which the comment block belongs.
67
* Any information (like documentation) that is found in
68
* the comment block will be stored in this entry.
69
* @param[in] comment A string representing the actual comment block.
70
* Note that leading *'s are already stripped from the comment block.
71
* @param[in] fileName The name of the file in which the comment is found.
72
* Mainly used for producing warnings.
73
* @param[in,out] lineNr The line number at which the comment block was found.
74
* When the function returns it will be set to the last line parsed.
75
* @param[in] isBrief TRUE iff this comment block represents a brief description.
76
* @param[in] isJavadocStyle TRUE iff this comment block is in "Javadoc" style.
77
* This means that it starts as a brief description until the end of
78
* the sentences is found and then proceeds as a detailed description.
79
* @param[in] isInbody TRUE iff this comment block is located in the body of
80
* a function.
81
* @param[in,out] prot The protection level in which this comment block was
82
* found. Commands in the comment block may override this.
83
* @param[in,out] position The character position within \a comment where the
84
* comment block starts. Typically used in case the comment block
85
* contains multiple structural commands.
86
* @param[out] newEntryNeeded Boolean that is TRUE if the comment block parser
87
* finds that a the comment block finishes the entry and a new one
88
* needs to be started.
89
* @param[in] markdownEnabled Indicates if markdown specific processing should be done.
90
* @param[inout] guards Tracks nested conditional sections (if,ifnot,..)
91
* @returns TRUE if the comment requires further processing. The
92
* parameter \a newEntryNeeded will typically be true in this case and
93
* \a position will indicate the offset inside the \a comment string
94
* where to proceed parsing. FALSE indicates no further processing is
95
* needed.
96
*/
97
bool
parseCommentBlock
(OutlineParserInterface *parser,
98
Entry *curEntry,
99
const
QCString &
comment
,
100
const
QCString &fileName,
101
int
&lineNr,
102
bool
isBrief,
103
bool
isJavadocStyle,
104
bool
isInbody,
105
Protection
&prot,
106
int
&position,
107
bool
&newEntryNeeded,
108
bool
markdownEnabled,
109
GuardedSectionStack
*guards
110
);
111
void
initGroupInfo
(Entry *entry);
112
void
enterFile
(
const
QCString &fileName,
int
lineNr);
113
void
leaveFile
(
const
QCString &fileName,
int
lineNr);
114
void
enterCompound
(
const
QCString &fileName,
int
line,
const
QCString &name);
115
void
leaveCompound
(
const
QCString &fileName,
int
line,
const
QCString &name);
116
void
open
(Entry *e,
const
QCString &fileName,
int
line,
bool
implicit=
false
);
117
void
close
(Entry *e,
const
QCString &fileName,
int
line,
bool
foundInline,
bool
implicit=
false
);
118
private
:
119
struct
Private
;
120
std::unique_ptr<Private>
p
;
121
};
122
123
#endif
CommentScanner::close
void close(Entry *e, const QCString &fileName, int line, bool foundInline, bool implicit=false)
Definition
commentscan.l:4905
CommentScanner::leaveCompound
void leaveCompound(const QCString &fileName, int line, const QCString &name)
Definition
commentscan.l:4893
CommentScanner::open
void open(Entry *e, const QCString &fileName, int line, bool implicit=false)
Definition
commentscan.l:4899
CommentScanner::parseCommentBlock
bool parseCommentBlock(OutlineParserInterface *parser, Entry *curEntry, const QCString &comment, const QCString &fileName, int &lineNr, bool isBrief, bool isJavadocStyle, bool isInbody, Protection &prot, int &position, bool &newEntryNeeded, bool markdownEnabled, GuardedSectionStack *guards)
Invokes the comment block parser with the request to parse a single comment block.
Definition
commentscan.l:4687
CommentScanner::CommentScanner
CommentScanner()
Definition
commentscan.l:4674
CommentScanner::initGroupInfo
void initGroupInfo(Entry *entry)
Definition
commentscan.l:4869
CommentScanner::p
std::unique_ptr< Private > p
Definition
commentscan.h:120
CommentScanner::enterCompound
void enterCompound(const QCString &fileName, int line, const QCString &name)
Definition
commentscan.l:4887
CommentScanner::~CommentScanner
~CommentScanner()
Definition
commentscan.l:4682
CommentScanner::enterFile
void enterFile(const QCString &fileName, int lineNr)
Definition
commentscan.l:4875
CommentScanner::leaveFile
void leaveFile(const QCString &fileName, int lineNr)
Definition
commentscan.l:4881
Entry
Represents an unstructured piece of information, about an entity found in the sources.
Definition
entry.h:116
GuardedSection::isEnabledFound
bool isEnabledFound() const
Definition
commentscan.h:36
GuardedSection::hasElse
bool hasElse() const
Definition
commentscan.h:39
GuardedSection::isEnabled
bool isEnabled() const
Definition
commentscan.h:34
GuardedSection::setEnabled
void setEnabled(bool enabled)
Definition
commentscan.h:33
GuardedSection::m_parentVisible
bool m_parentVisible
Definition
commentscan.h:42
GuardedSection::parentVisible
bool parentVisible() const
Definition
commentscan.h:37
GuardedSection::setElse
void setElse()
Definition
commentscan.h:38
GuardedSection::GuardedSection
GuardedSection(bool parentVisible)
Definition
commentscan.h:31
GuardedSection::m_enabled
bool m_enabled
Definition
commentscan.h:44
GuardedSection::m_hasElse
bool m_hasElse
Definition
commentscan.h:45
GuardedSection::m_enabledFound
bool m_enabledFound
Definition
commentscan.h:43
GuardedSection::setEnabledFound
void setEnabledFound()
Definition
commentscan.h:35
OutlineParserInterface
Abstract interface for outline parsers.
Definition
parserintf.h:42
GuardedSectionStack
std::stack< GuardedSection > GuardedSectionStack
Definition
commentscan.h:48
construct.h
NON_COPYABLE
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Definition
construct.h:37
CommentScanner::Private
Definition
commentscan.l:4669
types.h
This file contains a number of basic enums and types.
Protection
Protection
Protection level of members.
Definition
types.h:26
comment
const char * comment
Definition
vhdldocgen.cpp:2532
src
commentscan.h
Generated by
1.13.0