summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandre Salconi <asalconi@cimeq.qc.ca>2020-09-29 21:31:04 (GMT)
committerAlexandre Salconi <asalconi@cimeq.qc.ca>2020-09-29 21:31:04 (GMT)
commit456a1ef0ca5f96dbbd93d9cd4c35fecbb2f07ae1 (patch)
tree5876b292fd2b884e0bd5e2ab461112504b58b889 /src
parenta49a5d4c687742a6eaf516d79d2dff399aad12dc (diff)
parentdc33ea319801b75bc3523c24d95da972a6c1cbe2 (diff)
downloadDoxygen-456a1ef0ca5f96dbbd93d9cd4c35fecbb2f07ae1.zip
Doxygen-456a1ef0ca5f96dbbd93d9cd4c35fecbb2f07ae1.tar.gz
Doxygen-456a1ef0ca5f96dbbd93d9cd4c35fecbb2f07ae1.tar.bz2
Merge branch 'master' into test/uml
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt35
-rw-r--r--src/cache.h162
-rw-r--r--src/classdef.cpp1
-rw-r--r--src/code.l4217
-rw-r--r--src/commentcnv.l44
-rw-r--r--src/commentscan.l15
-rw-r--r--src/config.xml9
-rw-r--r--src/context.cpp32
-rw-r--r--src/definition.cpp42
-rw-r--r--src/docbookgen.cpp36
-rw-r--r--src/docbookgen.h84
-rw-r--r--src/docbookvisitor.cpp69
-rw-r--r--src/docparser.cpp4
-rw-r--r--src/doctokenizer.l714
-rw-r--r--src/docvisitor.cpp58
-rw-r--r--src/docvisitor.h28
-rw-r--r--src/dotfilepatcher.cpp3
-rw-r--r--src/doxygen.cpp186
-rw-r--r--src/doxygen.h10
-rw-r--r--src/filedef.cpp42
-rw-r--r--src/filedef.h4
-rw-r--r--src/fortrancode.h15
-rw-r--r--src/fortrancode.l1866
-rw-r--r--src/fortranscanner.h1
-rw-r--r--src/fortranscanner.l46
-rw-r--r--src/groupdef.cpp1
-rw-r--r--src/htmldocvisitor.cpp281
-rw-r--r--src/htmlgen.cpp61
-rw-r--r--src/htmlgen.h22
-rw-r--r--src/latexdocvisitor.cpp176
-rw-r--r--src/latexdocvisitor.h26
-rw-r--r--src/latexgen.cpp97
-rw-r--r--src/latexgen.h22
-rw-r--r--src/mandocvisitor.cpp167
-rw-r--r--src/mangen.cpp4
-rw-r--r--src/mangen.h4
-rw-r--r--src/markdown.cpp5
-rw-r--r--src/memberdef.cpp100
-rw-r--r--src/memberdef.h1
-rw-r--r--src/namespacedef.cpp1
-rw-r--r--src/outputgen.h24
-rw-r--r--src/outputlist.h8
-rw-r--r--src/pagedef.cpp1
-rw-r--r--src/parserintf.h55
-rw-r--r--src/pycode.h13
-rw-r--r--src/pycode.l2405
-rw-r--r--src/pyscanner.l12
-rw-r--r--src/reflist.cpp2
-rw-r--r--src/rtfdocvisitor.cpp20
-rw-r--r--src/rtfgen.cpp21
-rw-r--r--src/rtfgen.h5
-rw-r--r--src/scanner.l10345
-rw-r--r--src/searchindex.cpp4
-rw-r--r--src/sqlcode.h13
-rw-r--r--src/sqlcode.l293
-rw-r--r--src/util.cpp194
-rw-r--r--src/util.h14
-rw-r--r--src/vhdlcode.h25
-rw-r--r--src/vhdlcode.l2298
-rw-r--r--src/vhdldocgen.cpp17
-rw-r--r--src/vhdljjparser.cpp3
-rw-r--r--src/xmlcode.h13
-rw-r--r--src/xmlcode.l608
-rw-r--r--src/xmldocvisitor.cpp38
-rw-r--r--src/xmlgen.cpp23
-rw-r--r--src/xmlgen.h10
66 files changed, 12881 insertions, 12274 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cb28911..c3d6f13 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,13 +1,13 @@
# vim:ts=4:sw=4:expandtab:autoindent:
include_directories(
- ${CMAKE_SOURCE_DIR}/qtools
- ${CMAKE_SOURCE_DIR}/libmd5
- ${CMAKE_SOURCE_DIR}/liblodepng
- ${CMAKE_SOURCE_DIR}/libmscgen
- ${CMAKE_SOURCE_DIR}/libversion
- ${CMAKE_SOURCE_DIR}/vhdlparser
- ${CMAKE_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/qtools
+ ${PROJECT_SOURCE_DIR}/libmd5
+ ${PROJECT_SOURCE_DIR}/liblodepng
+ ${PROJECT_SOURCE_DIR}/libmscgen
+ ${PROJECT_SOURCE_DIR}/libversion
+ ${PROJECT_SOURCE_DIR}/vhdlparser
+ ${PROJECT_SOURCE_DIR}/src
${CLANG_INCLUDEDIR}
${GENERATED_SRC}
)
@@ -78,7 +78,7 @@ set_source_files_properties(${GENERATED_SRC}/ce_parse.h PROPERTIES GENERATED 1)
# lang_cfg.h
add_custom_command(
COMMENT "Generating ${GENERATED_SRC}/lang_cfg.h"
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES}
+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES}
DEPENDS ${LANGUAGE_FILES}
OUTPUT ${GENERATED_SRC}/lang_cfg.h
)
@@ -86,15 +86,15 @@ set_source_files_properties(${GENERATED_SRC}/lang_cfg.h PROPERTIES GENERATED 1)
# all resource files
if (${CMAKE_VERSION} VERSION_EQUAL "3.11.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.11.0")
- file(GLOB RESOURCES CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/templates/*/*)
+ file(GLOB RESOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/templates/*/*)
else()
- file(GLOB RESOURCES ${CMAKE_SOURCE_DIR}/templates/*/*)
+ file(GLOB RESOURCES ${PROJECT_SOURCE_DIR}/templates/*/*)
endif()
# resources.cpp
add_custom_command(
COMMENT "Generating ${GENERATED_SRC}/resources.cpp"
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py ${CMAKE_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py ${PROJECT_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp
DEPENDS ${RESOURCES} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py
OUTPUT ${GENERATED_SRC}/resources.cpp
)
@@ -138,9 +138,9 @@ foreach(lex_file ${LEX_FILES})
set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1)
# for code coverage we need the flex sources in the build src directory
add_custom_command(
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/${lex_file}.l ${CMAKE_BINARY_DIR}/src/${lex_file}.l
- DEPENDS ${CMAKE_SOURCE_DIR}/src/${lex_file}.l
- OUTPUT ${CMAKE_BINARY_DIR}/src/${lex_file}.l
+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/${lex_file}.l ${PROJECT_BINARY_DIR}/src/${lex_file}.l
+ DEPENDS ${PROJECT_SOURCE_DIR}/src/${lex_file}.l
+ OUTPUT ${PROJECT_BINARY_DIR}/src/${lex_file}.l
)
FLEX_TARGET(${lex_file}
@@ -156,9 +156,9 @@ BISON_TARGET(constexp
COMPILE_FLAGS "${YACC_FLAGS}")
add_custom_command(
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/constexp.y ${CMAKE_BINARY_DIR}/src
- DEPENDS ${CMAKE_SOURCE_DIR}/src/constexp.y
- OUTPUT ${CMAKE_BINARY_DIR}/src/constexp.y
+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/constexp.y ${PROJECT_BINARY_DIR}/src
+ DEPENDS ${PROJECT_SOURCE_DIR}/src/constexp.y
+ OUTPUT ${PROJECT_BINARY_DIR}/src/constexp.y
)
add_library(doxycfg STATIC
@@ -240,6 +240,7 @@ add_library(doxymain STATIC
docgroup.cpp
docparser.cpp
docsets.cpp
+ docvisitor.cpp
dot.cpp
dotcallgraph.cpp
dotclassgraph.cpp
diff --git a/src/cache.h b/src/cache.h
new file mode 100644
index 0000000..5f7c834
--- /dev/null
+++ b/src/cache.h
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ *
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#ifndef CACHE_H
+#define CACHE_H
+
+#include <list>
+#include <unordered_map>
+#include <mutex>
+#include <ctype.h>
+
+/*! Fixed size cache for value type V using keys of type K.
+ *
+ * When the maximum capacity has reached, the least recently used value is removed from the cache
+ * (LRU strategy).
+ */
+template<typename K,typename V>
+class Cache
+{
+ public:
+ using kv_pair = std::pair<K,V>;
+ using iterator = typename std::list<kv_pair>::iterator;
+ using const_iterator = typename std::list<kv_pair>::const_iterator;
+
+ //! creates a cache that can hold \a capacity elements
+ Cache(size_t capacity) : m_capacity(capacity)
+ {
+ }
+
+ //! Inserts \a value under \a key in the cache
+ V *insert(const K &key,V &&value)
+ {
+ // remove item if it already exists
+ remove(key);
+ // store new item
+ m_cacheItemList.push_front(kv_pair(key,std::move(value)));
+ V *result = &m_cacheItemList.front().second;
+ m_cacheItemMap[key] = m_cacheItemList.begin();
+ // remove least recently used item if cache is full
+ resize();
+ return result;
+ }
+
+ //! Inserts \a value under \a key in the cache
+ V *insert(const K &key,const V &value)
+ {
+ // remove item if it already exists
+ remove(key);
+ // store new item
+ m_cacheItemList.push_front(kv_pair(key,value));
+ V *result = &m_cacheItemList.front().second;
+ m_cacheItemMap[key] = m_cacheItemList.begin();
+ // remove least recently used item if cache is full
+ resize();
+ return result;
+ }
+
+ //! Removes entry \a key from the cache.
+ //! \note this invalidates any iterators
+ void remove(const K &key)
+ {
+ // remove item if it already exists
+ auto it = m_cacheItemMap.find(key);
+ if (it != m_cacheItemMap.end())
+ {
+ m_cacheItemList.erase(it->second);
+ m_cacheItemMap.erase(it);
+ }
+ }
+
+ //! Finds a value in the cache given the corresponding \a key.
+ //! @returns a pointer to the value or nullptr if the key is not found in the cache
+ //! @note The hit and miss counters are updated, see hits() and misses().
+ V *find(const K &key)
+ {
+ auto it = m_cacheItemMap.find(key);
+ if (it != m_cacheItemMap.end())
+ {
+ // move the item to the front of the list
+ m_cacheItemList.splice(m_cacheItemList.begin(),
+ m_cacheItemList,
+ it->second);
+ m_hits++;
+ // return the value
+ return &it->second->second;
+ }
+ else
+ {
+ m_misses++;
+ }
+ return nullptr;
+ }
+
+ //! Returns the number of values stored in the cache.
+ size_t size() const
+ {
+ return m_cacheItemMap.size();
+ }
+
+ //! Returns the maximum number of values that can be stored in the cache.
+ size_t capacity() const
+ {
+ return m_capacity;
+ }
+
+ //! Returns how many of the find() calls did find a value in the cache.
+ uint64_t hits() const
+ {
+ return m_hits;
+ }
+
+ //! Returns how many of the find() calls did not found a value in the cache.
+ uint64_t misses() const
+ {
+ return m_misses;
+ }
+
+ //! Clears all values in the cache.
+ void clear()
+ {
+ m_cacheItemMap.clear();
+ m_cacheItemList.clear();
+ }
+
+ iterator begin() { return m_cacheItemList.begin(); }
+ iterator end() { return m_cacheItemList.end(); }
+ const_iterator begin() const { return m_cacheItemList.cbegin(); }
+ const_iterator end() const { return m_cacheItemList.cend(); }
+
+ private:
+ void resize()
+ {
+ if (m_cacheItemMap.size() > m_capacity)
+ {
+ auto last_it = m_cacheItemList.end();
+ --last_it;
+ m_cacheItemMap.erase(last_it->first);
+ m_cacheItemList.pop_back();
+ }
+ }
+ size_t m_capacity;
+ // list of items in the cache, sorted by most to least recently used.
+ std::list<kv_pair> m_cacheItemList;
+ // mapping for each key to a place in the list where item is found
+ std::unordered_map<K,iterator> m_cacheItemMap;
+ uint64_t m_hits=0;
+ uint64_t m_misses=0;
+};
+
+#endif
diff --git a/src/classdef.cpp b/src/classdef.cpp
index c3cd3ee..5e2b2fa 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -1248,6 +1248,7 @@ void ClassDefImpl::distributeMemberGroupDocumentation()
void ClassDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
if (m_impl->memberGroupSDict)
{
diff --git a/src/code.l b/src/code.l
index 821a91d..9374b40 100644
--- a/src/code.l
+++ b/src/code.l
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -25,18 +23,21 @@
%{
/*
- * includes
+ * includes
*/
#include <memory>
#include <algorithm>
+#include <unordered_map>
+#include <stack>
+#include <vector>
+#include <string>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <qregexp.h>
#include <qdir.h>
-#include <qstack.h>
#include "code.h"
#include "entry.h"
@@ -61,16 +62,16 @@
#define YY_NO_UNISTD_H 1
-#define CLASSBLOCK (int *)4
-#define SCOPEBLOCK (int *)8
-#define INNERBLOCK (int *)12
+#define CLASSBLOCK 1
+#define SCOPEBLOCK 2
+#define INNERBLOCK 3
#define USE_STATE2STRING 0
/* -----------------------------------------------------------------
- * statics
+ * statics
*/
-
+
// context for an Objective-C method call
struct ObjCCallCtx
{
@@ -95,33 +96,21 @@ class VariableContext
{
public:
static const ClassDef *dummyContext;
-
- class Scope : public SDict<ClassDef>
- {
- public:
- Scope() : SDict<ClassDef>(17) {}
- };
-
- VariableContext()
- {
- m_scopes.setAutoDelete(TRUE);
- }
- virtual ~VariableContext()
- {
- }
-
+
+ using Scope = std::unordered_map<std::string,const ClassDef*>;
+
void pushScope()
{
- m_scopes.append(new Scope);
- DBG_CTX((stderr,"** Push var context %d\n",m_scopes.count()));
+ m_scopes.push_back(Scope());
+ DBG_CTX((stderr,"** Push var context %zu\n",m_scopes.size()));
}
void popScope()
{
- if (m_scopes.count()>0)
+ if (!m_scopes.empty())
{
- DBG_CTX((stderr,"** Pop var context %d\n",m_scopes.count()));
- m_scopes.remove(m_scopes.count()-1);
+ DBG_CTX((stderr,"** Pop var context %zu\n",m_scopes.size()));
+ m_scopes.pop_back();
}
else
{
@@ -135,20 +124,12 @@ class VariableContext
m_globalScope.clear();
}
- void clearExceptGlobal()
- {
- DBG_CTX((stderr,"** Clear var context\n"));
- m_scopes.clear();
- }
-
void addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name);
- ClassDef *findVariable(const QCString &name);
+ const ClassDef *findVariable(const QCString &name);
- uint count() const { return m_scopes.count(); }
-
private:
Scope m_globalScope;
- QList<Scope> m_scopes;
+ std::vector<Scope> m_scopes;
};
//-------------------------------------------------------------------
@@ -158,44 +139,37 @@ class CallContext
public:
struct Ctx
{
- Ctx(QCString _name, QCString _type) : name(_name), type(_type), d(0) {}
+ Ctx(QCString name_, QCString type_) : name(name_), type(type_) {}
QCString name;
QCString type;
- const Definition *d;
+ const Definition *d = 0;
};
CallContext()
{
- m_defList.append(new Ctx("",""));
- m_defList.setAutoDelete(TRUE);
+ clear();
}
- virtual ~CallContext() {}
+
void setScope(const Definition *d)
{
- Ctx *ctx = m_defList.getLast();
- if (ctx)
- {
- DBG_CTX((stderr,"** Set call context %s (%p)\n",d==0 ? "<null>" : d->name().data(),d));
- ctx->d=d;
- }
+ Ctx &ctx = m_defList.back();
+ DBG_CTX((stderr,"** Set call context %s (%p)\n",d==0 ? "<null>" : d->name().data(),d));
+ ctx.d=d;
}
- void pushScope(QCString _name, QCString _type)
+ void pushScope(QCString name_, QCString type_)
{
- m_defList.append(new Ctx(_name,_type));
- DBG_CTX((stderr,"** Push call context %d\n",m_defList.count()));
+ m_defList.push_back(Ctx(name_,type_));
+ DBG_CTX((stderr,"** Push call context %zu\n",m_defList.size()));
}
- void popScope(QCString &_name, QCString &_type)
+ void popScope(QCString &name_, QCString &type_)
{
- if (m_defList.count()>1)
+ if (m_defList.size()>1)
{
- DBG_CTX((stderr,"** Pop call context %d\n",m_defList.count()));
- Ctx *ctx = m_defList.getLast();
- if (ctx)
- {
- _name = ctx->name;
- _type = ctx->type;
- }
- m_defList.removeLast();
+ DBG_CTX((stderr,"** Pop call context %zu\n",m_defList.size()));
+ const Ctx &ctx = m_defList.back();
+ name_ = ctx.name;
+ type_ = ctx.type;
+ m_defList.pop_back();
}
else
{
@@ -206,16 +180,15 @@ class CallContext
{
DBG_CTX((stderr,"** Clear call context\n"));
m_defList.clear();
- m_defList.append(new Ctx("",""));
+ m_defList.push_back(Ctx("",""));
}
const Definition *getScope() const
{
- Ctx *ctx = m_defList.getLast();
- if (ctx) return ctx->d; else return 0;
+ return m_defList.back().d;
}
private:
- QList<Ctx> m_defList;
+ std::vector<Ctx> m_defList;
};
@@ -223,7 +196,7 @@ struct codeYY_state
{
CodeOutputInterface * code = 0;
- ClassSDict *codeClassSDict = 0;
+ std::unordered_map< std::string, std::unique_ptr<ClassDef> > codeClassMap;
QCString curClassName;
QStrList curClassBases;
@@ -231,10 +204,10 @@ struct codeYY_state
QCString parmName;
const char * inputString = 0; //!< the code fragment as text
- yy_size_t inputPosition = 0; //!< read offset during parsing
+ yy_size_t inputPosition = 0; //!< read offset during parsing
int inputLines = 0; //!< number of line in the code fragment
- int yyLineNr = 0; //!< current line number
- int yyColNr = 0; //!< current column number
+ int yyLineNr = 0; //!< current line number
+ int yyColNr = 0; //!< current column number
bool needsTermination = FALSE;
bool exampleBlock = FALSE;
@@ -247,12 +220,12 @@ struct codeYY_state
QCString args;
QCString classScope;
QCString realScope;
- QStack<int> scopeStack; //!< 1 if bracket starts a scope,
- // 2 for internal blocks
+ std::stack<int> scopeStack; //!< 1 if bracket starts a scope,
+ // 2 for internal blocks
int anchorCount = 0;
FileDef * sourceFileDef = 0;
bool lineNumbers = FALSE;
- Definition * currentDefinition = 0;
+ const Definition * currentDefinition = 0;
MemberDef * currentMemberDef = 0;
bool includeCodeFragment = FALSE;
const char * currentFontClass = 0;
@@ -263,20 +236,20 @@ struct codeYY_state
QCString saveType;
QCString delimiter;
- int bracketCount = 0;
- int curlyCount = 0;
- int sharpCount = 0;
+ int bracketCount = 0;
+ int curlyCount = 0;
+ int sharpCount = 0;
bool inFunctionTryBlock = FALSE;
bool inForEachExpression = FALSE;
int lastTemplCastContext = 0;
- int lastSpecialCContext = 0;
+ int lastSpecialCContext = 0;
int lastStringContext = 0;
int lastSkipCppContext = 0;
int lastVerbStringContext = 0;
int lastObjCCallContext = 0;
int memCallContext = 0;
- int lastCContext = 0;
+ int lastCContext = 0;
int skipInlineInitContext = 0;
SrcLangExt lang = SrcLangExt_Unknown;
@@ -285,7 +258,7 @@ struct codeYY_state
bool lexInit = FALSE;
- QStack<int> classScopeLengthStack;
+ std::stack<int> classScopeLengthStack;
int prefixed_with_this_keyword = FALSE;
const Definition *searchCtx = 0;
@@ -297,12 +270,12 @@ struct codeYY_state
int currentObjId=0;
int currentWordId=0;
int currentCommentId=0;
- QStack<ObjCCallCtx> contextStack;
- QIntDict<ObjCCallCtx> contextDict;
- QIntDict<QCString> nameDict;
- QIntDict<QCString> objectDict;
- QIntDict<QCString> wordDict;
- QIntDict<QCString> commentDict;
+ std::stack<ObjCCallCtx*> contextStack;
+ std::unordered_map< int,std::unique_ptr<ObjCCallCtx> > contextMap;
+ std::unordered_map< int, QCString> nameMap;
+ std::unordered_map< int, QCString> objectMap;
+ std::unordered_map< int, QCString> wordMap;
+ std::unordered_map< int, QCString> commentMap;
int braceCount=0;
QCString forceTagReference;
@@ -338,21 +311,21 @@ static void addType(yyscan_t yyscanner);
static void addParmType(yyscan_t yyscanner);
static void addUsingDirective(yyscan_t yyscanner,const char *name);
static void setParameterList(yyscan_t yyscanner,const MemberDef *md);
-static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d);
+static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Definition *d);
static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name);
static void updateCallContextForSmartPointer(yyscan_t yyscanner);
static bool getLinkInScope(yyscan_t yyscanner,const QCString &c, // scope
const QCString &m, // member
- const char *memberText, // exact text
- CodeOutputInterface &ol,
- const char *text,
- bool varOnly=FALSE
- );
+ const char *memberText, // exact text
+ CodeOutputInterface &ol,
+ const char *text,
+ bool varOnly=FALSE
+ );
static bool getLink(yyscan_t yyscanner,const char *className,
const char *memberName,
- CodeOutputInterface &ol,
- const char *text=0,
- bool varOnly=FALSE);
+ CodeOutputInterface &ol,
+ const char *text=0,
+ bool varOnly=FALSE);
static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName,
bool typeOnly=FALSE,bool varOnly=FALSE);
static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef *xmd,const char *memName);
@@ -373,15 +346,15 @@ static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
/* -----------------------------------------------------------------
*/
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
%}
B [ \t]
BN [ \t\n\r]
-ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
+ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
SEP ("::"|"\\")
SCOPENAME ({SEP}{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID}
TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">"
@@ -436,12 +409,12 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
%x SkipString
%x SkipStringS
%x SkipVerbString
-%x SkipCPP
-%x SkipComment
-%x SkipCxxComment
-%x RemoveSpecialCComment
-%x StripSpecialCComment
-%x Body
+%x SkipCPP
+%x SkipComment
+%x SkipCxxComment
+%x RemoveSpecialCComment
+%x StripSpecialCComment
+%x Body
%x FuncCall
%x MemberCall
%x MemberCall2
@@ -451,22 +424,22 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
%x AlignAsEnd
%x PackageName
%x ClassVar
-%x CppCliTypeModifierFollowup
+%x CppCliTypeModifierFollowup
%x Bases
%x SkipSharp
%x ReadInclude
%x TemplDecl
%x TemplCast
-%x CallEnd
+%x CallEnd
%x ObjCMethod
-%x ObjCParams
-%x ObjCParamType
+%x ObjCParams
+%x ObjCParamType
%x ObjCCall
%x ObjCMName
%x ObjCSkipStr
%x ObjCCallComment
%x OldStyleArgs
-%x UsingName
+%x UsingName
%x RawString
%x InlineInit
@@ -474,486 +447,494 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
<*>\x0d
<Body>^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") {
- startFontClass(yyscanner,"preprocessor");
- yyextra->code->codify(yytext);
- BEGIN( ReadInclude );
- }
-<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
+ startFontClass(yyscanner,"preprocessor");
+ yyextra->code->codify(yytext);
+ BEGIN( ReadInclude );
+ }
+<Body>("@interface"|"@implementation"|"@protocol")[ \t\n]+ {
yyextra->insideObjC=TRUE;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- if (!yyextra->insideTemplate)
- BEGIN( ClassName );
- }
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ if (!yyextra->insideTemplate)
+ BEGIN( ClassName );
+ }
<Body>(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") {
- if (yyextra->insideTemplate) REJECT;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- BEGIN( ClassName );
- }
-<Body>"property"|"event"/{BN}* {
- if (yyextra->insideTemplate) REJECT;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
-<Body>(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- if (!yyextra->insideTemplate)
- BEGIN( ClassName );
- }
-<Body>("package")[ \t\n]+ {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- BEGIN( PackageName );
- }
-<ClassVar>\n {
- if (!yyextra->insideObjC) REJECT;
- codifyLines(yyscanner,yytext);
- BEGIN(Body);
- }
-<Body,ClassVar,Bases>"-"|"+" {
- if (!yyextra->insideObjC || yyextra->insideBody)
- {
- yyextra->code->codify(yytext);
- }
- else // Start of Objective-C method
- {
- //printf("Method!\n");
- yyextra->code->codify(yytext);
- BEGIN(ObjCMethod);
- }
- }
-<ObjCMethod>":" {
- yyextra->code->codify(yytext);
- BEGIN(ObjCParams);
- }
-<ObjCParams>"(" {
- yyextra->code->codify(yytext);
- BEGIN(ObjCParamType);
- }
-<ObjCParams,ObjCMethod>";"|"{" {
- yyextra->code->codify(yytext);
- if (*yytext=='{')
- {
- if (yyextra->searchingForBody)
- {
- yyextra->searchingForBody=FALSE;
- yyextra->insideBody=TRUE;
- }
- if (yyextra->insideBody) yyextra->bodyCurlyCount++;
- if (!yyextra->curClassName.isEmpty()) // valid class name
- {
- pushScope(yyscanner,yyextra->curClassName);
+ if (yyextra->insideTemplate) REJECT;
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( ClassName );
+ }
+<Body>"property"|"event"/{BN}* {
+ if (yyextra->insideTemplate) REJECT;
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Body>(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ if (!yyextra->insideTemplate)
+ BEGIN( ClassName );
+ }
+<Body>("package")[ \t\n]+ {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( PackageName );
+ }
+<ClassVar>\n {
+ if (!yyextra->insideObjC) REJECT;
+ codifyLines(yyscanner,yytext);
+ BEGIN(Body);
+ }
+<Body,ClassVar,Bases>"-"|"+" {
+ if (!yyextra->insideObjC || yyextra->insideBody)
+ {
+ yyextra->code->codify(yytext);
+ }
+ else // Start of Objective-C method
+ {
+ //printf("Method!\n");
+ yyextra->code->codify(yytext);
+ BEGIN(ObjCMethod);
+ }
+ }
+<ObjCMethod>":" {
+ yyextra->code->codify(yytext);
+ BEGIN(ObjCParams);
+ }
+<ObjCParams>"(" {
+ yyextra->code->codify(yytext);
+ BEGIN(ObjCParamType);
+ }
+<ObjCParams,ObjCMethod>";"|"{" {
+ yyextra->code->codify(yytext);
+ if (*yytext=='{')
+ {
+ if (yyextra->searchingForBody)
+ {
+ yyextra->searchingForBody=FALSE;
+ yyextra->insideBody=TRUE;
+ }
+ if (yyextra->insideBody) yyextra->bodyCurlyCount++;
+ if (!yyextra->curClassName.isEmpty()) // valid class name
+ {
+ pushScope(yyscanner,yyextra->curClassName);
DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n"));
- yyextra->scopeStack.push(SCOPEBLOCK);
- }
- }
+ yyextra->scopeStack.push(SCOPEBLOCK);
+ }
+ }
yyextra->type.resize(0);
yyextra->name.resize(0);
- BEGIN(Body);
- }
-<ObjCParams>{ID}{B}*":" {
- yyextra->code->codify(yytext);
- }
-<ObjCParamType>{TYPEKW} {
- startFontClass(yyscanner,"keywordtype");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- yyextra->parmType=yytext;
- }
-<ObjCParamType>{ID} {
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- yyextra->parmType=yytext;
- }
-<ObjCParamType>")" {
- yyextra->code->codify(yytext);
- BEGIN(ObjCParams);
- }
-<ObjCParams>{ID} {
- yyextra->code->codify(yytext);
- yyextra->parmName=yytext;
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- }
+ BEGIN(Body);
+ }
+<ObjCParams>{ID}{B}*":" {
+ yyextra->code->codify(yytext);
+ }
+<ObjCParamType>{TYPEKW} {
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ yyextra->parmType=yytext;
+ }
+<ObjCParamType>{ID} {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ yyextra->parmType=yytext;
+ }
+<ObjCParamType>")" {
+ yyextra->code->codify(yytext);
+ BEGIN(ObjCParams);
+ }
+<ObjCParams>{ID} {
+ yyextra->code->codify(yytext);
+ yyextra->parmName=yytext;
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ }
<ObjCMethod,ObjCParams,ObjCParamType>{ID} {
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
-<ObjCMethod,ObjCParams,ObjCParamType>. {
- yyextra->code->codify(yytext);
- }
-<ObjCMethod,ObjCParams,ObjCParamType>\n {
- codifyLines(yyscanner,yytext);
- }
-<ReadInclude>[^\n\"\>]+/(">"|"\"") {
- //FileInfo *f;
- bool ambig;
- bool found=FALSE;
- //QCString absPath = yytext;
- //if (yyextra->sourceFileDef && QDir::isRelativePath(absPath))
- //{
- // absPath = QDir::cleanDirPath(yyextra->sourceFileDef->getPath()+"/"+absPath);
- //}
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+<ObjCMethod,ObjCParams,ObjCParamType>. {
+ yyextra->code->codify(yytext);
+ }
+<ObjCMethod,ObjCParams,ObjCParamType>\n {
+ codifyLines(yyscanner,yytext);
+ }
+<ReadInclude>[^\n\"\>]+/(">"|"\"") {
+ //FileInfo *f;
+ bool ambig;
+ bool found=FALSE;
const FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,yytext,ambig);
- //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd);
- if (fd && fd->isLinkable())
- {
- if (ambig) // multiple input files match the name
- {
- //printf("===== yes %s is ambiguous\n",yytext);
- QCString name = QDir::cleanDirPath(yytext).utf8();
- if (!name.isEmpty() && yyextra->sourceFileDef)
- {
- FileName *fn = Doxygen::inputNameLinkedMap->find(name);
- if (fn)
- {
- // see if this source file actually includes the file
+ //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd);
+ if (fd && fd->isLinkable())
+ {
+ if (ambig) // multiple input files match the name
+ {
+ //printf("===== yes %s is ambiguous\n",yytext);
+ QCString name = QDir::cleanDirPath(yytext).utf8();
+ if (!name.isEmpty() && yyextra->sourceFileDef)
+ {
+ const FileName *fn = Doxygen::inputNameLinkedMap->find(name);
+ if (fn)
+ {
+ // see if this source file actually includes the file
auto it = std::find_if(fn->begin(),
fn->end(),
[&sfd=yyextra->sourceFileDef]
(const auto &lfd)
{ return sfd->isIncluded(lfd->absFilePath()); });
found = it!=fn->end();
- }
- }
- }
- else // not ambiguous
- {
- found = TRUE;
- }
- }
- //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found);
- if (found)
- {
- writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext);
- }
- else
- {
- yyextra->code->codify(yytext);
- }
- char c=(char)yyinput(yyscanner);
- QCString text;
- text+=c;
- yyextra->code->codify(text);
- endFontClass(yyscanner);
- BEGIN( Body );
- }
-<Body,Bases>^[ \t]*"#" {
- startFontClass(yyscanner,"preprocessor");
- yyextra->lastSkipCppContext = YY_START;
- yyextra->code->codify(yytext);
- BEGIN( SkipCPP ) ;
- }
-<SkipCPP>\" {
- yyextra->code->codify(yytext);
- yyextra->lastStringContext=YY_START;
- BEGIN( SkipString ) ;
- }
-<SkipCPP>. {
- yyextra->code->codify(yytext);
- }
-<SkipCPP>[^\n\/\\\"]+ {
- yyextra->code->codify(yytext);
- }
-<SkipCPP>\\[\r]?\n {
- codifyLines(yyscanner,yytext);
- }
-<SkipCPP>"//"/[^/!] {
- REJECT;
- yyextra->code->codify(yytext);
- }
-<Body,FuncCall>"{" {
+ }
+ }
+ }
+ else // not ambiguous
+ {
+ found = TRUE;
+ }
+ }
+ //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found);
+ if (found)
+ {
+ writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ }
+ char c=(char)yyinput(yyscanner);
+ QCString text;
+ text+=c;
+ yyextra->code->codify(text);
+ endFontClass(yyscanner);
+ BEGIN( Body );
+ }
+<Body,Bases>^[ \t]*"#" {
+ startFontClass(yyscanner,"preprocessor");
+ yyextra->lastSkipCppContext = YY_START;
+ yyextra->code->codify(yytext);
+ BEGIN( SkipCPP ) ;
+ }
+<SkipCPP>\" {
+ yyextra->code->codify(yytext);
+ yyextra->lastStringContext=YY_START;
+ BEGIN( SkipString ) ;
+ }
+<SkipCPP>. {
+ yyextra->code->codify(yytext);
+ }
+<SkipCPP>[^\n\/\\\"]+ {
+ yyextra->code->codify(yytext);
+ }
+<SkipCPP>\\[\r]?\n {
+ codifyLines(yyscanner,yytext);
+ }
+<SkipCPP>"//"/[^/!] {
+ REJECT;
+ yyextra->code->codify(yytext);
+ }
+<Body,FuncCall>"{" {
yyextra->theVarContext.pushScope();
DBG_CTX((stderr,"** scope stack push INNERBLOCK\n"));
- yyextra->scopeStack.push(INNERBLOCK);
-
- if (yyextra->searchingForBody)
- {
- yyextra->searchingForBody=FALSE;
- yyextra->insideBody=TRUE;
- }
- yyextra->code->codify(yytext);
- if (yyextra->insideBody)
- {
- yyextra->bodyCurlyCount++;
- }
- yyextra->type.resize(0);
- yyextra->name.resize(0);
- BEGIN( Body );
- }
-<Body,FuncCall,MemberCall,MemberCall2>"}" {
+ yyextra->scopeStack.push(INNERBLOCK);
+
+ if (yyextra->searchingForBody)
+ {
+ yyextra->searchingForBody=FALSE;
+ yyextra->insideBody=TRUE;
+ }
+ yyextra->code->codify(yytext);
+ if (yyextra->insideBody)
+ {
+ yyextra->bodyCurlyCount++;
+ }
+ yyextra->type.resize(0);
+ yyextra->name.resize(0);
+ BEGIN( Body );
+ }
+<Body,FuncCall,MemberCall,MemberCall2>"}" {
yyextra->theVarContext.popScope();
- yyextra->type.resize(0);
- yyextra->name.resize(0);
-
- int *scope = yyextra->scopeStack.pop();
- DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK));
- if (scope==SCOPEBLOCK || scope==CLASSBLOCK)
- {
- popScope(yyscanner);
- }
-
- yyextra->code->codify(yytext);
-
- DBG_CTX((stderr,"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
- if (--yyextra->bodyCurlyCount<=0)
- {
- yyextra->insideBody=FALSE;
- yyextra->currentMemberDef=0;
- if (yyextra->currentDefinition)
- yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
- }
- BEGIN(Body);
- }
-<Body,ClassVar>"@end" {
- //printf("End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data());
+ yyextra->type.resize(0);
+ yyextra->name.resize(0);
+
+ if (!yyextra->scopeStack.empty())
+ {
+ int scope = yyextra->scopeStack.top();
+ yyextra->scopeStack.pop();
+ DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK));
+ if (scope==SCOPEBLOCK || scope==CLASSBLOCK)
+ {
+ popScope(yyscanner);
+ }
+ }
+
+ yyextra->code->codify(yytext);
+
+ DBG_CTX((stderr,"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount));
+ if (--yyextra->bodyCurlyCount<=0)
+ {
+ yyextra->insideBody=FALSE;
+ yyextra->currentMemberDef=0;
+ if (yyextra->currentDefinition)
+ yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
+ }
+ BEGIN(Body);
+ }
+<Body,ClassVar>"@end" {
+ //printf("End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data());
if (yyextra->sourceFileDef)
- {
- FileDef *fd=yyextra->sourceFileDef;
- yyextra->insideObjC = fd->name().lower().right(2)==".m" ||
- fd->name().lower().right(3)==".mm";
- //printf("insideObjC=%d\n",yyextra->insideObjC);
- }
- else
- {
- yyextra->insideObjC = FALSE;
- }
- if (yyextra->insideBody)
- {
+ {
+ const FileDef *fd=yyextra->sourceFileDef;
+ yyextra->insideObjC = fd->name().lower().right(2)==".m" ||
+ fd->name().lower().right(3)==".mm";
+ //printf("insideObjC=%d\n",yyextra->insideObjC);
+ }
+ else
+ {
+ yyextra->insideObjC = FALSE;
+ }
+ if (yyextra->insideBody)
+ {
yyextra->theVarContext.popScope();
- int *scope = yyextra->scopeStack.pop();
- DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK));
- if (scope==SCOPEBLOCK || scope==CLASSBLOCK)
- {
- popScope(yyscanner);
- }
- yyextra->insideBody=FALSE;
- }
-
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
-
- yyextra->currentMemberDef=0;
- if (yyextra->currentDefinition)
- yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
- BEGIN(Body);
- }
-<ClassName,ClassVar>";" {
- yyextra->code->codify(yytext);
- yyextra->searchingForBody=FALSE;
- BEGIN( Body );
- }
-<ClassName,ClassVar>[*&^%]+ {
- yyextra->type=yyextra->curClassName.copy();
- yyextra->name.resize(0);
- yyextra->code->codify(yytext);
- BEGIN( Body ); // variable of type struct *
- }
-<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
-<ClassName>{ID}("."{ID})* |
-<ClassName>{ID}("::"{ID})* {
+ if (!yyextra->scopeStack.empty())
+ {
+ int scope = yyextra->scopeStack.top();
+ yyextra->scopeStack.pop();
+ DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK));
+ if (scope==SCOPEBLOCK || scope==CLASSBLOCK)
+ {
+ popScope(yyscanner);
+ }
+ }
+ yyextra->insideBody=FALSE;
+ }
+
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+
+ yyextra->currentMemberDef=0;
+ if (yyextra->currentDefinition)
+ yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
+ BEGIN(Body);
+ }
+<ClassName,ClassVar>";" {
+ yyextra->code->codify(yytext);
+ yyextra->searchingForBody=FALSE;
+ BEGIN( Body );
+ }
+<ClassName,ClassVar>[*&^%]+ {
+ yyextra->type=yyextra->curClassName.copy();
+ yyextra->name.resize(0);
+ yyextra->code->codify(yytext);
+ BEGIN( Body ); // variable of type struct *
+ }
+<ClassName>"__declspec"{B}*"("{B}*{ID}{B}*")" {
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<ClassName>{ID}("."{ID})* |
+<ClassName>{ID}("::"{ID})* {
if (yyextra->lang==SrcLangExt_CSharp)
yyextra->curClassName=substitute(yytext,".","::");
else
yyextra->curClassName=yytext;
- addType(yyscanner);
+ addType(yyscanner);
if (yyextra->curClassName=="alignas")
{
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
endFontClass(yyscanner);
BEGIN( AlignAs );
}
else
{
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- BEGIN( ClassVar );
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN( ClassVar );
}
- }
-<AlignAs>"(" {
+ }
+<AlignAs>"(" {
yyextra->bracketCount=1;
- yyextra->code->codify(yytext);
+ yyextra->code->codify(yytext);
BEGIN( AlignAsEnd );
}
-<AlignAs>\n { yyextra->yyLineNr++;
+<AlignAs>\n { yyextra->yyLineNr++;
codifyLines(yyscanner,yytext);
}
<AlignAs>. { yyextra->code->codify(yytext); }
<AlignAsEnd>"(" { yyextra->code->codify(yytext);
- yyextra->bracketCount++;
+ yyextra->bracketCount++;
}
-<AlignAsEnd>")" {
+<AlignAsEnd>")" {
yyextra->code->codify(yytext);
if (--yyextra->bracketCount<=0)
{
BEGIN(ClassName);
}
}
-<AlignAsEnd>\n { yyextra->yyLineNr++;
- codifyLines(yyscanner,yytext);
+<AlignAsEnd>\n { yyextra->yyLineNr++;
+ codifyLines(yyscanner,yytext);
}
<AlignAsEnd>. { yyextra->code->codify(yytext); }
-<ClassName>{ID}("\\"{ID})* { // PHP namespace
+<ClassName>{ID}("\\"{ID})* { // PHP namespace
yyextra->curClassName=substitute(yytext,"\\","::");
- yyextra->scopeStack.push(CLASSBLOCK);
- pushScope(yyscanner,yyextra->curClassName);
- addType(yyscanner);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- BEGIN( ClassVar );
- }
+ yyextra->scopeStack.push(CLASSBLOCK);
+ pushScope(yyscanner,yyextra->curClassName);
+ addType(yyscanner);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN( ClassVar );
+ }
<ClassName>{ID}{B}*"("{ID}")" { // Obj-C category
yyextra->curClassName=removeRedundantWhiteSpace(yytext);
- yyextra->scopeStack.push(CLASSBLOCK);
- pushScope(yyscanner,yyextra->curClassName);
- addType(yyscanner);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- BEGIN( ClassVar );
- }
-<PackageName>{ID}("."{ID})* {
- yyextra->curClassName=substitute(yytext,".","::");
- //printf("found package: %s\n",yyextra->curClassName.data());
- addType(yyscanner);
- codifyLines(yyscanner,yytext);
- }
-<ClassVar>"=" {
- unput(*yytext);
- BEGIN( Body );
- }
-<ClassVar>("extends"|"implements") { // Java, Slice
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- yyextra->curClassBases.clear();
- BEGIN( Bases );
- }
+ yyextra->scopeStack.push(CLASSBLOCK);
+ pushScope(yyscanner,yyextra->curClassName);
+ addType(yyscanner);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN( ClassVar );
+ }
+<PackageName>{ID}("."{ID})* {
+ yyextra->curClassName=substitute(yytext,".","::");
+ //printf("found package: %s\n",yyextra->curClassName.data());
+ addType(yyscanner);
+ codifyLines(yyscanner,yytext);
+ }
+<ClassVar>"=" {
+ unput(*yytext);
+ BEGIN( Body );
+ }
+<ClassVar>("extends"|"implements") { // Java, Slice
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yyextra->curClassBases.clear();
+ BEGIN( Bases );
+ }
<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
- DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,yyextra->curClassName.data()));
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- BEGIN( CppCliTypeModifierFollowup );
- }
-<ClassVar>{ID} {
- yyextra->type = yyextra->curClassName.copy();
- yyextra->name = yytext;
- if (yyextra->insideBody)
- {
- yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
- }
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
-<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
- codifyLines(yyscanner,yytext);
- yyextra->curClassBases.clear();
- BEGIN( Bases );
- }
-<PackageName>[ \t]*";" |
+ DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,yyextra->curClassName.data()));
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( CppCliTypeModifierFollowup );
+ }
+<ClassVar>{ID} {
+ yyextra->type = yyextra->curClassName.copy();
+ yyextra->name = yytext;
+ if (yyextra->insideBody)
+ {
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
+ }
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+<ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*":"{B}* {
+ codifyLines(yyscanner,yytext);
+ yyextra->curClassBases.clear();
+ BEGIN( Bases );
+ }
+<PackageName>[ \t]*";" |
<Bases>^{B}*/"@"{ID} | // Objective-C interface
<Bases,ClassName,ClassVar,CppCliTypeModifierFollowup>{B}*"{"{B}* {
yyextra->theVarContext.pushScope();
- yyextra->code->codify(yytext);
- if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
- {
- yyextra->curClassName = yyextra->name.copy();
- }
- if (yyextra->searchingForBody)
- {
- yyextra->searchingForBody=FALSE;
- yyextra->insideBody=TRUE;
- }
- if (yyextra->insideBody) yyextra->bodyCurlyCount++;
- if (!yyextra->curClassName.isEmpty()) // valid class name
- {
+ yyextra->code->codify(yytext);
+ if (YY_START==ClassVar && yyextra->curClassName.isEmpty())
+ {
+ yyextra->curClassName = yyextra->name.copy();
+ }
+ if (yyextra->searchingForBody)
+ {
+ yyextra->searchingForBody=FALSE;
+ yyextra->insideBody=TRUE;
+ }
+ if (yyextra->insideBody) yyextra->bodyCurlyCount++;
+ if (!yyextra->curClassName.isEmpty()) // valid class name
+ {
DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n"));
- yyextra->scopeStack.push(CLASSBLOCK);
- pushScope(yyscanner,yyextra->curClassName);
- DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",yyextra->curClassName.data()));
- if (getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->curClassName)==0)
- {
- DBG_CTX((stderr,"Adding new class %s\n",yyextra->curClassName.data()));
- ClassDef *ncd=createClassDef("<code>",1,1,
- yyextra->curClassName,ClassDef::Class,0,0,FALSE);
- yyextra->codeClassSDict->append(yyextra->curClassName,ncd);
- // insert base classes.
- char *s=yyextra->curClassBases.first();
- while (s)
- {
- const ClassDef *bcd=yyextra->codeClassSDict->find(s);
- if (bcd==0) bcd=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,s);
- if (bcd && bcd!=ncd)
- {
- ncd->insertBaseClass(const_cast<ClassDef*>(bcd),s,Public,Normal);
- }
- s=yyextra->curClassBases.next();
- }
- }
- //printf("yyextra->codeClassList.count()=%d\n",yyextra->codeClassList.count());
- }
- else // not a class name -> assume inner block
- {
+ yyextra->scopeStack.push(CLASSBLOCK);
+ pushScope(yyscanner,yyextra->curClassName);
+ DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",yyextra->curClassName.data()));
+ if (getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->curClassName)==0)
+ {
+ DBG_CTX((stderr,"Adding new class %s\n",yyextra->curClassName.data()));
+ std::unique_ptr<ClassDef> ncd { createClassDef("<code>",1,1,
+ yyextra->curClassName,ClassDef::Class,0,0,FALSE) };
+ // insert base classes.
+ char *s=yyextra->curClassBases.first();
+ while (s)
+ {
+ const ClassDef *bcd=0;
+ auto it = yyextra->codeClassMap.find(s);
+ if (it!=yyextra->codeClassMap.end())
+ {
+ bcd=it->second.get();
+ }
+ if (bcd==0) bcd=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,s);
+ if (bcd && bcd!=ncd.get())
+ {
+ ncd->insertBaseClass(const_cast<ClassDef*>(bcd),s,Public,Normal);
+ }
+ s=yyextra->curClassBases.next();
+ }
+ yyextra->codeClassMap.emplace(std::make_pair(yyextra->curClassName.str(),std::move(ncd)));
+ }
+ //printf("yyextra->codeClassList.count()=%d\n",yyextra->codeClassList.count());
+ }
+ else // not a class name -> assume inner block
+ {
DBG_CTX((stderr,"** scope stack push INNERBLOCK\n"));
- yyextra->scopeStack.push(INNERBLOCK);
- }
- yyextra->curClassName.resize(0);
- yyextra->curClassBases.clear();
- BEGIN( Body );
- }
-<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
-<Bases>{SEP}?({ID}{SEP})*{ID} {
- DBG_CTX((stderr,"%s:addBase(%s)\n",yyextra->curClassName.data(),yytext));
- yyextra->curClassBases.inSort(yytext);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
-<Bases>"<" {
- yyextra->code->codify(yytext);
- if (!yyextra->insideObjC)
- {
- yyextra->sharpCount=1;
- BEGIN ( SkipSharp );
- }
- else
- {
- yyextra->insideProtocolList=TRUE;
- }
- }
-<Bases>">" {
- yyextra->code->codify(yytext);
- yyextra->insideProtocolList=FALSE;
- }
+ yyextra->scopeStack.push(INNERBLOCK);
+ }
+ yyextra->curClassName.resize(0);
+ yyextra->curClassBases.clear();
+ BEGIN( Body );
+ }
+<Bases>"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" {
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Bases>{SEP}?({ID}{SEP})*{ID} {
+ DBG_CTX((stderr,"%s:addBase(%s)\n",yyextra->curClassName.data(),yytext));
+ yyextra->curClassBases.inSort(yytext);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+<Bases>"<" {
+ yyextra->code->codify(yytext);
+ if (!yyextra->insideObjC)
+ {
+ yyextra->sharpCount=1;
+ BEGIN ( SkipSharp );
+ }
+ else
+ {
+ yyextra->insideProtocolList=TRUE;
+ }
+ }
+<Bases>">" {
+ yyextra->code->codify(yytext);
+ yyextra->insideProtocolList=FALSE;
+ }
<SkipSharp>"<" {
- yyextra->code->codify(yytext);
- ++yyextra->sharpCount;
- }
-<SkipSharp>">" {
- yyextra->code->codify(yytext);
- if (--yyextra->sharpCount<=0)
- BEGIN ( Bases );
- }
+ yyextra->code->codify(yytext);
+ ++yyextra->sharpCount;
+ }
+<SkipSharp>">" {
+ yyextra->code->codify(yytext);
+ if (--yyextra->sharpCount<=0)
+ BEGIN ( Bases );
+ }
<SkipSharp>"\"" {
- yyextra->code->codify(yytext);
- yyextra->lastStringContext=YY_START;
+ yyextra->code->codify(yytext);
+ yyextra->lastStringContext=YY_START;
BEGIN(SkipString);
}
<SkipSharp>"\'" {
- yyextra->code->codify(yytext);
- yyextra->lastStringContext=YY_START;
+ yyextra->code->codify(yytext);
+ yyextra->lastStringContext=YY_START;
BEGIN(SkipStringS);
}
<Bases>"(" {
@@ -970,106 +951,106 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
if (--yyextra->sharpCount<=0)
BEGIN ( Bases );
}
-
-
-<Bases>"," {
- yyextra->code->codify(yytext);
- }
-
+
+
+<Bases>"," {
+ yyextra->code->codify(yytext);
+ }
+
<Body>{SCOPEPREFIX}?"operator"{B}*"()"{B}*/"(" {
- addType(yyscanner);
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- yyextra->bracketCount=0;
- yyextra->args.resize(0);
- yyextra->name+=yytext;
- BEGIN( FuncCall );
- }
+ addType(yyscanner);
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ yyextra->bracketCount=0;
+ yyextra->args.resize(0);
+ yyextra->name+=yytext;
+ BEGIN( FuncCall );
+ }
<Body>{SCOPEPREFIX}?"operator"/"(" {
- addType(yyscanner);
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- yyextra->bracketCount=0;
- yyextra->args.resize(0);
- yyextra->name+=yytext;
- BEGIN( FuncCall );
+ addType(yyscanner);
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ yyextra->bracketCount=0;
+ yyextra->args.resize(0);
+ yyextra->name+=yytext;
+ BEGIN( FuncCall );
}
<Body>{SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" {
- addType(yyscanner);
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- yyextra->bracketCount=0;
- yyextra->args.resize(0);
- yyextra->name+=yytext;
- BEGIN( FuncCall );
- }
-<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- yyextra->insideTemplate=TRUE;
- yyextra->sharpCount=0;
- }
-<Body>"using"{BN}+"namespace"{BN}+ {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- BEGIN(UsingName);
- }
-<UsingName>{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ addType(yyscanner);
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ yyextra->bracketCount=0;
+ yyextra->args.resize(0);
+ yyextra->name+=yytext;
+ BEGIN( FuncCall );
+ }
+<Body,TemplDecl>("template"|"generic")/([^a-zA-Z0-9]) {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yyextra->insideTemplate=TRUE;
+ yyextra->sharpCount=0;
+ }
+<Body>"using"{BN}+"namespace"{BN}+ {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN(UsingName);
+ }
+<UsingName>{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n"));
- yyextra->scopeStack.push(CLASSBLOCK);
- pushScope(yyscanner,yytext);
- BEGIN(Body);
+ yyextra->scopeStack.push(CLASSBLOCK);
+ pushScope(yyscanner,yytext);
+ BEGIN(Body);
}
-<UsingName>\n { codifyLines(yyscanner,yytext); BEGIN(Body); }
-<UsingName>. { codifyLines(yyscanner,yytext); BEGIN(Body); }
-<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C#
- yyextra->prefixed_with_this_keyword = TRUE;
+<UsingName>\n { codifyLines(yyscanner,yytext); BEGIN(Body); }
+<UsingName>. { codifyLines(yyscanner,yytext); BEGIN(Body); }
+<Body,FuncCall>"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C#
+ yyextra->prefixed_with_this_keyword = TRUE;
}
-<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
+<Body>{KEYWORD}/([^a-z_A-Z0-9]) {
if (yyextra->lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT;
if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- if (QCString(yytext)=="typedef")
- {
- addType(yyscanner);
- yyextra->name+=yytext;
- }
- endFontClass(yyscanner);
- }
-<Body>{KEYWORD}/{B}* {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ if (QCString(yytext)=="typedef")
+ {
+ addType(yyscanner);
+ yyextra->name+=yytext;
+ }
+ endFontClass(yyscanner);
+ }
+<Body>{KEYWORD}/{B}* {
if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
-<Body>{KEYWORD}/{BN}*"(" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Body>{KEYWORD}/{BN}*"(" {
if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT;
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- yyextra->name.resize(0);yyextra->type.resize(0);
- }
-<FuncCall>"in"/{BN}* {
- if (!yyextra->inForEachExpression) REJECT;
- startFontClass(yyscanner,"keywordflow");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- // insert the variable in the parent scope, see bug 546158
- yyextra->theVarContext.popScope();
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- yyextra->theVarContext.pushScope();
- yyextra->name.resize(0);yyextra->type.resize(0);
- }
-<Body>{FLOWKW}/{BN}*"(" {
- startFontClass(yyscanner,"keywordflow");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- yyextra->name.resize(0);yyextra->type.resize(0);
- yyextra->inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0);
- BEGIN(FuncCall);
- }
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ }
+<FuncCall>"in"/{BN}* {
+ if (!yyextra->inForEachExpression) REJECT;
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ // insert the variable in the parent scope, see bug 546158
+ yyextra->theVarContext.popScope();
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ yyextra->theVarContext.pushScope();
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ }
+<Body>{FLOWKW}/{BN}*"(" {
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ yyextra->inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0);
+ BEGIN(FuncCall);
+ }
<Body>{FLOWCONDITION}/{BN}*"(" {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
@@ -1082,16 +1063,16 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
yyextra->inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0);
BEGIN(FuncCall);
}
-<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
- startFontClass(yyscanner,"keywordflow");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- if (yyextra->inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0))
- {
- yyextra->inFunctionTryBlock=FALSE;
- }
- }
-<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
+<Body>{FLOWKW}/([^a-z_A-Z0-9]) {
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ if (yyextra->inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0))
+ {
+ yyextra->inFunctionTryBlock=FALSE;
+ }
+ }
+<Body>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
yyextra->currentMemberDef->incrementFlowKeyWordCount();
@@ -1104,11 +1085,11 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
yyextra->inFunctionTryBlock=FALSE;
}
}
-<Body>{FLOWKW}/{B}* {
- startFontClass(yyscanner,"keywordflow");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
+<Body>{FLOWKW}/{B}* {
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
<Body>{FLOWCONDITION}/{B}* {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
@@ -1119,32 +1100,32 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
endFontClass(yyscanner);
}
<Body>"*"{B}*")" { // end of cast?
- yyextra->code->codify(yytext);
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->bracketCount--;
+ yyextra->code->codify(yytext);
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->bracketCount--;
yyextra->parmType = yyextra->name;
- BEGIN(FuncCall);
+ BEGIN(FuncCall);
}
<Body>"\\)"|"\\(" {
yyextra->code->codify(yytext);
}
-<Body>[\\|\)\+\-\/\%\~\!] {
- yyextra->code->codify(yytext);
- yyextra->name.resize(0);yyextra->type.resize(0);
- if (*yytext==')')
- {
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->bracketCount--;
- BEGIN(FuncCall);
- }
- }
+<Body>[\\|\)\+\-\/\%\~\!] {
+ yyextra->code->codify(yytext);
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ if (*yytext==')')
+ {
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->bracketCount--;
+ BEGIN(FuncCall);
+ }
+ }
<Body,TemplDecl,ObjCMethod>{TYPEKW}/{B}* {
- startFontClass(yyscanner,"keywordtype");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- addType(yyscanner);
- yyextra->name+=yytext;
- }
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ addType(yyscanner);
+ yyextra->name+=yytext;
+ }
<Body,TemplDecl,ObjCMethod>{TYPEKWSL}/{B}* {
if (yyextra->lang!=SrcLangExt_Slice)
{
@@ -1152,394 +1133,395 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
}
else
{
- startFontClass(yyscanner,"keywordtype");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- addType(yyscanner);
- yyextra->name+=yytext;
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ addType(yyscanner);
+ yyextra->name+=yytext;
}
- }
+ }
<Body>"generic"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* {
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- yyextra->sharpCount=0;
- BEGIN(TemplDecl);
- }
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ yyextra->sharpCount=0;
+ BEGIN(TemplDecl);
+ }
<Body>"template"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* { // template<...>
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- yyextra->sharpCount=0;
- BEGIN(TemplDecl);
- }
-<TemplDecl>"class"|"typename" {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
-<TemplDecl>"<" {
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ yyextra->sharpCount=0;
+ BEGIN(TemplDecl);
+ }
+<TemplDecl>"class"|"typename" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<TemplDecl>"<" {
yyextra->code->codify(yytext);
yyextra->sharpCount++;
- }
-<TemplDecl>">" {
+ }
+<TemplDecl>">" {
yyextra->code->codify(yytext);
yyextra->sharpCount--;
- if (yyextra->sharpCount<=0)
- {
- BEGIN(Body);
- }
- }
-<TemplCast>">" {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastTemplCastContext );
- }
-<TemplCast>{ID}("::"{ID})* {
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
-<TemplCast>("const"|"volatile"){B}* {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
-<TemplCast>[*^]* {
- codifyLines(yyscanner,yytext);
- }
+ if (yyextra->sharpCount<=0)
+ {
+ BEGIN(Body);
+ }
+ }
+<TemplCast>">" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastTemplCastContext );
+ }
+<TemplCast>{ID}("::"{ID})* {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+<TemplCast>("const"|"volatile"){B}* {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<TemplCast>[*^]* {
+ codifyLines(yyscanner,yytext);
+ }
<Body,MemberCall2,FuncCall>{CASTKW}{B}*"<" { // static_cast<T>(
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
yyextra->lastTemplCastContext = YY_START;
- BEGIN(TemplCast);
- }
+ BEGIN(TemplCast);
+ }
<Body>"$this->"{SCOPENAME}/{BN}*[;,)\]] { // PHP member variable
- addType(yyscanner);
- generatePHPVariableLink(yyscanner,*yyextra->code,yytext);
- yyextra->name+=yytext+7;
+ addType(yyscanner);
+ generatePHPVariableLink(yyscanner,*yyextra->code,yytext);
+ yyextra->name+=yytext+7;
}
<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\"\>\(]*">"("::"{ID})*/{B}* { // A<T> *pt;
- if (isCastKeyword(yytext) && YY_START==Body)
- {
- REJECT;
- }
- addType(yyscanner);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- yyextra->name+=yytext;
- }
-<Body>{SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5;
- addType(yyscanner);
- // changed this to generateFunctionLink, see bug 624514
- //generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,FALSE,TRUE);
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- yyextra->name+=yytext;
- }
-<Body>{SCOPENAME}/{B}* { // p->func()
- addType(yyscanner);
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- yyextra->name+=yytext;
- }
-<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* { // (*p)->func() but not "if (p) ..."
- yyextra->code->codify(yytext);
- uint s=0;while (s<(uint)yyleng && !isId(yytext[s])) s++;
+ if (isCastKeyword(yytext) && YY_START==Body)
+ {
+ REJECT;
+ }
+ addType(yyscanner);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ yyextra->name+=yytext;
+ }
+<Body>{SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5;
+ addType(yyscanner);
+ // changed this to generateFunctionLink, see bug 624514
+ //generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,FALSE,TRUE);
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ yyextra->name+=yytext;
+ }
+<Body>{SCOPENAME}/{B}* { // p->func()
+ addType(yyscanner);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ yyextra->name+=yytext;
+ }
+<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* { // (*p)->func() but not "if (p) ..."
+ yyextra->code->codify(yytext);
+ uint s=0;while (s<(uint)yyleng && !isId(yytext[s])) s++;
uint e=(uint)yyleng-1;while (e>1 && !isId(yytext[e])) e--;
- QCString varname = ((QCString)yytext).mid(s,e-s+1);
- addType(yyscanner);
- yyextra->name=varname;
- }
+ QCString varname = ((QCString)yytext).mid(s,e-s+1);
+ addType(yyscanner);
+ yyextra->name=varname;
+ }
<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\"\>]*">"/{BN}*"(" |
-<Body>{SCOPETNAME}/{BN}*"(" { // a() or c::a() or t<A,B>::a() or A\B\foo()
- if (isCastKeyword(yytext))
- {
- REJECT;
- }
- addType(yyscanner);
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- yyextra->bracketCount=0;
- yyextra->args.resize(0);
- yyextra->name+=yytext;
- BEGIN( FuncCall );
- }
-<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
+<Body>{SCOPETNAME}/{BN}*"(" { // a() or c::a() or t<A,B>::a() or A\B\foo()
+ if (isCastKeyword(yytext))
+ {
+ REJECT;
+ }
+ addType(yyscanner);
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ yyextra->bracketCount=0;
+ yyextra->args.resize(0);
+ yyextra->name+=yytext;
+ BEGIN( FuncCall );
+ }
+<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} {
QCString text=yytext;
uint i=(uint)text.find('R');
yyextra->code->codify(text.left(i+1));
- startFontClass(yyscanner,"stringliteral");
- yyextra->code->codify(yytext+i+1);
- yyextra->lastStringContext=YY_START;
- yyextra->inForEachExpression = FALSE;
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->code->codify(yytext+i+1);
+ yyextra->lastStringContext=YY_START;
+ yyextra->inForEachExpression = FALSE;
yyextra->delimiter = yytext+i+2;
yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
- BEGIN( RawString );
- }
-<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\" {
- startFontClass(yyscanner,"stringliteral");
- yyextra->code->codify(yytext);
- yyextra->lastStringContext=YY_START;
- yyextra->inForEachExpression = FALSE;
- BEGIN( SkipString );
- }
+ BEGIN( RawString );
+ }
+<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\" {
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->code->codify(yytext);
+ yyextra->lastStringContext=YY_START;
+ yyextra->inForEachExpression = FALSE;
+ BEGIN( SkipString );
+ }
<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{NUMBER} { //Note similar code in commentcnv.l
if (yyextra->lang!=SrcLangExt_Cpp) REJECT;
- yyextra->code->codify(yytext);
- }
-<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
- startFontClass(yyscanner,"stringliteral");
- yyextra->code->codify(yytext);
- yyextra->lastStringContext=YY_START;
- yyextra->inForEachExpression = FALSE;
- BEGIN( SkipStringS );
- }
-<SkipString>[^\"\\\r\n]* {
- yyextra->code->codify(yytext);
- }
-<SkipStringS>[^\'\\\r\n]* {
- yyextra->code->codify(yytext);
- }
-<SkipString,SkipStringS>"//"|"/*" {
- yyextra->code->codify(yytext);
- }
-<SkipString>@?\" {
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastStringContext );
- }
-<SkipStringS>\' {
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastStringContext );
- }
-<SkipString,SkipStringS>\\. {
- yyextra->code->codify(yytext);
- }
-<RawString>{RAWEND} {
+ yyextra->code->codify(yytext);
+ }
+<FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>\' {
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->code->codify(yytext);
+ yyextra->lastStringContext=YY_START;
+ yyextra->inForEachExpression = FALSE;
+ BEGIN( SkipStringS );
+ }
+<SkipString>[^\"\\\r\n]* {
+ yyextra->code->codify(yytext);
+ }
+<SkipStringS>[^\'\\\r\n]* {
+ yyextra->code->codify(yytext);
+ }
+<SkipString,SkipStringS>"//"|"/*" {
+ yyextra->code->codify(yytext);
+ }
+<SkipString>@?\" {
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastStringContext );
+ }
+<SkipStringS>\' {
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastStringContext );
+ }
+<SkipString,SkipStringS>\\. {
+ yyextra->code->codify(yytext);
+ }
+<RawString>{RAWEND} {
yyextra->code->codify(yytext);
QCString delimiter = yytext+1;
delimiter=delimiter.left(delimiter.length()-1);
if (delimiter==yyextra->delimiter)
{
- BEGIN( yyextra->lastStringContext );
+ BEGIN( yyextra->lastStringContext );
}
}
<RawString>[^)\n]+ { yyextra->code->codify(yytext); }
<RawString>. { yyextra->code->codify(yytext); }
<RawString>\n { codifyLines(yyscanner,yytext); }
-<SkipVerbString>[^"\n]+ {
- yyextra->code->codify(yytext);
- }
-<SkipVerbString>\"\" { // escaped quote
- yyextra->code->codify(yytext);
- }
-<SkipVerbString>\" { // end of string
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastVerbStringContext );
- }
-<SkipVerbString>. {
- yyextra->code->codify(yytext);
- }
-<SkipVerbString>\n {
- codifyLines(yyscanner,yytext);
- }
-<Body>":" {
- yyextra->code->codify(yytext);
- yyextra->name.resize(0);yyextra->type.resize(0);
- }
-<Body>"<" {
- if (yyextra->insideTemplate)
- {
- yyextra->sharpCount++;
- }
- yyextra->code->codify(yytext);
- }
-<Body>">" {
- if (yyextra->insideTemplate)
- {
- if (--yyextra->sharpCount<=0)
- {
- yyextra->insideTemplate=FALSE;
- }
- }
- yyextra->code->codify(yytext);
- }
-<Body,MemberCall,MemberCall2,FuncCall>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
- startFontClass(yyscanner,"charliteral");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
-<Body>"."|"->" {
- if (yytext[0]=='-') // -> could be overloaded
- {
- updateCallContextForSmartPointer(yyscanner);
- }
- yyextra->code->codify(yytext);
- yyextra->memCallContext = YY_START;
- BEGIN( MemberCall );
- }
-<MemberCall>{SCOPETNAME}/{BN}*"(" {
- if (yyextra->theCallContext.getScope())
- {
- if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext))
- {
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yytext);
- }
- yyextra->name.resize(0);
- }
- else
- {
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yytext);
- yyextra->name.resize(0);
- }
- yyextra->type.resize(0);
- if (yyextra->memCallContext==Body)
- {
- BEGIN(FuncCall);
- }
- else
- {
- BEGIN(yyextra->memCallContext);
- }
- }
-<MemberCall>{SCOPENAME}/{B}* {
- if (yyextra->theCallContext.getScope())
- {
- DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",yyextra->theCallContext.getScope()));
- if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext))
- {
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yytext);
- }
- yyextra->name.resize(0);
- }
- else
- {
- DBG_CTX((stderr,"no class context!\n"));
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yytext);
- yyextra->name.resize(0);
- }
- yyextra->type.resize(0);
- BEGIN(yyextra->memCallContext);
- }
-<Body>[,=;\[] {
- if (yyextra->insideObjC && *yytext=='[')
- {
- //printf("Found start of ObjC call!\n");
- // start of a method call
- yyextra->contextDict.setAutoDelete(TRUE);
- yyextra->nameDict.setAutoDelete(TRUE);
- yyextra->objectDict.setAutoDelete(TRUE);
- yyextra->wordDict.setAutoDelete(TRUE);
- yyextra->commentDict.setAutoDelete(TRUE);
- yyextra->contextDict.clear();
- yyextra->nameDict.clear();
- yyextra->objectDict.clear();
- yyextra->wordDict.clear();
- yyextra->commentDict.clear();
- yyextra->currentCtxId = 0;
- yyextra->currentNameId = 0;
- yyextra->currentObjId = 0;
- yyextra->currentCtx = 0;
- yyextra->braceCount = 0;
- unput('[');
- BEGIN(ObjCCall);
- }
- else
- {
- yyextra->code->codify(yytext);
- yyextra->saveName = yyextra->name.copy();
- yyextra->saveType = yyextra->type.copy();
- if (*yytext!='[' && !yyextra->type.isEmpty())
- {
- //printf("yyextra->scopeStack.bottom()=%p\n",yyextra->scopeStack.bottom());
- //if (yyextra->scopeStack.top()!=CLASSBLOCK) // commented out for bug731363
- {
- //printf("AddVariable: '%s' '%s' context=%d\n",
- // yyextra->type.data(),yyextra->name.data(),yyextra->theVarContext.count());
- yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
- }
- yyextra->name.resize(0);
- }
- if (*yytext==';' || *yytext=='=')
- {
- yyextra->type.resize(0);
- yyextra->name.resize(0);
- }
- else if (*yytext=='[')
- {
- yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
- }
- yyextra->args.resize(0);
+<SkipVerbString>[^"\n]+ {
+ yyextra->code->codify(yytext);
+ }
+<SkipVerbString>\"\" { // escaped quote
+ yyextra->code->codify(yytext);
+ }
+<SkipVerbString>\" { // end of string
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastVerbStringContext );
+ }
+<SkipVerbString>. {
+ yyextra->code->codify(yytext);
+ }
+<SkipVerbString>\n {
+ codifyLines(yyscanner,yytext);
+ }
+<Body>":" {
+ yyextra->code->codify(yytext);
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ }
+<Body>"<" {
+ if (yyextra->insideTemplate)
+ {
+ yyextra->sharpCount++;
+ }
+ yyextra->code->codify(yytext);
+ }
+<Body>">" {
+ if (yyextra->insideTemplate)
+ {
+ if (--yyextra->sharpCount<=0)
+ {
+ yyextra->insideTemplate=FALSE;
+ }
+ }
+ yyextra->code->codify(yytext);
+ }
+<Body,MemberCall,MemberCall2,FuncCall>"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" {
+ startFontClass(yyscanner,"charliteral");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Body>"."|"->" {
+ if (yytext[0]=='-') // -> could be overloaded
+ {
+ updateCallContextForSmartPointer(yyscanner);
+ }
+ yyextra->code->codify(yytext);
+ yyextra->memCallContext = YY_START;
+ BEGIN( MemberCall );
+ }
+<MemberCall>{SCOPETNAME}/{BN}*"(" {
+ if (yyextra->theCallContext.getScope())
+ {
+ if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext))
+ {
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yytext);
+ }
+ yyextra->name.resize(0);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yytext);
+ yyextra->name.resize(0);
+ }
+ yyextra->type.resize(0);
+ if (yyextra->memCallContext==Body)
+ {
+ BEGIN(FuncCall);
+ }
+ else
+ {
+ BEGIN(yyextra->memCallContext);
+ }
+ }
+<MemberCall>{SCOPENAME}/{B}* {
+ if (yyextra->theCallContext.getScope())
+ {
+ DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",yyextra->theCallContext.getScope()));
+ if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext))
+ {
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yytext);
+ }
+ yyextra->name.resize(0);
+ }
+ else
+ {
+ DBG_CTX((stderr,"no class context!\n"));
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yytext);
+ yyextra->name.resize(0);
+ }
+ yyextra->type.resize(0);
+ BEGIN(yyextra->memCallContext);
+ }
+<Body>[,=;\[] {
+ if (yyextra->insideObjC && *yytext=='[')
+ {
+ //printf("Found start of ObjC call!\n");
+ // start of a method call
+ yyextra->contextMap.clear();
+ yyextra->nameMap.clear();
+ yyextra->objectMap.clear();
+ yyextra->wordMap.clear();
+ yyextra->commentMap.clear();
+ yyextra->currentCtxId = 0;
+ yyextra->currentNameId = 0;
+ yyextra->currentObjId = 0;
+ yyextra->currentCtx = 0;
+ yyextra->braceCount = 0;
+ unput('[');
+ BEGIN(ObjCCall);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ yyextra->saveName = yyextra->name.copy();
+ yyextra->saveType = yyextra->type.copy();
+ if (*yytext!='[' && !yyextra->type.isEmpty())
+ {
+ //printf("yyextra->scopeStack.bottom()=%p\n",yyextra->scopeStack.bottom());
+ //if (yyextra->scopeStack.top()!=CLASSBLOCK) // commented out for bug731363
+ {
+ //printf("AddVariable: '%s' '%s' context=%d\n",
+ // yyextra->type.data(),yyextra->name.data(),yyextra->theVarContext.count());
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
+ }
+ yyextra->name.resize(0);
+ }
+ if (*yytext==';' || *yytext=='=')
+ {
+ yyextra->type.resize(0);
+ yyextra->name.resize(0);
+ }
+ else if (*yytext=='[')
+ {
+ yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
+ }
+ yyextra->args.resize(0);
yyextra->parmType.resize(0);
yyextra->parmName.resize(0);
- }
- }
+ }
+ }
/*
-<ObjCMemberCall>{ID} {
- if (qstrcmp(yytext,"self")==0 || qstrcmp(yytext,"super")==0)
- {
- // TODO: get proper base class for "super"
- yyextra->theCallContext.setClass(getClass(yyextra->curClassName));
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
- else
- {
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
- yyextra->name.resize(0);
- BEGIN(ObjCMemberCall2);
- }
-<ObjCMemberCall>"[" {
- yyextra->code->codify(yytext);
- yyextra->theCallContext.pushScope(yyscanner,yyextra->name, yyextra->type);
- }
-<ObjCMemberCall2>{ID}":"? {
- yyextra->name+=yytext;
- if (yyextra->theCallContext.getClass())
- {
- //printf("Calling method %s\n",yyextra->name.data());
- if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name))
- {
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yyextra->name);
- }
- }
- else
- {
- yyextra->code->codify(yytext);
- addToSearchIndex(yyscanner,yyextra->name);
- }
- yyextra->name.resize(0);
- BEGIN(ObjCMemberCall3);
- }
-<ObjCMemberCall2,ObjCMemberCall3>"]" {
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->code->codify(yytext);
- BEGIN(Body);
- }
+<ObjCMemberCall>{ID} {
+ if (qstrcmp(yytext,"self")==0 || qstrcmp(yytext,"super")==0)
+ {
+ // TODO: get proper base class for "super"
+ yyextra->theCallContext.setClass(getClass(yyextra->curClassName));
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+ else
+ {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+ yyextra->name.resize(0);
+ BEGIN(ObjCMemberCall2);
+ }
+<ObjCMemberCall>"[" {
+ yyextra->code->codify(yytext);
+ yyextra->theCallContext.pushScope(yyscanner,yyextra->name, yyextra->type);
+ }
+<ObjCMemberCall2>{ID}":"? {
+ yyextra->name+=yytext;
+ if (yyextra->theCallContext.getClass())
+ {
+ //printf("Calling method %s\n",yyextra->name.data());
+ if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name))
+ {
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yyextra->name);
+ }
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ addToSearchIndex(yyscanner,yyextra->name);
+ }
+ yyextra->name.resize(0);
+ BEGIN(ObjCMemberCall3);
+ }
+<ObjCMemberCall2,ObjCMemberCall3>"]" {
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->code->codify(yytext);
+ BEGIN(Body);
+ }
*/
<ObjCCall,ObjCMName>"["|"{" {
saveObjCContext(yyscanner);
- yyextra->currentCtx->format+=*yytext;
- BEGIN(ObjCCall);
- //printf("open\n");
+ yyextra->currentCtx->format+=*yytext;
+ BEGIN(ObjCCall);
+ //printf("open\n");
}
<ObjCCall,ObjCMName>"]"|"}" {
- yyextra->currentCtx->format+=*yytext;
+ yyextra->currentCtx->format+=*yytext;
restoreObjCContext(yyscanner);
- BEGIN(ObjCMName);
- if (yyextra->currentCtx==0)
- {
- // end of call
- writeObjCMethodCall(yyscanner,yyextra->contextDict.find(0));
- BEGIN(Body);
- }
- //printf("close\n");
+ BEGIN(ObjCMName);
+ if (yyextra->currentCtx==0)
+ {
+ // end of call
+ ObjCCallCtx *ctx = 0;
+ auto it = yyextra->contextMap.find(0);
+ if (it!=yyextra->contextMap.end())
+ {
+ ctx = it->second.get();
+ }
+ writeObjCMethodCall(yyscanner,ctx);
+ BEGIN(Body);
+ }
+ //printf("close\n");
}
<ObjCCall,ObjCMName>"//".* {
yyextra->currentCtx->format+=escapeComment(yyscanner,yytext);
@@ -1549,92 +1531,92 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
yyextra->currentCtx->comment=yytext;
BEGIN(ObjCCallComment);
}
-<ObjCCallComment>"*/" {
+<ObjCCallComment>"*/" {
yyextra->currentCtx->comment+=yytext;
yyextra->currentCtx->format+=escapeComment(yyscanner,yyextra->currentCtx->comment);
- BEGIN(yyextra->lastObjCCallContext);
- }
+ BEGIN(yyextra->lastObjCCallContext);
+ }
<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment+=yytext; }
<ObjCCallComment>"//"|"/*" { yyextra->currentCtx->comment+=yytext; }
<ObjCCallComment>\n { yyextra->currentCtx->comment+=*yytext; }
<ObjCCallComment>. { yyextra->currentCtx->comment+=*yytext; }
-<ObjCCall>{ID} {
+<ObjCCall>{ID} {
yyextra->currentCtx->format+=escapeObject(yyscanner,yytext);
- if (yyextra->braceCount==0)
- {
- yyextra->currentCtx->objectTypeOrName=yytext;
+ if (yyextra->braceCount==0)
+ {
+ yyextra->currentCtx->objectTypeOrName=yytext;
//printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data());
- BEGIN(ObjCMName);
- }
- }
-<ObjCMName>{ID}/{BN}*"]" {
- if (yyextra->braceCount==0 &&
- yyextra->currentCtx->methodName.isEmpty())
+ BEGIN(ObjCMName);
+ }
+ }
+<ObjCMName>{ID}/{BN}*"]" {
+ if (yyextra->braceCount==0 &&
+ yyextra->currentCtx->methodName.isEmpty())
{
- yyextra->currentCtx->methodName=yytext;
+ yyextra->currentCtx->methodName=yytext;
yyextra->currentCtx->format+=escapeName(yyscanner,yytext);
- }
- else
- {
+ }
+ else
+ {
yyextra->currentCtx->format+=escapeWord(yyscanner,yytext);
- }
+ }
}
-<ObjCMName>{ID}/{BN}*":" {
+<ObjCMName>{ID}/{BN}*":" {
if (yyextra->braceCount==0)
{
- yyextra->currentCtx->methodName+=yytext;
+ yyextra->currentCtx->methodName+=yytext;
yyextra->currentCtx->methodName+=":";
- }
+ }
yyextra->currentCtx->format+=escapeName(yyscanner,yytext);
}
<ObjCSkipStr>[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; }
-<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
-<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
- BEGIN(yyextra->lastStringContext);
+<ObjCSkipStr>\\. { yyextra->currentCtx->format+=yytext; }
+<ObjCSkipStr>"\"" { yyextra->currentCtx->format+=yytext;
+ BEGIN(yyextra->lastStringContext);
}
<ObjCCall,ObjCMName>{CHARLIT} { yyextra->currentCtx->format+=yytext; }
-<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
+<ObjCCall,ObjCMName>"@"?"\"" { yyextra->currentCtx->format+=yytext;
yyextra->lastStringContext=YY_START;
- BEGIN(ObjCSkipStr);
+ BEGIN(ObjCSkipStr);
}
<ObjCCall,ObjCMName,ObjCSkipStr>"$" { yyextra->currentCtx->format+="$$"; }
<ObjCCall,ObjCMName>"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; }
<ObjCCall,ObjCMName>")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; }
-<ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#)
+<ObjCSkipStr>"@"/"\"" { // needed to prevent matching the global rule (for C#)
yyextra->currentCtx->format+=yytext;
}
<ObjCCall,ObjCMName,ObjCSkipStr>{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); }
<ObjCCall,ObjCMName,ObjCSkipStr>. { yyextra->currentCtx->format+=*yytext; }
<ObjCCall,ObjCMName,ObjCSkipStr>\n { yyextra->currentCtx->format+=*yytext; }
-<Body>"]" {
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->code->codify(yytext);
- // TODO: nested arrays like: a[b[0]->func()]->func()
- yyextra->name = yyextra->saveName.copy();
- yyextra->type = yyextra->saveType.copy();
- }
-<Body>[0-9]+ {
- yyextra->code->codify(yytext);
- }
-<Body>[0-9]+[xX][0-9A-Fa-f]+ {
- yyextra->code->codify(yytext);
- }
+<Body>"]" {
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->code->codify(yytext);
+ // TODO: nested arrays like: a[b[0]->func()]->func()
+ yyextra->name = yyextra->saveName.copy();
+ yyextra->type = yyextra->saveType.copy();
+ }
+<Body>[0-9]+ {
+ yyextra->code->codify(yytext);
+ }
+<Body>[0-9]+[xX][0-9A-Fa-f]+ {
+ yyextra->code->codify(yytext);
+ }
<MemberCall2,FuncCall>{KEYWORD}/([^a-z_A-Z0-9]) {
- //addParmType(yyscanner);
- //yyextra->parmName=yytext;
+ //addParmType(yyscanner);
+ //yyextra->parmName=yytext;
if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT;
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKW}/([^a-z_A-Z0-9]) {
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- startFontClass(yyscanner,"keywordtype");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
<MemberCall2,FuncCall,OldStyleArgs,TemplCast>{TYPEKWSL}/([^a-z_A-Z0-9]) {
if (yyextra->lang!=SrcLangExt_Slice)
{
@@ -1642,20 +1624,20 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
}
else
{
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- startFontClass(yyscanner,"keywordtype");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
}
- }
+ }
<MemberCall2,FuncCall>{FLOWKW}/([^a-z_A-Z0-9]) {
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- startFontClass(yyscanner,"keywordflow");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ startFontClass(yyscanner,"keywordflow");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
<MemberCall2,FuncCall>{FLOWCONDITION}/([^a-z_A-Z0-9]) {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
@@ -1668,25 +1650,25 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
endFontClass(yyscanner);
}
<MemberCall2,FuncCall>{ID}(({B}*"<"[^\n\[\](){}<>]*">")?({B}*"::"{B}*{ID})?)* {
- if (isCastKeyword(yytext))
- {
- REJECT;
- }
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
- }
-<FuncCall>";" { // probably a cast, not a function call
- yyextra->code->codify(yytext);
- yyextra->inForEachExpression = FALSE;
- BEGIN( Body );
- }
-<MemberCall2,FuncCall>, {
- yyextra->code->codify(yytext);
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- }
-<MemberCall2,FuncCall>"{" {
+ if (isCastKeyword(yytext))
+ {
+ REJECT;
+ }
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
+ }
+<FuncCall>";" { // probably a cast, not a function call
+ yyextra->code->codify(yytext);
+ yyextra->inForEachExpression = FALSE;
+ BEGIN( Body );
+ }
+<MemberCall2,FuncCall>, {
+ yyextra->code->codify(yytext);
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ }
+<MemberCall2,FuncCall>"{" {
if (yyextra->bracketCount>0)
{
yyextra->code->codify(yytext);
@@ -1715,28 +1697,28 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
<InlineInit>. {
yyextra->code->codify(yytext);
}
-<MemberCall2,FuncCall>"(" {
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- yyextra->code->codify(yytext);
- yyextra->bracketCount++;
- yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
- if (YY_START==FuncCall && !yyextra->insideBody)
- {
- yyextra->theVarContext.pushScope();
- }
- }
+<MemberCall2,FuncCall>"(" {
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ yyextra->code->codify(yytext);
+ yyextra->bracketCount++;
+ yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
+ if (YY_START==FuncCall && !yyextra->insideBody)
+ {
+ yyextra->theVarContext.pushScope();
+ }
+ }
<MemberCall2,FuncCall>{OPERATOR} { // operator
- if (qstrcmp(yytext,"*") &&
- qstrcmp(yytext,"&") &&
- qstrcmp(yytext,"^") &&
- qstrcmp(yytext,"%")) // typically a pointer or reference
- {
- // not a * or &, or C++/CLI's ^ or %
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- }
- yyextra->code->codify(yytext);
- }
-<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
+ if (qstrcmp(yytext,"*") &&
+ qstrcmp(yytext,"&") &&
+ qstrcmp(yytext,"^") &&
+ qstrcmp(yytext,"%")) // typically a pointer or reference
+ {
+ // not a * or &, or C++/CLI's ^ or %
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ }
+ yyextra->code->codify(yytext);
+ }
+<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
if (yytext[0]==')') // no a pointer cast
{
//printf("addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data());
@@ -1745,281 +1727,281 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
yyextra->parmType=yyextra->parmName;
yyextra->parmName.resize(0);
}
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
}
else
{
yyextra->parmType = yyextra->parmName;
yyextra->parmName.resize(0);
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- }
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->inForEachExpression = FALSE;
- //yyextra->theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b().
- yyextra->code->codify(yytext);
- if (--yyextra->bracketCount<=0)
- {
- if (yyextra->name.isEmpty())
- {
- BEGIN( Body );
- }
- else
- {
- BEGIN( CallEnd );
- }
- }
- }
-<CallEnd>[ \t\n]* { codifyLines(yyscanner,yytext); }
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ }
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->inForEachExpression = FALSE;
+ //yyextra->theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b().
+ yyextra->code->codify(yytext);
+ if (--yyextra->bracketCount<=0)
+ {
+ if (yyextra->name.isEmpty())
+ {
+ BEGIN( Body );
+ }
+ else
+ {
+ BEGIN( CallEnd );
+ }
+ }
+ }
+<CallEnd>[ \t\n]* { codifyLines(yyscanner,yytext); }
/*
-<MemberCall2,FuncCall>")"[ \t\n]*[;:] {
+<MemberCall2,FuncCall>")"[ \t\n]*[;:] {
*/
-<CallEnd>[;:] {
- codifyLines(yyscanner,yytext);
- yyextra->bracketCount=0;
- if (*yytext==';') yyextra->searchingForBody=FALSE;
- if (!yyextra->type.isEmpty())
- {
- DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",yyextra->type.data(),yyextra->name.data()));
- yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
- }
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- yyextra->theCallContext.setScope(0);
- if (*yytext==';' || yyextra->insideBody)
- {
- if (!yyextra->insideBody)
- {
+<CallEnd>[;:] {
+ codifyLines(yyscanner,yytext);
+ yyextra->bracketCount=0;
+ if (*yytext==';') yyextra->searchingForBody=FALSE;
+ if (!yyextra->type.isEmpty())
+ {
+ DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",yyextra->type.data(),yyextra->name.data()));
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name);
+ }
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ yyextra->theCallContext.setScope(0);
+ if (*yytext==';' || yyextra->insideBody)
+ {
+ if (!yyextra->insideBody)
+ {
yyextra->theVarContext.popScope();
- }
- yyextra->name.resize(0);yyextra->type.resize(0);
- BEGIN( Body );
- }
- else
- {
- yyextra->bracketCount=0;
- BEGIN( SkipInits );
- }
- }
+ }
+ yyextra->name.resize(0);yyextra->type.resize(0);
+ BEGIN( Body );
+ }
+ else
+ {
+ yyextra->bracketCount=0;
+ BEGIN( SkipInits );
+ }
+ }
<CallEnd>("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*/{BN}*(";"|"="|"throw"{BN}*"(") {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
<CallEnd,OldStyleArgs>("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" {
if (yyextra->insideBody)
- {
- yyextra->theVarContext.pushScope();
- }
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- //yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- int index = yyextra->name.findRev("::");
- DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data()));
- if (index!=-1)
- {
- QCString scope = yyextra->name.left((uint)index);
- if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::");
- const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope);
- if (cd)
- {
- setClassScope(yyscanner,cd->name());
- yyextra->scopeStack.push(SCOPEBLOCK);
+ {
+ yyextra->theVarContext.pushScope();
+ }
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ //yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ int index = yyextra->name.findRev("::");
+ DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data()));
+ if (index!=-1)
+ {
+ QCString scope = yyextra->name.left((uint)index);
+ if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::");
+ const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope);
+ if (cd)
+ {
+ setClassScope(yyscanner,cd->name());
+ yyextra->scopeStack.push(SCOPEBLOCK);
DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n"));
- }
- else
- {
- //setClassScope(yyscanner,yyextra->realScope);
- yyextra->scopeStack.push(INNERBLOCK);
+ }
+ else
+ {
+ //setClassScope(yyscanner,yyextra->realScope);
+ yyextra->scopeStack.push(INNERBLOCK);
DBG_CTX((stderr,"** scope stack push INNERBLOCK\n"));
- }
- }
- else
- {
+ }
+ }
+ else
+ {
DBG_CTX((stderr,"** scope stack push INNERBLOCK\n"));
- yyextra->scopeStack.push(INNERBLOCK);
- }
- yytext[yyleng-1]='\0';
- QCString cv(yytext);
- if (!cv.stripWhiteSpace().isEmpty())
- {
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- else // just whitespace
- {
- codifyLines(yyscanner,yytext);
- }
- yyextra->code->codify("{");
- if (yyextra->searchingForBody)
- {
- yyextra->searchingForBody=FALSE;
- yyextra->insideBody=TRUE;
- }
- if (yyextra->insideBody) yyextra->bodyCurlyCount++;
- yyextra->type.resize(0); yyextra->name.resize(0);
- BEGIN( Body );
- }
-<CallEnd>"try" { // function-try-block
- startFontClass(yyscanner,"keyword");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- yyextra->inFunctionTryBlock=TRUE;
- }
-<CallEnd>{ID} {
- if (yyextra->insideBody || !yyextra->parmType.isEmpty())
- {
- REJECT;
- }
- // could be K&R style definition
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
- BEGIN(OldStyleArgs);
- }
-<OldStyleArgs>{ID} {
- addParmType(yyscanner);
- yyextra->parmName=yytext;
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
- }
-<OldStyleArgs>[,;] {
- yyextra->code->codify(yytext);
- yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
- if (*yytext==';') yyextra->parmType.resize(0);
- yyextra->parmName.resize(0);
- }
-<CallEnd,OldStyleArgs>"#" {
- startFontClass(yyscanner,"preprocessor");
- yyextra->lastSkipCppContext = Body;
- yyextra->code->codify(yytext);
- BEGIN( SkipCPP );
- }
-<CallEnd>. {
- unput(*yytext);
- if (!yyextra->insideBody)
- {
- yyextra->theVarContext.popScope();
- }
- yyextra->name.resize(0);yyextra->args.resize(0);
- yyextra->parmType.resize(0);yyextra->parmName.resize(0);
- BEGIN( Body );
- }
-<SkipInits>";" {
- yyextra->code->codify(yytext);
- yyextra->type.resize(0); yyextra->name.resize(0);
- BEGIN( Body );
- }
-<SkipInits>"{" {
- yyextra->code->codify(yytext);
- if (yyextra->searchingForBody)
- {
- yyextra->searchingForBody=FALSE;
- yyextra->insideBody=TRUE;
- }
- if (yyextra->insideBody) yyextra->bodyCurlyCount++;
- if (yyextra->name.find("::")!=-1)
- {
+ yyextra->scopeStack.push(INNERBLOCK);
+ }
+ yytext[yyleng-1]='\0';
+ QCString cv(yytext);
+ if (!cv.stripWhiteSpace().isEmpty())
+ {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ else // just whitespace
+ {
+ codifyLines(yyscanner,yytext);
+ }
+ yyextra->code->codify("{");
+ if (yyextra->searchingForBody)
+ {
+ yyextra->searchingForBody=FALSE;
+ yyextra->insideBody=TRUE;
+ }
+ if (yyextra->insideBody) yyextra->bodyCurlyCount++;
+ yyextra->type.resize(0); yyextra->name.resize(0);
+ BEGIN( Body );
+ }
+<CallEnd>"try" { // function-try-block
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ yyextra->inFunctionTryBlock=TRUE;
+ }
+<CallEnd>{ID} {
+ if (yyextra->insideBody || !yyextra->parmType.isEmpty())
+ {
+ REJECT;
+ }
+ // could be K&R style definition
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
+ BEGIN(OldStyleArgs);
+ }
+<OldStyleArgs>{ID} {
+ addParmType(yyscanner);
+ yyextra->parmName=yytext;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody);
+ }
+<OldStyleArgs>[,;] {
+ yyextra->code->codify(yytext);
+ yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName);
+ if (*yytext==';') yyextra->parmType.resize(0);
+ yyextra->parmName.resize(0);
+ }
+<CallEnd,OldStyleArgs>"#" {
+ startFontClass(yyscanner,"preprocessor");
+ yyextra->lastSkipCppContext = Body;
+ yyextra->code->codify(yytext);
+ BEGIN( SkipCPP );
+ }
+<CallEnd>. {
+ unput(*yytext);
+ if (!yyextra->insideBody)
+ {
+ yyextra->theVarContext.popScope();
+ }
+ yyextra->name.resize(0);yyextra->args.resize(0);
+ yyextra->parmType.resize(0);yyextra->parmName.resize(0);
+ BEGIN( Body );
+ }
+<SkipInits>";" {
+ yyextra->code->codify(yytext);
+ yyextra->type.resize(0); yyextra->name.resize(0);
+ BEGIN( Body );
+ }
+<SkipInits>"{" {
+ yyextra->code->codify(yytext);
+ if (yyextra->searchingForBody)
+ {
+ yyextra->searchingForBody=FALSE;
+ yyextra->insideBody=TRUE;
+ }
+ if (yyextra->insideBody) yyextra->bodyCurlyCount++;
+ if (yyextra->name.find("::")!=-1)
+ {
DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n"));
- yyextra->scopeStack.push(SCOPEBLOCK);
- setClassScope(yyscanner,yyextra->realScope);
- }
- else
- {
+ yyextra->scopeStack.push(SCOPEBLOCK);
+ setClassScope(yyscanner,yyextra->realScope);
+ }
+ else
+ {
DBG_CTX((stderr,"** scope stack push INNERBLOCK\n"));
- yyextra->scopeStack.push(INNERBLOCK);
- }
- yyextra->type.resize(0); yyextra->name.resize(0);
- BEGIN( Body );
- }
-<SkipInits>{ID} {
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- }
-<FuncCall>{ID}/"(" {
- generateFunctionLink(yyscanner,*yyextra->code,yytext);
- }
-<FuncCall>{ID}/("."|"->") {
- yyextra->name=yytext;
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- BEGIN( MemberCall2 );
- }
-<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
- yyextra->code->codify(yytext);
- uint s=0;while (!isId(yytext[s])) s++;
+ yyextra->scopeStack.push(INNERBLOCK);
+ }
+ yyextra->type.resize(0); yyextra->name.resize(0);
+ BEGIN( Body );
+ }
+<SkipInits>{ID} {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+<FuncCall>{ID}/"(" {
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ }
+<FuncCall>{ID}/("."|"->") {
+ yyextra->name=yytext;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN( MemberCall2 );
+ }
+<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") {
+ yyextra->code->codify(yytext);
+ uint s=0;while (!isId(yytext[s])) s++;
uint e=(uint)yyleng-1;while (e>1 && !isId(yytext[e])) e--;
- yyextra->name=((QCString)yytext).mid(s,e-s+1);
- BEGIN( MemberCall2 );
- }
-<MemberCall2>{ID}/([ \t\n]*"(") {
- if (!yyextra->args.isEmpty())
- generateMemberLink(yyscanner,*yyextra->code,yyextra->args,yytext);
- else
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- yyextra->args.resize(0);
- BEGIN( FuncCall );
- }
+ yyextra->name=((QCString)yytext).mid(s,e-s+1);
+ BEGIN( MemberCall2 );
+ }
+<MemberCall2>{ID}/([ \t\n]*"(") {
+ if (!yyextra->args.isEmpty())
+ generateMemberLink(yyscanner,*yyextra->code,yyextra->args,yytext);
+ else
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ yyextra->args.resize(0);
+ BEGIN( FuncCall );
+ }
<MemberCall2>{ID}/([ \t\n]*("."|"->")) {
- //yyextra->code->codify(yytext);
- yyextra->name=yytext;
- generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- BEGIN( MemberCall2 );
- }
-<MemberCall2>"->"|"." {
- if (yytext[0]=='-') // -> could be overloaded
- {
- updateCallContextForSmartPointer(yyscanner);
- }
- yyextra->code->codify(yytext);
- yyextra->memCallContext = YY_START;
- BEGIN( MemberCall );
- }
-<SkipComment>"/*"("!"?)"*/" {
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastCContext ) ;
- }
-<SkipComment>"//"|"/*" {
- yyextra->code->codify(yytext);
- }
-<SkipComment>[^*/\n]+ {
- yyextra->code->codify(yytext);
- }
-<SkipComment>[ \t]*"*/" {
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- if (yyextra->lastCContext==SkipCPP)
+ //yyextra->code->codify(yytext);
+ yyextra->name=yytext;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN( MemberCall2 );
+ }
+<MemberCall2>"->"|"." {
+ if (yytext[0]=='-') // -> could be overloaded
+ {
+ updateCallContextForSmartPointer(yyscanner);
+ }
+ yyextra->code->codify(yytext);
+ yyextra->memCallContext = YY_START;
+ BEGIN( MemberCall );
+ }
+<SkipComment>"/*"("!"?)"*/" {
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastCContext ) ;
+ }
+<SkipComment>"//"|"/*" {
+ yyextra->code->codify(yytext);
+ }
+<SkipComment>[^*/\n]+ {
+ yyextra->code->codify(yytext);
+ }
+<SkipComment>[ \t]*"*/" {
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ if (yyextra->lastCContext==SkipCPP)
{
startFontClass(yyscanner,"preprocessor");
}
- BEGIN( yyextra->lastCContext ) ;
- }
-<SkipCxxComment>[^\r\n]*"\\"[\r]?\n { // line continuation
- codifyLines(yyscanner,yytext);
- }
-<SkipCxxComment>[^\r\n]+ {
- yyextra->code->codify(yytext);
- }
-<SkipCxxComment>\r
-<SkipCxxComment>\n {
- unput('\n');
- endFontClass(yyscanner);
- BEGIN( yyextra->lastCContext ) ;
- }
-<SkipCxxComment>. {
- yyextra->code->codify(yytext);
- }
+ BEGIN( yyextra->lastCContext ) ;
+ }
+<SkipCxxComment>[^\r\n]*"\\"[\r]?\n { // line continuation
+ codifyLines(yyscanner,yytext);
+ }
+<SkipCxxComment>[^\r\n]+ {
+ yyextra->code->codify(yytext);
+ }
+<SkipCxxComment>\r
+<SkipCxxComment>\n {
+ unput('\n');
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastCContext ) ;
+ }
+<SkipCxxComment>. {
+ yyextra->code->codify(yytext);
+ }
<RemoveSpecialCComment>"*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)?{B}*"/*"[*!]/[^/*] {
- yyextra->yyLineNr+=QCString(yytext).contains('\n');
- }
+ yyextra->yyLineNr+=QCString(yytext).contains('\n');
+ }
<RemoveSpecialCComment>"*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)? {
- if (yyextra->lastSpecialCContext==SkipCxxComment)
- { // force end of C++ comment here
- yyextra->yyLineNr+=QCString(yytext).contains('\n');
- nextCodeLine(yyscanner);
- endFontClass(yyscanner);
- BEGIN( yyextra->lastCContext ) ;
- }
- else
- {
- yyextra->yyLineNr+=QCString(yytext).contains('\n');
+ if (yyextra->lastSpecialCContext==SkipCxxComment)
+ { // force end of C++ comment here
+ yyextra->yyLineNr+=QCString(yytext).contains('\n');
+ nextCodeLine(yyscanner);
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastCContext ) ;
+ }
+ else
+ {
+ yyextra->yyLineNr+=QCString(yytext).contains('\n');
if (yytext[yyleng-1]=='\n')
{
yyextra->yyLineNr--;
@@ -2027,280 +2009,280 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
}
else
{
- nextCodeLine(yyscanner);
+ nextCodeLine(yyscanner);
}
- BEGIN(yyextra->lastSpecialCContext);
- }
- }
-<RemoveSpecialCComment>"*/" {
- BEGIN(yyextra->lastSpecialCContext);
- }
+ BEGIN(yyextra->lastSpecialCContext);
+ }
+ }
+<RemoveSpecialCComment>"*/" {
+ BEGIN(yyextra->lastSpecialCContext);
+ }
<RemoveSpecialCComment>[^*\n]+
<RemoveSpecialCComment>"//"|"/*"
<RemoveSpecialCComment>\n { yyextra->yyLineNr++; }
<RemoveSpecialCComment>.
-<MemberCall>[^a-z_A-Z0-9(\n] {
- yyextra->code->codify(yytext);
- yyextra->type.resize(0);
- yyextra->name.resize(0);
- BEGIN(yyextra->memCallContext);
- }
-<*>\n({B}*"//"[!/][^\n]*\n)+ { // remove special one-line comment
- if (YY_START==SkipCPP) REJECT;
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- yyextra->yyLineNr+=QCString(yytext).contains('\n');
- nextCodeLine(yyscanner);
- }
- else
- {
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- if (YY_START==SkipCxxComment)
- {
- endFontClass(yyscanner);
- BEGIN( yyextra->lastCContext ) ;
- }
- }
-<SkipCPP>\n/.*\n {
- endFontClass(yyscanner);
- BEGIN( yyextra->lastSkipCppContext ) ;
+<MemberCall>[^a-z_A-Z0-9(\n] {
+ yyextra->code->codify(yytext);
+ yyextra->type.resize(0);
+ yyextra->name.resize(0);
+ BEGIN(yyextra->memCallContext);
+ }
+<*>\n({B}*"//"[!/][^\n]*\n)+ { // remove special one-line comment
+ if (YY_START==SkipCPP) REJECT;
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr+=QCString(yytext).contains('\n');
+ nextCodeLine(yyscanner);
+ }
+ else
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ if (YY_START==SkipCxxComment)
+ {
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastCContext ) ;
+ }
+ }
+<SkipCPP>\n/.*\n {
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastSkipCppContext ) ;
unput('\n');
- }
-<*>\n{B}*"//@"[{}].*\n { // remove one-line group marker
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- yyextra->yyLineNr+=2;
- nextCodeLine(yyscanner);
- }
- else
- {
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- if (YY_START==SkipCxxComment)
- {
- endFontClass(yyscanner);
- BEGIN( yyextra->lastCContext ) ;
- }
- }
-<*>\n{B}*"/*@"[{}] { // remove one-line group marker
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- yyextra->yyLineNr++;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- BEGIN(SkipComment);
- }
- }
-<*>^{B}*"//@"[{}].*\n { // remove one-line group marker
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- yyextra->yyLineNr++;
- nextCodeLine(yyscanner);
- }
- else
- {
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- }
-<*>^{B}*"/*@"[{}] { // remove multi-line group marker
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- BEGIN(SkipComment);
- }
- }
-<*>^{B}*"//"[!/][^\n]*\n { // remove special one-line comment
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- yyextra->yyLineNr++;
- //nextCodeLine(yyscanner);
- }
- else
- {
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- }
-<*>"//"[!/][^\n]*/\n { // strip special one-line comment
+ }
+<*>\n{B}*"//@"[{}].*\n { // remove one-line group marker
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr+=2;
+ nextCodeLine(yyscanner);
+ }
+ else
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ if (YY_START==SkipCxxComment)
+ {
+ endFontClass(yyscanner);
+ BEGIN( yyextra->lastCContext ) ;
+ }
+ }
+<*>\n{B}*"/*@"[{}] { // remove one-line group marker
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ yyextra->yyLineNr++;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>^{B}*"//@"[{}].*\n { // remove one-line group marker
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr++;
+ nextCodeLine(yyscanner);
+ }
+ else
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ }
+<*>^{B}*"/*@"[{}] { // remove multi-line group marker
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>^{B}*"//"[!/][^\n]*\n { // remove special one-line comment
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr++;
+ //nextCodeLine(yyscanner);
+ }
+ else
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ }
+<*>"//"[!/][^\n]*/\n { // strip special one-line comment
if (YY_START==SkipComment || YY_START==SkipString) REJECT;
- if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- endFontClass(yyscanner);
- }
- }
-<*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file
- yyextra->forceTagReference=yytext;
- uint s=(uint)yyextra->forceTagReference.find(':');
- uint e=(uint)yyextra->forceTagReference.findRev(']');
- yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1);
- }
-<*>\n{B}*"/*"[!*]/[^/*] {
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- yyextra->yyLineNr++;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,yytext);
- BEGIN(SkipComment);
- }
- }
-<*>^{B}*"/**"[*]+/[^/] { // special C "banner" comment block at a new line
- if (Config_getBool(JAVADOC_BANNER) && Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- BEGIN(SkipComment);
- }
- }
-<*>^{B}*"/*"[!*]/[^/*] { // special C comment block at a new line
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- BEGIN(SkipComment);
- }
- }
-<*>"/*"[!*]/[^/*] { // special C comment block half way a line
+ if (!Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ }
+<*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file
+ yyextra->forceTagReference=yytext;
+ uint s=(uint)yyextra->forceTagReference.find(':');
+ uint e=(uint)yyextra->forceTagReference.findRev(']');
+ yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1);
+ }
+<*>\n{B}*"/*"[!*]/[^/*] {
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ yyextra->yyLineNr++;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>^{B}*"/**"[*]+/[^/] { // special C "banner" comment block at a new line
+ if (Config_getBool(JAVADOC_BANNER) && Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>^{B}*"/*"[!*]/[^/*] { // special C comment block at a new line
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>"/*"[!*]/[^/*] { // special C comment block half way a line
if (YY_START==SkipString) REJECT;
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
- BEGIN(RemoveSpecialCComment);
- }
- else
- {
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- BEGIN(SkipComment);
- }
- }
-<*>"/*"("!"?)"*/" {
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START;
+ BEGIN(RemoveSpecialCComment);
+ }
+ else
+ {
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ BEGIN(SkipComment);
+ }
+ }
+<*>"/*"("!"?)"*/" {
if (YY_START==SkipString) REJECT;
if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- endFontClass(yyscanner);
- }
- }
+ {
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+ }
<SkipComment>[^\*\n]+ {
yyextra->code->codify(yytext);
}
-<*>"/*" {
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- // check is to prevent getting stuck in skipping C++ comments
- if (YY_START != SkipComment && YY_START != SkipCxxComment)
- {
- yyextra->lastCContext = YY_START ;
- }
- BEGIN( SkipComment ) ;
- }
-<*>@\" { // C# verbatim string
- startFontClass(yyscanner,"stringliteral");
- yyextra->code->codify(yytext);
- yyextra->lastVerbStringContext=YY_START;
- BEGIN(SkipVerbString);
- }
-<*>"//" {
- startFontClass(yyscanner,"comment");
- yyextra->code->codify(yytext);
- yyextra->lastCContext = YY_START ;
- BEGIN( SkipCxxComment ) ;
- }
-<*>"("|"[" {
- yyextra->code->codify(yytext);
- yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
- }
-<*>")"|"]" {
- yyextra->code->codify(yytext);
- yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
- }
-<*>\n {
- yyextra->yyColNr++;
- codifyLines(yyscanner,yytext);
- }
+<*>"/*" {
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ // check is to prevent getting stuck in skipping C++ comments
+ if (YY_START != SkipComment && YY_START != SkipCxxComment)
+ {
+ yyextra->lastCContext = YY_START ;
+ }
+ BEGIN( SkipComment ) ;
+ }
+<*>@\" { // C# verbatim string
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->code->codify(yytext);
+ yyextra->lastVerbStringContext=YY_START;
+ BEGIN(SkipVerbString);
+ }
+<*>"//" {
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ yyextra->lastCContext = YY_START ;
+ BEGIN( SkipCxxComment ) ;
+ }
+<*>"("|"[" {
+ yyextra->code->codify(yytext);
+ yyextra->theCallContext.pushScope(yyextra->name, yyextra->type);
+ }
+<*>")"|"]" {
+ yyextra->code->codify(yytext);
+ yyextra->theCallContext.popScope(yyextra->name, yyextra->type);
+ }
+<*>\n {
+ yyextra->yyColNr++;
+ codifyLines(yyscanner,yytext);
+ }
<*>[\x80-\xFF]* { // keep utf8 characters together...
- yyextra->yyColNr+=yyleng;
- yyextra->code->codify(yytext);
+ yyextra->yyColNr+=yyleng;
+ yyextra->code->codify(yytext);
+ }
+<*>. {
+ yyextra->yyColNr++;
+ yyextra->code->codify(yytext);
}
-<*>. {
- yyextra->yyColNr++;
- yyextra->code->codify(yytext);
- }
/*
-<*>([ \t\n]*"\n"){2,} { // combine multiple blank lines
- //QCString sepLine=yytext;
- //yyextra->code->codify("\n\n");
- //yyextra->yyLineNr+=sepLine.contains('\n');
- //char sepLine[3]="\n\n";
- codifyLines(yyscanner,yytext);
- }
+<*>([ \t\n]*"\n"){2,} { // combine multiple blank lines
+ //QCString sepLine=yytext;
+ //yyextra->code->codify("\n\n");
+ //yyextra->yyLineNr+=sepLine.contains('\n');
+ //char sepLine[3]="\n\n";
+ codifyLines(yyscanner,yytext);
+ }
*/
%%
@@ -2314,7 +2296,7 @@ void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const
//printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data());
QCString ltype = type.simplifyWhiteSpace();
QCString lname = name.simplifyWhiteSpace();
- if (ltype.left(7)=="struct ")
+ if (ltype.left(7)=="struct ")
{
ltype = ltype.right(ltype.length()-7);
}
@@ -2323,39 +2305,51 @@ void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const
ltype = ltype.right(ltype.length()-6);
}
if (ltype.isEmpty() || lname.isEmpty()) return;
- DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n",
- ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"<none>"));
- Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast();
- const ClassDef *varType;
+ DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n",
+ ltype.data(),lname.data(),yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>"));
+ Scope *scope = m_scopes.empty() ? &m_globalScope : &m_scopes.back();
+ const ClassDef *varType = 0;
+ auto it = yyextra->codeClassMap.find(ltype.str());
+ if (it!=yyextra->codeClassMap.end()) // look for class definitions inside the code block
+ {
+ varType = it->second.get();
+ }
+ if (varType==0) // look for global class definitions
+ {
+ varType = getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,ltype);
+ }
int i=0;
- if (
- (varType=yyextra->codeClassSDict->find(ltype)) || // look for class definitions inside the code block
- (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,ltype)) // look for global class definitions
- )
+ if (varType)
{
DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data()));
- scope->append(lname,varType); // add it to a list
+ scope->emplace(std::make_pair(lname.str(),varType)); // add it to a list
}
else if ((i=ltype.find('<'))!=-1)
{
// probably a template class
QCString typeName(ltype.left(i));
- ClassDef* newDef = 0;
+ const ClassDef* newDef = 0;
QCString templateArgs(ltype.right(ltype.length() - i));
- if ( !typeName.isEmpty() &&
- ( // look for class definitions inside the code block
- (varType=yyextra->codeClassSDict->find(typeName)) ||
- // otherwise look for global class definitions
- (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,typeName,0,0,TRUE,TRUE))
- ) && // and it must be a template
- !varType->templateArguments().empty())
+ it = yyextra->codeClassMap.find(typeName.str());
+ if (!typeName.isEmpty())
+ {
+ if (it!=yyextra->codeClassMap.end()) // look for class definitions inside the code block
+ {
+ varType = it->second.get();
+ }
+ else // otherwise look for global class definitions
+ {
+ varType = getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,typeName,0,0,TRUE,TRUE);
+ }
+ }
+ if (varType && !varType->templateArguments().empty()) // and it must be a template
{
newDef = varType->getVariableInstance( templateArgs );
}
if (newDef)
{
DBG_CTX((stderr,"** addVariable type='%s' templ='%s' name='%s'\n",typeName.data(),templateArgs.data(),lname.data()));
- scope->append(lname, newDef);
+ scope->emplace(std::make_pair(lname.str(), newDef));
}
else
{
@@ -2363,14 +2357,14 @@ void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const
addVariable(yyscanner,typeName,name);
}
}
- else
+ else
{
- if (m_scopes.count()>0) // for local variables add a dummy entry so the name
+ if (!m_scopes.empty()) // for local variables add a dummy entry so the name
// is hidden to avoid false links to global variables with the same name
// TODO: make this work for namespaces as well!
{
DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data()));
- scope->append(lname,dummyContext);
+ scope->emplace(std::make_pair(lname.str(),dummyContext));
}
else
{
@@ -2379,25 +2373,30 @@ void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const
}
}
-ClassDef *VariableContext::findVariable(const QCString &name)
+const ClassDef *VariableContext::findVariable(const QCString &name)
{
if (name.isEmpty()) return 0;
- ClassDef *result = 0;
- QListIterator<Scope> sli(m_scopes);
- Scope *scope;
- QCString key = name;
+ const ClassDef *result = 0;
+
// search from inner to outer scope
- for (sli.toLast();(scope=sli.current());--sli)
+ auto it = std::rbegin(m_scopes);
+ while (it != std::rend(m_scopes))
{
- result = scope->find(key);
- if (result)
+ auto it2 = it->find(name.str());
+ if (it2 != std::end(*it))
{
+ result = it2->second;
DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result));
return result;
}
+ ++it;
}
// nothing found -> also try the global scope
- result=m_globalScope.find(name);
+ auto it2 = m_globalScope.find(name.str());
+ if (it2 != m_globalScope.end())
+ {
+ result = it2->second;
+ }
DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result));
return result;
}
@@ -2410,7 +2409,7 @@ const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8;
static void pushScope(yyscan_t yyscanner,const char *s)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yyextra->classScopeLengthStack.push(new int(yyextra->classScope.length()));
+ yyextra->classScopeLengthStack.push(int(yyextra->classScope.length()));
if (yyextra->classScope.isEmpty() || leftScopeMatch(s,yyextra->classScope))
{
yyextra->classScope = s;
@@ -2428,11 +2427,11 @@ static void pushScope(yyscan_t yyscanner,const char *s)
static void popScope(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (!yyextra->classScopeLengthStack.isEmpty())
+ if (!yyextra->classScopeLengthStack.empty())
{
- int *pLength = yyextra->classScopeLengthStack.pop();
- yyextra->classScope.truncate(*pLength);
- delete pLength;
+ int length = yyextra->classScopeLengthStack.top();
+ yyextra->classScopeLengthStack.pop();
+ yyextra->classScope.truncate(length);
}
else
{
@@ -2480,7 +2479,7 @@ static void setClassScope(yyscan_t yyscanner,const QCString &name)
// remove template from scope
n=n.left(ts)+n.right(n.length()-te-1);
}
- while (!yyextra->classScopeLengthStack.isEmpty())
+ while (!yyextra->classScopeLengthStack.empty())
{
popScope(yyscanner);
}
@@ -2508,7 +2507,7 @@ static void startCodeLine(yyscan_t yyscanner)
//QCString lineNumber,lineAnchor;
//lineNumber.sprintf("%05d",yyextra->yyLineNr);
//lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
-
+
Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
//printf("%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d);
if (!yyextra->includeCodeFragment && d)
@@ -2531,15 +2530,15 @@ static void startCodeLine(yyscan_t yyscanner)
if (yyextra->currentMemberDef)
{
yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
- yyextra->currentMemberDef->getOutputFileBase(),
- yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
+ yyextra->currentMemberDef->getOutputFileBase(),
+ yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
setCurrentDoc(yyscanner,lineAnchor);
}
else if (d->isLinkableInProject())
{
yyextra->code->writeLineNumber(d->getReference(),
- d->getOutputFileBase(),
- 0,yyextra->yyLineNr);
+ d->getOutputFileBase(),
+ 0,yyextra->yyLineNr);
setCurrentDoc(yyscanner,lineAnchor);
}
}
@@ -2549,7 +2548,7 @@ static void startCodeLine(yyscan_t yyscanner)
}
}
DBG_CTX((stderr,"startCodeLine(%d)\n",yyextra->yyLineNr));
- yyextra->code->startCodeLine(yyextra->sourceFileDef && yyextra->lineNumbers);
+ yyextra->code->startCodeLine(yyextra->sourceFileDef && yyextra->lineNumbers);
if (yyextra->currentFontClass)
{
yyextra->code->startFontClass(yyextra->currentFontClass);
@@ -2571,7 +2570,7 @@ static void nextCodeLine(yyscan_t yyscanner)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
const char * fc = yyextra->currentFontClass;
endCodeLine(yyscanner);
- if (yyextra->yyLineNr<yyextra->inputLines)
+ if (yyextra->yyLineNr<yyextra->inputLines)
{
yyextra->currentFontClass = fc;
startCodeLine(yyscanner);
@@ -2596,7 +2595,6 @@ static void codifyLines(yyscan_t yyscanner,const char *text)
{
yyextra->yyLineNr++;
yyextra->yyColNr=1;
- //*(p-1)='\0';
int l = (int)(p-sp-1);
char *tmp = (char*)malloc(l+1);
memcpy(tmp,sp,l);
@@ -2614,7 +2612,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text)
}
/*! writes a link to a fragment \a text that may span multiple lines, inserting
- * line numbers for each line. If \a text contains newlines, the link will be
+ * line numbers for each line. If \a text contains newlines, the link will be
* split into multiple links with the same destination, one for each line.
*/
static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
@@ -2627,7 +2625,7 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
- QCString tooltip;
+ QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
@@ -2682,7 +2680,7 @@ static void addUsingDirective(yyscan_t yyscanner,const char *name)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->sourceFileDef && name)
{
- NamespaceDef *nd = Doxygen::namespaceSDict->find(name);
+ const NamespaceDef *nd = Doxygen::namespaceSDict->find(name);
if (nd)
{
yyextra->sourceFileDef->addUsingDirective(nd);
@@ -2708,7 +2706,7 @@ static void setParameterList(yyscan_t yyscanner,const MemberDef *md)
}
}
-static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d)
+static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Definition *d)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
int pos=0;
@@ -2749,7 +2747,7 @@ static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name)
QCString scope = name.left(scopeEnd);
QCString locName = name.right(name.length()-scopeEnd-2);
//printf("explicit scope: name=%s scope=%s\n",locName.data(),scope.data());
- ClassDef *mcd = getClass(scope);
+ const ClassDef *mcd = getClass(scope);
if (mcd && !locName.isEmpty())
{
MemberDef *md=mcd->getMemberByName(locName);
@@ -2765,19 +2763,19 @@ static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name)
const NamespaceDef *mnd = getResolvedNamespace(scope);
if (mnd && !locName.isEmpty())
{
- MemberDef *md=mnd->getMemberByName(locName);
- if (md)
- {
- //printf("name=%s scope=%s\n",locName.data(),scope.data());
- yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
- return md;
- }
+ MemberDef *md=mnd->getMemberByName(locName);
+ if (md)
+ {
+ //printf("name=%s scope=%s\n",locName.data(),scope.data());
+ yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
+ return md;
+ }
}
}
}
-
- MemberName *mn;
- ClassDef *mcd = yyextra->theVarContext.findVariable(name);
+
+ const MemberName *mn;
+ const ClassDef *mcd = yyextra->theVarContext.findVariable(name);
if (mcd) // local variable
{
DBG_CTX((stderr,"local variable?\n"));
@@ -2790,21 +2788,21 @@ static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name)
else
{
DBG_CTX((stderr,"class member? scope=%s\n",yyextra->classScope.data()));
- // look for a class member
+ // look for a class member
mcd = getClass(yyextra->classScope);
if (mcd)
{
DBG_CTX((stderr,"Inside class %s\n",mcd->name().data()));
MemberDef *md=mcd->getMemberByName(name);
- if (md)
+ if (md)
{
DBG_CTX((stderr,"Found member %s\n",md->name().data()));
- if (yyextra->scopeStack.top()!=CLASSBLOCK)
- {
+ if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=CLASSBLOCK)
+ {
DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data()));
- yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
- }
- return md;
+ yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
+ }
+ return md;
}
}
}
@@ -2827,19 +2825,19 @@ static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name)
{
for (const auto &md : *mn)
{
- //printf("mn=%p md=%p md->getBodyDef()=%p yyextra->sourceFileDef=%p\n",
- // mn,md,
- // md->getBodyDef(),yyextra->sourceFileDef);
+ //printf("mn=%p md=%p md->getBodyDef()=%p yyextra->sourceFileDef=%p\n",
+ // mn,md,
+ // md->getBodyDef(),yyextra->sourceFileDef);
- // in case there are multiple members we could link to, we
- // only link to members if defined in the same file or
- // defined as external.
+ // in case there are multiple members we could link to, we
+ // only link to members if defined in the same file or
+ // defined as external.
if ((!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) &&
- (yyextra->forceTagReference.isEmpty() || yyextra->forceTagReference==md->getReference())
- )
+ (yyextra->forceTagReference.isEmpty() || yyextra->forceTagReference==md->getReference())
+ )
{
yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
- //printf("returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data());
+ //printf("returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data());
return md.get();
}
}
@@ -2854,7 +2852,7 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
const Definition *d = yyextra->theCallContext.getScope();
//printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : "<none>");
- MemberDef *md;
+ const MemberDef *md;
if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast<const ClassDef*>(d))->isSmartPointer()))
{
const ClassDef *ncd = stripClassName(yyscanner,md->typeString(),md->getOuterScope());
@@ -2869,11 +2867,11 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner)
static bool getLinkInScope(yyscan_t yyscanner,
const QCString &c, // scope
const QCString &m, // member
- const char *memberText, // exact text
- CodeOutputInterface &ol,
- const char *text,
- bool varOnly
- )
+ const char *memberText, // exact text
+ CodeOutputInterface &ol,
+ const char *text,
+ bool varOnly
+ )
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
const MemberDef *md = 0;
@@ -2882,7 +2880,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
const NamespaceDef *nd = 0;
const GroupDef *gd = 0;
DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly));
- if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef,FALSE,yyextra->forceTagReference) &&
+ if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef,FALSE,yyextra->forceTagReference) &&
(!varOnly || md->isVariable()))
{
if (md->isLinkable())
@@ -2935,9 +2933,9 @@ static bool getLinkInScope(yyscan_t yyscanner,
static bool getLink(yyscan_t yyscanner,
const char *className,
const char *memberName,
- CodeOutputInterface &ol,
- const char *text,
- bool varOnly)
+ CodeOutputInterface &ol,
+ const char *text,
+ bool varOnly)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("getLink(%s,%s) yyextra->curClassName=%s\n",className,memberName,yyextra->curClassName.data());
@@ -2990,11 +2988,11 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
//printf("generateClassOrGlobalLink(className=%s)\n",className.data());
if (!yyextra->prefixed_with_this_keyword || (lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable
{
- Definition *d = yyextra->currentDefinition;
+ const Definition *d = yyextra->currentDefinition;
//printf("d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"<none>",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():"<none>");
cd = getResolvedClass(d,yyextra->sourceFileDef,className,&md);
- DBG_CTX((stderr,"non-local variable name=%s context=%d cd=%s md=%s!\n",
- className.data(),yyextra->theVarContext.count(),cd?cd->name().data():"<none>",
+ DBG_CTX((stderr,"non-local variable name=%s cd=%s md=%s!\n",
+ className.data(),cd?cd->name().data():"<none>",
md?md->name().data():"<none>"));
if (cd==0 && md==0 && (i=className.find('<'))!=-1)
{
@@ -3002,7 +3000,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
DBG_CTX((stderr,"bareName=%s\n",bareName.data()));
if (bareName!=className)
{
- cd=getResolvedClass(d,yyextra->sourceFileDef,bareName,&md); // try unspecialized version
+ cd=getResolvedClass(d,yyextra->sourceFileDef,bareName,&md); // try unspecialized version
}
}
const NamespaceDef *nd = getResolvedNamespace(className);
@@ -3021,24 +3019,24 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
{
if (getLink(yyscanner,yyextra->classScope,clName,ol,clName,varOnly))
{
- return;
+ return;
}
}
}
else
{
//printf("local variable!\n");
- if (lcd!=VariableContext::dummyContext)
+ if (lcd!=VariableContext::dummyContext)
{
//printf("non-dummy context lcd=%s!\n",lcd->name().data());
yyextra->theCallContext.setScope(lcd);
// to following is needed for links to a global variable, but is
// no good for a link to a local variable that is also a global symbol.
-
+
//if (getLink(yyscanner,yyextra->classScope,clName,ol,clName))
//{
- //return;
+ //return;
//}
}
isLocal=TRUE;
@@ -3057,8 +3055,8 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
// yyextra->exampleFile.data());
if (const_cast<ClassDef*>(cd)->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
- ol.writeCodeAnchor(anchor);
- yyextra->anchorCount++;
+ ol.writeCodeAnchor(anchor);
+ yyextra->anchorCount++;
}
}
writeMultiLineCodeLink(yyscanner,ol,cd,clName);
@@ -3069,7 +3067,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
const Definition *d = md->getOuterScope()==Doxygen::globalScope ?
md->getFileDef() : md->getOuterScope();
if (md->getGroupDef()) d = md->getGroupDef();
- if (d && d->isLinkable() && md->isLinkable() &&
+ if (d && d->isLinkable() && md->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(md));
@@ -3083,55 +3081,55 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
{
if (md==0) // not found as a typedef
{
- md = setCallContextForVar(yyscanner,clName);
- //printf("setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",clName,md,yyextra->currentDefinition);
- if (md && yyextra->currentDefinition)
- {
- DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n",
- md->name().data(),yyextra->currentDefinition->name().data(),
- isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md),
- md->getOuterScope()->name().data()));
- }
-
- if (md && yyextra->currentDefinition &&
- isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md)==-1)
- {
- md=0; // variable not accessible
- }
+ md = setCallContextForVar(yyscanner,clName);
+ //printf("setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",clName,md,yyextra->currentDefinition);
+ if (md && yyextra->currentDefinition)
+ {
+ DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n",
+ md->name().data(),yyextra->currentDefinition->name().data(),
+ isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md),
+ md->getOuterScope()->name().data()));
+ }
+
+ if (md && yyextra->currentDefinition &&
+ isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md)==-1)
+ {
+ md=0; // variable not accessible
+ }
}
if (md && (!varOnly || md->isVariable()))
{
DBG_CTX((stderr,"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",md,yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>",md->isLinkable()));
- if (md->isLinkable())
- {
- QCString text;
- if (!yyextra->forceTagReference.isEmpty()) // explicit reference to symbol in tag file
- {
- text=yyextra->forceTagReference;
- if (text.right(4)==".tag") // strip .tag if present
- {
- text=text.left(text.length()-4);
- }
- text+=getLanguageSpecificSeparator(md->getLanguage());
- text+=clName;
- const_cast<MemberDef*>(md)->setName(text);
+ if (md->isLinkable())
+ {
+ QCString text;
+ if (!yyextra->forceTagReference.isEmpty()) // explicit reference to symbol in tag file
+ {
+ text=yyextra->forceTagReference;
+ if (text.right(4)==".tag") // strip .tag if present
+ {
+ text=text.left(text.length()-4);
+ }
+ text+=getLanguageSpecificSeparator(md->getLanguage());
+ text+=clName;
+ const_cast<MemberDef*>(md)->setName(text);
const_cast<MemberDef*>(md)->setLocalName(text);
- }
- else // normal reference
- {
- text=clName;
- }
- writeMultiLineCodeLink(yyscanner,ol,md,text);
+ }
+ else // normal reference
+ {
+ text=clName;
+ }
+ writeMultiLineCodeLink(yyscanner,ol,md,text);
addToSearchIndex(yyscanner,clName);
- if (yyextra->currentMemberDef && yyextra->collectXRefs)
- {
- addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(md));
- }
- return;
- }
+ if (yyextra->currentMemberDef && yyextra->collectXRefs)
+ {
+ addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(md));
+ }
+ return;
+ }
}
}
-
+
// nothing found, just write out the word
DBG_CTX((stderr,"not found!\n"));
codifyLines(yyscanner,clName);
@@ -3183,9 +3181,9 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
{
// add usage reference
if (yyextra->currentDefinition && yyextra->currentMemberDef &&
- /*xmd!=yyextra->currentMemberDef &&*/ yyextra->insideBody && yyextra->collectXRefs)
+ /*xmd!=yyextra->currentMemberDef &&*/ yyextra->insideBody && yyextra->collectXRefs)
{
- addDocCrossReference(yyextra->currentMemberDef,xmd);
+ addDocCrossReference(yyextra->currentMemberDef,xmd);
}
// write the actual link
@@ -3215,7 +3213,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
}
else
{
- Definition *innerDef = cd->findInnerCompound(memName);
+ const Definition *innerDef = cd->findInnerCompound(memName);
if (innerDef)
{
yyextra->theCallContext.setScope(innerDef);
@@ -3229,7 +3227,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
{
const NamespaceDef *nd = dynamic_cast<const NamespaceDef*>(def);
//printf("Looking for %s inside namespace %s\n",memName,nd->name().data());
- Definition *innerDef = nd->findInnerCompound(memName);
+ const Definition *innerDef = nd->findInnerCompound(memName);
if (innerDef)
{
yyextra->theCallContext.setScope(innerDef);
@@ -3254,27 +3252,27 @@ static void generateMemberLink(yyscan_t yyscanner,
// look for the variable in the current context
const ClassDef *vcd = yyextra->theVarContext.findVariable(varName);
- if (vcd)
+ if (vcd)
{
if (vcd!=VariableContext::dummyContext)
{
//printf("Class found!\n");
- if (getLink(yyscanner,vcd->name(),memName,ol))
+ if (getLink(yyscanner,vcd->name(),memName,ol))
{
- //printf("Found result!\n");
- return;
+ //printf("Found result!\n");
+ return;
}
if (vcd->baseClasses())
{
- BaseClassListIterator bcli(*vcd->baseClasses());
- for ( ; bcli.current() ; ++bcli)
- {
- if (getLink(yyscanner,bcli.current()->classDef->name(),memName,ol))
- {
- //printf("Found result!\n");
- return;
- }
- }
+ BaseClassListIterator bcli(*vcd->baseClasses());
+ for ( ; bcli.current() ; ++bcli)
+ {
+ if (getLink(yyscanner,bcli.current()->classDef->name(),memName,ol))
+ {
+ //printf("Found result!\n");
+ return;
+ }
+ }
}
}
}
@@ -3287,46 +3285,46 @@ static void generateMemberLink(yyscan_t yyscanner,
MemberName *vmn=Doxygen::memberNameLinkedMap->find(varName);
if (vmn==0)
{
- int vi;
- QCString vn=varName;
- if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member
- {
- ClassDef *jcd = getClass(vn.left(vi));
- vn=vn.right(vn.length()-vi-2);
- vmn=Doxygen::memberNameLinkedMap->find(vn);
- //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data());
- if (vmn)
- {
+ int vi;
+ QCString vn=varName;
+ if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member
+ {
+ const ClassDef *jcd = getClass(vn.left(vi));
+ vn=vn.right(vn.length()-vi-2);
+ vmn=Doxygen::memberNameLinkedMap->find(vn);
+ //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data());
+ if (vmn)
+ {
for (const auto &vmd : *vmn)
- {
- if (vmd->getClassDef()==jcd)
- {
- //printf("Found variable type=%s\n",vmd->typeString());
- const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
- if (mcd && mcd->isLinkable())
- {
- if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return;
- }
- }
- }
- }
- }
+ {
+ if (vmd->getClassDef()==jcd)
+ {
+ //printf("Found variable type=%s\n",vmd->typeString());
+ const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
+ if (mcd && mcd->isLinkable())
+ {
+ if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return;
+ }
+ }
+ }
+ }
+ }
}
if (vmn)
{
- //printf("There is a variable with name '%s'\n",varName);
+ //printf("There is a variable with name '%s'\n",varName);
for (const auto &vmd : *vmn)
- {
- if (vmd->getClassDef()==vcd)
- {
- //printf("Found variable type=%s\n",vmd->typeString());
- const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
- if (mcd && mcd->isLinkable())
- {
- if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return;
- }
- }
- }
+ {
+ if (vmd->getClassDef()==vcd)
+ {
+ //printf("Found variable type=%s\n",vmd->typeString());
+ const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
+ if (mcd && mcd->isLinkable())
+ {
+ if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return;
+ }
+ }
+ }
}
}
}
@@ -3352,7 +3350,7 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//CodeClassDef *ccd=0;
- ClassDef *ccd=0;
+ const ClassDef *ccd=0;
QCString locScope=yyextra->classScope;
QCString locFunc=removeRedundantWhiteSpace(funcName);
if (yyextra->lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4);
@@ -3364,13 +3362,13 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
int len=2;
int i=locFunc.findRev("::");
if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() &&
- funcName==yyextra->currentMemberDef->localName() &&
+ funcName==yyextra->currentMemberDef->localName() &&
yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr &&
generateClassMemberLink(yyscanner,ol,yyextra->currentMemberDef,funcName)
)
{
// special case where funcName is the name of a method that is also
- // defined on this line. In this case we can directly link to
+ // defined on this line. In this case we can directly link to
// yyextra->currentMemberDef, which is not only faster, but
// in case of overloaded methods, this will make sure that we link to
// the correct method, and thereby get the correct reimplemented relations.
@@ -3412,33 +3410,47 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
funcWithFullScope = locScope+"::"+funcWithScope;
}
}
- if (!fullScope.isEmpty() && (ccd=yyextra->codeClassSDict->find(fullScope)))
+
+ if (!fullScope.isEmpty())
{
- //printf("using classScope %s\n",yyextra->classScope.data());
- if (ccd->baseClasses())
+ auto it = yyextra->codeClassMap.find(fullScope.str());
+ if (it!=yyextra->codeClassMap.end())
+ {
+ ccd = it->second.get();
+ }
+ if (ccd && ccd->baseClasses())
{
BaseClassListIterator bcli(*ccd->baseClasses());
for ( ; bcli.current() ; ++bcli)
{
- if (getLink(yyscanner,bcli.current()->classDef->name(),locFunc,ol,funcName))
- {
- goto exit;
- }
+ if (getLink(yyscanner,bcli.current()->classDef->name(),locFunc,ol,funcName))
+ {
+ goto exit;
+ }
}
}
}
- if (!locScope.isEmpty() && fullScope!=locScope && (ccd=yyextra->codeClassSDict->find(locScope)))
+
+ if (!locScope.isEmpty())
{
- //printf("using classScope %s\n",yyextra->classScope.data());
- if (ccd->baseClasses())
+ auto it = yyextra->codeClassMap.find(locScope.str());
+ if (it!=yyextra->codeClassMap.end())
{
- BaseClassListIterator bcli(*ccd->baseClasses());
- for ( ; bcli.current() ; ++bcli)
+ ccd = it->second.get();
+ }
+ if (fullScope!=locScope && ccd)
+ {
+ //printf("using classScope %s\n",yyextra->classScope.data());
+ if (ccd->baseClasses())
{
- if (getLink(yyscanner,bcli.current()->classDef->name(),funcWithScope,ol,funcName))
- {
- goto exit;
- }
+ BaseClassListIterator bcli(*ccd->baseClasses());
+ for ( ; bcli.current() ; ++bcli)
+ {
+ if (getLink(yyscanner,bcli.current()->classDef->name(),funcWithScope,ol,funcName))
+ {
+ goto exit;
+ }
+ }
}
}
}
@@ -3446,7 +3458,7 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
{
generateClassOrGlobalLink(yyscanner,ol,funcName);
}
-exit:
+exit:
yyextra->forceTagReference.resize(0);
return;
}
@@ -3458,17 +3470,17 @@ static int countLines(yyscan_t yyscanner)
const char *p=yyextra->inputString;
char c;
int count=1;
- while ((c=*p))
- {
- p++ ;
- if (c=='\n') count++;
+ while ((c=*p))
+ {
+ p++ ;
+ if (c=='\n') count++;
}
- if (p>yyextra->inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
- count++,
- yyextra->needsTermination=TRUE;
- }
+ count++,
+ yyextra->needsTermination=TRUE;
+ }
return count;
}
@@ -3506,62 +3518,62 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$')
{
//printf("Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(),
- // ctx->methodName.data());
- ClassDef *cd = yyextra->theVarContext.findVariable(ctx->objectTypeOrName);
+ // ctx->methodName.data());
+ const ClassDef *cd = yyextra->theVarContext.findVariable(ctx->objectTypeOrName);
if (cd==0) // not a local variable
{
- if (ctx->objectTypeOrName=="self")
- {
- if (yyextra->currentDefinition &&
- yyextra->currentDefinition->definitionType()==Definition::TypeClass)
- {
- ctx->objectType = dynamic_cast<ClassDef *>(yyextra->currentDefinition);
- }
- }
- else
- {
- ctx->objectType = getResolvedClass(
- yyextra->currentDefinition,
- yyextra->sourceFileDef,
- ctx->objectTypeOrName,
- &ctx->method);
- }
- //printf(" object is class? %p\n",ctx->objectType);
- if (ctx->objectType) // found class
- {
- ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
- //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():"<none>");
- }
- else if (ctx->method==0) // search for class variable with the same name
- {
- //printf(" no\n");
- //printf("yyextra->currentDefinition=%p\n",yyextra->currentDefinition);
- if (yyextra->currentDefinition &&
- yyextra->currentDefinition->definitionType()==Definition::TypeClass)
- {
- ctx->objectVar = (dynamic_cast<ClassDef *>(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName);
- //printf(" ctx->objectVar=%p\n",ctx->objectVar);
- if (ctx->objectVar)
- {
- ctx->objectType = stripClassName(yyscanner,ctx->objectVar->typeString(),yyextra->currentDefinition);
- //printf(" ctx->objectType=%p\n",ctx->objectType);
- if (ctx->objectType && !ctx->methodName.isEmpty())
- {
- ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
- //printf(" ctx->method=%p\n",ctx->method);
- }
- }
- }
- }
+ if (ctx->objectTypeOrName=="self")
+ {
+ if (yyextra->currentDefinition &&
+ yyextra->currentDefinition->definitionType()==Definition::TypeClass)
+ {
+ ctx->objectType = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ }
+ }
+ else
+ {
+ ctx->objectType = getResolvedClass(
+ yyextra->currentDefinition,
+ yyextra->sourceFileDef,
+ ctx->objectTypeOrName,
+ &ctx->method);
+ }
+ //printf(" object is class? %p\n",ctx->objectType);
+ if (ctx->objectType) // found class
+ {
+ ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
+ //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():"<none>");
+ }
+ else if (ctx->method==0) // search for class variable with the same name
+ {
+ //printf(" no\n");
+ //printf("yyextra->currentDefinition=%p\n",yyextra->currentDefinition);
+ if (yyextra->currentDefinition &&
+ yyextra->currentDefinition->definitionType()==Definition::TypeClass)
+ {
+ ctx->objectVar = (dynamic_cast<const ClassDef *>(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName);
+ //printf(" ctx->objectVar=%p\n",ctx->objectVar);
+ if (ctx->objectVar)
+ {
+ ctx->objectType = stripClassName(yyscanner,ctx->objectVar->typeString(),yyextra->currentDefinition);
+ //printf(" ctx->objectType=%p\n",ctx->objectType);
+ if (ctx->objectType && !ctx->methodName.isEmpty())
+ {
+ ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
+ //printf(" ctx->method=%p\n",ctx->method);
+ }
+ }
+ }
+ }
}
else // local variable
{
- //printf(" object is local variable\n");
- if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty())
- {
- ctx->method = cd->getMemberByName(ctx->methodName);
- //printf(" class=%p method=%p\n",cd,ctx->method);
- }
+ //printf(" object is local variable\n");
+ if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty())
+ {
+ ctx->method = cd->getMemberByName(ctx->methodName);
+ //printf(" class=%p method=%p\n",cd,ctx->method);
+ }
}
}
}
@@ -3574,210 +3586,215 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
char nc=*p++;
if (nc=='$') // escaped $
{
- yyextra->code->codify("$");
+ yyextra->code->codify("$");
}
- else // name fragment or reference to a nested call
+ else // name fragment or reference to a nested call
{
- if (nc=='n') // name fragment
- {
+ if (nc=='n') // name fragment
+ {
nc=*p++;
- QCString refIdStr;
- while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
- p--;
- int refId=refIdStr.toInt();
- QCString *pName = yyextra->nameDict.find(refId);
- if (pName)
- {
- if (ctx->method && ctx->method->isLinkable())
- {
- writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,pName->data());
- if (yyextra->currentMemberDef && yyextra->collectXRefs)
- {
- addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(ctx->method));
- }
- }
- else
- {
- codifyLines(yyscanner,pName->data());
- }
- }
- else
- {
- //printf("Invalid name: id=%d\n",refId);
- }
- }
- else if (nc=='o') // reference to potential object name
- {
+ QCString refIdStr;
+ while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
+ p--;
+ int refId=refIdStr.toInt();
+ auto it = yyextra->nameMap.find(refId);
+ if (it!=yyextra->nameMap.end())
+ {
+ QCString name = it->second;
+ if (ctx->method && ctx->method->isLinkable())
+ {
+ writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,name);
+ if (yyextra->currentMemberDef && yyextra->collectXRefs)
+ {
+ addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(ctx->method));
+ }
+ }
+ else
+ {
+ codifyLines(yyscanner,name);
+ }
+ }
+ else
+ {
+ //printf("Invalid name: id=%d\n",refId);
+ }
+ }
+ else if (nc=='o') // reference to potential object name
+ {
nc=*p++;
- QCString refIdStr;
- while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
- p--;
- int refId=refIdStr.toInt();
- QCString *pObject = yyextra->objectDict.find(refId);
- if (pObject)
- {
- if (*pObject=="self")
- {
- if (yyextra->currentDefinition &&
- yyextra->currentDefinition->definitionType()==Definition::TypeClass)
- {
- ctx->objectType = dynamic_cast<ClassDef *>(yyextra->currentDefinition);
- if (ctx->objectType->categoryOf())
- {
- ctx->objectType = ctx->objectType->categoryOf();
- }
- if (ctx->objectType && !ctx->methodName.isEmpty())
- {
- ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
- }
- }
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,pObject->data());
- endFontClass(yyscanner);
- }
- else if (*pObject=="super")
- {
- if (yyextra->currentDefinition &&
- yyextra->currentDefinition->definitionType()==Definition::TypeClass)
- {
- ClassDef *cd = dynamic_cast<ClassDef *>(yyextra->currentDefinition);
- if (cd->categoryOf())
- {
- cd = cd->categoryOf();
- }
- BaseClassList *bcd = cd->baseClasses();
- if (bcd) // get direct base class (there should be only one)
- {
- BaseClassListIterator bli(*bcd);
- BaseClassDef *bclass;
- for (bli.toFirst();(bclass=bli.current());++bli)
- {
- if (bclass->classDef->compoundType()!=ClassDef::Protocol)
- {
- ctx->objectType = bclass->classDef;
- if (ctx->objectType && !ctx->methodName.isEmpty())
- {
- ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
- }
- }
- }
- }
- }
- startFontClass(yyscanner,"keyword");
- codifyLines(yyscanner,pObject->data());
- endFontClass(yyscanner);
- }
- else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable
- {
- writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,pObject->data());
- if (yyextra->currentMemberDef && yyextra->collectXRefs)
- {
- addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(ctx->objectVar));
- }
- }
- else if (ctx->objectType &&
- ctx->objectType!=VariableContext::dummyContext &&
- ctx->objectType->isLinkable()
- ) // object is class name
- {
- const ClassDef *cd = ctx->objectType;
- writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data());
- }
- else // object still needs to be resolved
- {
- const ClassDef *cd = getResolvedClass(yyextra->currentDefinition,
- yyextra->sourceFileDef, *pObject);
- if (cd && cd->isLinkable())
- {
- if (ctx->objectType==0) ctx->objectType=cd;
- writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data());
- }
- else
- {
- codifyLines(yyscanner,pObject->data());
- }
- }
- }
- else
- {
- //printf("Invalid object: id=%d\n",refId);
- }
- }
- else if (nc=='c') // reference to nested call
- {
+ QCString refIdStr;
+ while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
+ p--;
+ int refId=refIdStr.toInt();
+ auto it = yyextra->objectMap.find(refId);
+ if (it!=yyextra->objectMap.end())
+ {
+ QCString object = it->second;
+ if (object=="self")
+ {
+ if (yyextra->currentDefinition &&
+ yyextra->currentDefinition->definitionType()==Definition::TypeClass)
+ {
+ ctx->objectType = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ if (ctx->objectType->categoryOf())
+ {
+ ctx->objectType = ctx->objectType->categoryOf();
+ }
+ if (ctx->objectType && !ctx->methodName.isEmpty())
+ {
+ ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
+ }
+ }
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,object);
+ endFontClass(yyscanner);
+ }
+ else if (object=="super")
+ {
+ if (yyextra->currentDefinition &&
+ yyextra->currentDefinition->definitionType()==Definition::TypeClass)
+ {
+ const ClassDef *cd = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ if (cd->categoryOf())
+ {
+ cd = cd->categoryOf();
+ }
+ const BaseClassList *bcd = cd->baseClasses();
+ if (bcd) // get direct base class (there should be only one)
+ {
+ BaseClassListIterator bli(*bcd);
+ BaseClassDef *bclass;
+ for (bli.toFirst();(bclass=bli.current());++bli)
+ {
+ if (bclass->classDef->compoundType()!=ClassDef::Protocol)
+ {
+ ctx->objectType = bclass->classDef;
+ if (ctx->objectType && !ctx->methodName.isEmpty())
+ {
+ ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
+ }
+ }
+ }
+ }
+ }
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,object);
+ endFontClass(yyscanner);
+ }
+ else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable
+ {
+ writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,object);
+ if (yyextra->currentMemberDef && yyextra->collectXRefs)
+ {
+ addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(ctx->objectVar));
+ }
+ }
+ else if (ctx->objectType &&
+ ctx->objectType!=VariableContext::dummyContext &&
+ ctx->objectType->isLinkable()
+ ) // object is class name
+ {
+ const ClassDef *cd = ctx->objectType;
+ writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,object);
+ }
+ else // object still needs to be resolved
+ {
+ const ClassDef *cd = getResolvedClass(yyextra->currentDefinition,
+ yyextra->sourceFileDef, object);
+ if (cd && cd->isLinkable())
+ {
+ if (ctx->objectType==0) ctx->objectType=cd;
+ writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,object);
+ }
+ else
+ {
+ codifyLines(yyscanner,object);
+ }
+ }
+ }
+ else
+ {
+ //printf("Invalid object: id=%d\n",refId);
+ }
+ }
+ else if (nc=='c') // reference to nested call
+ {
nc=*p++;
- QCString refIdStr;
- while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
- p--;
- int refId=refIdStr.toInt();
- ObjCCallCtx *ictx = yyextra->contextDict.find(refId);
- if (ictx) // recurse into nested call
- {
- writeObjCMethodCall(yyscanner,ictx);
- if (ictx->method) // link to nested call successfully
- {
- // get the ClassDef representing the method's return type
- if (QCString(ictx->method->typeString())=="id")
- {
- // see if the method name is unique, if so we link to it
- MemberName *mn=Doxygen::memberNameLinkedMap->find(ctx->methodName);
- //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n",
- // mn==0?-1:(int)mn->count(),
- // ictx->method->name().data(),
- // ctx->methodName.data());
- if (mn && mn->size()==1) // member name unique
- {
- ctx->method = mn->front().get();
- }
- }
- else
- {
- ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition);
- if (ctx->objectType && !ctx->methodName.isEmpty())
- {
- ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
- }
- }
- //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType);
- }
- }
- else
- {
- //printf("Invalid context: id=%d\n",refId);
- }
- }
- else if (nc=='w') // some word
- {
+ QCString refIdStr;
+ while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
+ p--;
+ int refId=refIdStr.toInt();
+ auto it = yyextra->contextMap.find(refId);
+ if (it!=yyextra->contextMap.end()) // recurse into nested call
+ {
+ ObjCCallCtx *ictx = it->second.get();
+ writeObjCMethodCall(yyscanner,ictx);
+ if (ictx->method) // link to nested call successfully
+ {
+ // get the ClassDef representing the method's return type
+ if (QCString(ictx->method->typeString())=="id")
+ {
+ // see if the method name is unique, if so we link to it
+ MemberName *mn=Doxygen::memberNameLinkedMap->find(ctx->methodName);
+ //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n",
+ // mn==0?-1:(int)mn->count(),
+ // ictx->method->name().data(),
+ // ctx->methodName.data());
+ if (mn && mn->size()==1) // member name unique
+ {
+ ctx->method = mn->front().get();
+ }
+ }
+ else
+ {
+ ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition);
+ if (ctx->objectType && !ctx->methodName.isEmpty())
+ {
+ ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
+ }
+ }
+ //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType);
+ }
+ }
+ else
+ {
+ //printf("Invalid context: id=%d\n",refId);
+ }
+ }
+ else if (nc=='w') // some word
+ {
nc=*p++;
- QCString refIdStr;
- while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
- p--;
- int refId=refIdStr.toInt();
- QCString *pWord = yyextra->wordDict.find(refId);
- if (pWord)
- {
- codifyLines(yyscanner,pWord->data());
- }
- }
+ QCString refIdStr;
+ while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
+ p--;
+ int refId=refIdStr.toInt();
+ auto it = yyextra->wordMap.find(refId);
+ if (it!=yyextra->wordMap.end())
+ {
+ QCString word = it->second;
+ codifyLines(yyscanner,word);
+ }
+ }
else if (nc=='d') // comment block
{
nc=*p++;
- QCString refIdStr;
- while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
- p--;
- int refId=refIdStr.toInt();
- QCString *pComment = yyextra->commentDict.find(refId);
- if (pComment)
+ QCString refIdStr;
+ while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; }
+ p--;
+ int refId=refIdStr.toInt();
+ auto it = yyextra->commentMap.find(refId);
+ if (it!=yyextra->commentMap.end())
{
+ QCString comment = it->second;
startFontClass(yyscanner,"comment");
- codifyLines(yyscanner,pComment->data());
- endFontClass(yyscanner);
+ codifyLines(yyscanner,comment);
+ endFontClass(yyscanner);
}
}
- else // illegal marker
- {
- ASSERT("invalid escape sequence"==0);
- }
+ else // illegal marker
+ {
+ ASSERT("invalid escape sequence"==0);
+ }
}
}
else // normal non-marker character
@@ -3794,14 +3811,14 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
}
// Replaces an Objective-C method name fragment s by a marker of the form
-// $n12, the number (12) can later be used as a key for obtaining the name
-// fragment, from yyextra->nameDict
+// $n12, the number (12) can later be used as a key for obtaining the name
+// fragment, from yyextra->nameMap
static QCString escapeName(yyscan_t yyscanner,const char *s)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString result;
result.sprintf("$n%d",yyextra->currentNameId);
- yyextra->nameDict.insert(yyextra->currentNameId,new QCString(s));
+ yyextra->nameMap.emplace(std::make_pair(yyextra->currentNameId,s));
yyextra->currentNameId++;
return result;
}
@@ -3811,7 +3828,7 @@ static QCString escapeObject(yyscan_t yyscanner,const char *s)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString result;
result.sprintf("$o%d",yyextra->currentObjId);
- yyextra->objectDict.insert(yyextra->currentObjId,new QCString(s));
+ yyextra->objectMap.emplace(std::make_pair(yyextra->currentObjId,s));
yyextra->currentObjId++;
return result;
}
@@ -3821,7 +3838,7 @@ static QCString escapeWord(yyscan_t yyscanner,const char *s)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString result;
result.sprintf("$w%d",yyextra->currentWordId);
- yyextra->wordDict.insert(yyextra->currentWordId,new QCString(s));
+ yyextra->wordMap.emplace(std::make_pair(yyextra->currentWordId,s));
yyextra->currentWordId++;
return result;
}
@@ -3831,7 +3848,7 @@ static QCString escapeComment(yyscan_t yyscanner,const char *s)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString result;
result.sprintf("$d%d",yyextra->currentCommentId);
- yyextra->commentDict.insert(yyextra->currentCommentId,new QCString(s));
+ yyextra->commentMap.emplace(std::make_pair(yyextra->currentCommentId,s));
yyextra->currentCommentId++;
return result;
}
@@ -3883,7 +3900,7 @@ static void saveObjCContext(yyscan_t yyscanner)
{
//printf("Trying to save NULL context!\n");
}
- ObjCCallCtx *newCtx = new ObjCCallCtx;
+ auto newCtx = std::make_unique<ObjCCallCtx>();
newCtx->id = yyextra->currentCtxId;
newCtx->lexState = YY_START;
newCtx->braceCount = yyextra->braceCount;
@@ -3891,8 +3908,8 @@ static void saveObjCContext(yyscan_t yyscanner)
newCtx->objectVar = 0;
newCtx->method = 0;
//printf("save state=%d\n",YY_START);
- yyextra->contextDict.insert(yyextra->currentCtxId,newCtx);
- yyextra->currentCtx = newCtx;
+ yyextra->currentCtx = newCtx.get();
+ yyextra->contextMap.emplace(std::make_pair(yyextra->currentCtxId,std::move(newCtx)));
yyextra->braceCount = 0;
yyextra->currentCtxId++;
}
@@ -3903,9 +3920,10 @@ static void restoreObjCContext(yyscan_t yyscanner)
//printf("restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState);
BEGIN(yyextra->currentCtx->lexState);
yyextra->braceCount = yyextra->currentCtx->braceCount;
- if (!yyextra->contextStack.isEmpty())
+ if (!yyextra->contextStack.empty())
{
- yyextra->currentCtx = yyextra->contextStack.pop();
+ yyextra->currentCtx = yyextra->contextStack.top();
+ yyextra->contextStack.pop();
}
else
{
@@ -3926,14 +3944,11 @@ CCodeParser::CCodeParser() : p(std::make_unique<CCodeParser::Private>())
#ifdef FLEX_DEBUG
codeYYset_debug(1,p->yyscanner);
#endif
+ resetCodeParserState();
}
CCodeParser::~CCodeParser()
{
- struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
- yyextra->classScopeLengthStack.clear();
- delete yyextra->codeClassSDict;
- yyextra->codeClassSDict=0;
codeYYlex_destroy(p->yyscanner);
}
@@ -3943,20 +3958,16 @@ void CCodeParser::resetCodeParserState()
//printf("***CodeParser::reset()\n");
yyextra->forceTagReference.resize(0);
yyextra->theVarContext.clear();
- yyextra->classScopeLengthStack.setAutoDelete(TRUE);
- yyextra->classScopeLengthStack.clear();
- delete yyextra->codeClassSDict;
- yyextra->codeClassSDict = new ClassSDict(17);
- yyextra->codeClassSDict->setAutoDelete(TRUE);
- yyextra->codeClassSDict->clear();
+ while (!yyextra->classScopeLengthStack.empty()) yyextra->classScopeLengthStack.pop();
+ yyextra->codeClassMap.clear();
yyextra->curClassBases.clear();
yyextra->anchorCount = 0;
}
-void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const QCString &s,
+void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const QCString &s,
SrcLangExt lang,bool exBlock, const char *exName,FileDef *fd,
- int startLine,int endLine,bool inlineFragment,
- const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx,
+ int startLine,int endLine,bool inlineFragment,
+ const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx,
bool collectXRefs)
{
yyscan_t yyscanner = p->yyscanner;
@@ -3968,10 +3979,6 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
- if (yyextra->codeClassSDict==0)
- {
- resetCodeParserState();
- }
yyextra->code = &od;
yyextra->inputString = s;
yyextra->inputPosition = 0;
@@ -3998,10 +4005,10 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
yyextra->sharpCount = 0;
yyextra->insideTemplate = FALSE;
yyextra->theCallContext.clear();
- yyextra->scopeStack.clear();
+ while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
yyextra->classScope = className;
//printf("parseCCode %s\n",className);
- yyextra->exampleBlock = exBlock;
+ yyextra->exampleBlock = exBlock;
yyextra->exampleName = exName;
yyextra->sourceFileDef = fd;
yyextra->lineNumbers = fd!=0 && showLineNumbers;
@@ -4014,7 +4021,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
}
yyextra->lang = lang;
yyextra->insideObjC = lang==SrcLangExt_ObjC;
- if (yyextra->sourceFileDef)
+ if (yyextra->sourceFileDef)
{
setCurrentDoc(yyscanner,"l00001");
}
diff --git a/src/commentcnv.l b/src/commentcnv.l
index c1ec170..036f830 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -1108,45 +1108,6 @@ static void replaceComment(yyscan_t yyscanner,int offset)
}
}
-// simplified way to know if this is fixed form
-// duplicate in fortrancode.l
-static bool recognizeFixedForm(const char* contents)
-{
- int column=0;
- bool skipLine=FALSE;
-
- for(int i=0;;i++) {
- column++;
-
- switch(contents[i]) {
- case '\n':
- column=0;
- skipLine=FALSE;
- break;
- case ' ':
- break;
- case '\000':
- return FALSE;
- case 'C':
- case 'c':
- case '*':
- if(column==1) return TRUE;
- if(skipLine) break;
- return FALSE;
- case '!':
- if(column>1 && column<7) return FALSE;
- skipLine=TRUE;
- break;
- default:
- if(skipLine) break;
- if(column==7) return TRUE;
- return FALSE;
- }
- }
- return FALSE;
-}
-
-
/*! This function does three things:
* -# It converts multi-line C++ style comment blocks (that are aligned)
* to C style comment blocks (if MULTILINE_CPP_IS_BRIEF is set to NO).
@@ -1183,7 +1144,8 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
yyextra->isFixedForm = FALSE;
if (yyextra->lang==SrcLangExt_Fortran)
{
- yyextra->isFixedForm = recognizeFixedForm(inBuf->data());
+ FortranFormat fmt = convertFileNameFortranParserCode(fileName);
+ yyextra->isFixedForm = recognizeFixedForm(inBuf->data(),fmt);
}
if (yyextra->lang==SrcLangExt_Markdown)
@@ -1205,7 +1167,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have "
"a corresponding \\endcond command within this file.",sectionInfo.data());
}
- if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown)
+ if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown && yyextra->lang!=SrcLangExt_Fortran)
{
QCString tmp= "(probable line reference: ";
bool first = TRUE;
diff --git a/src/commentscan.l b/src/commentscan.l
index 5a71b14..ce495a1 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -666,6 +666,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
optList = QCStringList::split(',',optStr);
}
auto it = docCmdMap.find(cmdName.data());
+ //printf("lookup command '%s' found=%d\n",cmdName.data(),it!=docCmdMap.end());
if (it!=docCmdMap.end()) // special action is required
{
int i=0;
@@ -1043,6 +1044,12 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
}
+<ClassDocArg2>{DOCNL} {
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ unput('\n');
+ BEGIN( Comment );
+ }
<ClassDocArg2>{FILE}|"<>" { // second argument; include file
yyextra->current->includeFile = yytext;
BEGIN( ClassDocArg3 );
@@ -1051,12 +1058,6 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
yyextra->lineNr++;
addOutput(yyscanner,'\n');
}
-<ClassDocArg2>{DOCNL} {
- //addOutput(yyscanner,'\n');
- //if (*yytext=='\n') yyextra->lineNr++;
- unput('\n');
- BEGIN( Comment );
- }
<ClassDocArg2>. { // ignore other stuff
}
@@ -3234,7 +3235,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
yyextra->guards = std::stack<GuardedSection>();
yyextra->langParser = parser;
yyextra->current = curEntry;
- yyextra->current->docLine = (lineNr > 1 ? lineNr-1: 1);
+ yyextra->current->docLine = (lineNr > 1 ? lineNr : 1);
if (comment.isEmpty()) return FALSE; // avoid empty strings
yyextra->inputString = comment;
yyextra->inputString.append(" ");
diff --git a/src/config.xml b/src/config.xml
index 14fafca..d45b937 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -916,6 +916,15 @@ Go to the <a href="commands.html">next</a> section or return to the
]]>
</docs>
</option>
+ <option type='bool' id='RESOLVE_UNNAMED_PARAMS' defval='1'>
+ <docs>
+<![CDATA[
+ If this flag is set to \c YES, the name of an unnamed parameter in a declaration will be
+ determined by the corresponding definition. By default unnamed parameters remain unnamed
+ in the output.
+]]>
+ </docs>
+ </option>
<option type='bool' id='HIDE_UNDOC_MEMBERS' defval='0'>
<docs>
<![CDATA[
diff --git a/src/context.cpp b/src/context.cpp
index 29a704a..ee394d4 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -1301,8 +1301,8 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l
static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const QCString &relPath,
const QCString &code,int startLine=-1,int endLine=-1,bool showLineNumbers=FALSE)
{
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension());
- intf.resetCodeParserState();
+ auto intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension());
+ intf->resetCodeParserState();
QGString s;
FTextStream t(&s);
switch (g_globals.outputFormat)
@@ -1310,14 +1310,14 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q
case ContextOutputFormat_Html:
{
HtmlCodeGenerator codeGen(t,relPath);
- intf.parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
+ intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
startLine,endLine,TRUE,md,showLineNumbers,md);
}
break;
case ContextOutputFormat_Latex:
{
LatexCodeGenerator codeGen(t,relPath,md->docFile());
- intf.parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
+ intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(),
startLine,endLine,TRUE,md,showLineNumbers,md);
}
break;
@@ -1332,8 +1332,8 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q
static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath)
{
static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(fd->getDefFileExtension());
- intf.resetCodeParserState();
+ auto intf = Doxygen::parserManager->getCodeParser(fd->getDefFileExtension());
+ intf->resetCodeParserState();
QGString s;
FTextStream t(&s);
switch (g_globals.outputFormat)
@@ -1341,7 +1341,7 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath)
case ContextOutputFormat_Html:
{
HtmlCodeGenerator codeGen(t,relPath);
- intf.parseCode(codeGen,0,
+ intf->parseCode(codeGen,0,
fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources
fd->getLanguage(), // lang
FALSE, // isExampleBlock
@@ -1360,7 +1360,7 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath)
case ContextOutputFormat_Latex:
{
LatexCodeGenerator codeGen(t,relPath,fd->docFile());
- intf.parseCode(codeGen,0,
+ intf->parseCode(codeGen,0,
fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources
fd->getLanguage(), // lang
FALSE, // isExampleBlock
@@ -3896,13 +3896,25 @@ class TextGeneratorLatex : public TextGeneratorIntf
if (f && anchor) m_ts << "_";
if (anchor) m_ts << anchor;
m_ts << "}{";
- filterLatexString(m_ts,text);
+ filterLatexString(m_ts,text,
+ false, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ false, // insideTable
+ false // keepSpaces
+ );
m_ts << "}}";
}
else
{
m_ts << "\\textbf{ ";
- filterLatexString(m_ts,text);
+ filterLatexString(m_ts,text,
+ false, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ false, // insideTable
+ false // keepSpaces
+ );
m_ts << "}";
}
}
diff --git a/src/definition.cpp b/src/definition.cpp
index 3ed331c..9e78b74 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -176,14 +176,14 @@ static bool matchExcludedSymbols(const char *name)
QRegExp re(substitute(pattern,"*",".*"),TRUE);
int pl;
int i = re.match(symName,0,&pl);
- //printf(" %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data());
+ //printf(" %d = re.match(%s) pattern=%s pl=%d len=%d\n",i,symName.data(),pattern.data(),pl,symName.length());
if (i!=-1) // wildcard match
{
uint ui=(uint)i;
uint sl=symName.length();
// check if it is a whole word match
- if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) &&
- (ui+pl==sl || pattern.at(ui+pl)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd))
+ if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) &&
+ (ui+pl==sl || pattern.at(pattern.length()-1)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd))
)
{
//printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i);
@@ -613,6 +613,8 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in
outputLanguage!="Korean";
QCString brief = b;
brief = brief.stripWhiteSpace();
+ brief = stripLeadingAndTrailingEmptyLines(brief,briefLine);
+ brief = brief.stripWhiteSpace();
if (brief.isEmpty()) return;
uint bl = brief.length();
if (bl>0 && needsDot) // add punctuation if needed
@@ -1234,27 +1236,27 @@ void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const
{
//printf("Adding code fragment '%s' ext='%s'\n",
// codeFragment.data(),m_impl->defFileExt.data());
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(m_impl->defFileExt);
- intf.resetCodeParserState();
+ auto intf = Doxygen::parserManager->getCodeParser(m_impl->defFileExt);
+ intf->resetCodeParserState();
//printf("Read:\n'%s'\n\n",codeFragment.data());
const MemberDef *thisMd = 0;
if (definitionType()==TypeMember) thisMd = dynamic_cast <const MemberDef*>(this);
- ol.startCodeFragment();
- intf.parseCode(ol, // codeOutIntf
- scopeName, // scope
- codeFragment, // input
- m_impl->lang, // lang
- FALSE, // isExample
- 0, // exampleName
- m_impl->body->fileDef, // fileDef
- actualStart, // startLine
- actualEnd, // endLine
- TRUE, // inlineFragment
- thisMd, // memberDef
- TRUE // show line numbers
- );
- ol.endCodeFragment();
+ ol.startCodeFragment("DoxyCode");
+ intf->parseCode(ol, // codeOutIntf
+ scopeName, // scope
+ codeFragment, // input
+ m_impl->lang, // lang
+ FALSE, // isExample
+ 0, // exampleName
+ m_impl->body->fileDef, // fileDef
+ actualStart, // startLine
+ actualEnd, // endLine
+ TRUE, // inlineFragment
+ thisMd, // memberDef
+ TRUE // show line numbers
+ );
+ ol.endCodeFragment("DoxyCode");
}
}
ol.popGeneratorState();
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index da7987b..b25a43c 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -242,18 +242,23 @@ void DocbookCodeGenerator::finish()
{
endCodeLine();
}
-void DocbookCodeGenerator::startCodeFragment()
+void DocbookCodeGenerator::startCodeFragment(const char *)
{
- m_t << "<literallayout><computeroutput>" << endl;
+DB_GEN_C
+ m_t << "<programlisting>";
}
-void DocbookCodeGenerator::endCodeFragment()
+
+void DocbookCodeGenerator::endCodeFragment(const char *)
{
+DB_GEN_C
//endCodeLine checks is there is still an open code line, if so closes it.
endCodeLine();
- m_t << "</computeroutput></literallayout>" << endl;
+ m_t << "</programlisting>";
}
+//-------------------------------------------------------------------------------
+
DocbookGenerator::DocbookGenerator() : OutputGenerator(Config_getString(DOCBOOK_OUTPUT))
{
DB_GEN_C
@@ -732,12 +737,12 @@ void DocbookGenerator::endMemberItem()
DB_GEN_C
t << "</para>" << endl;
}
-void DocbookGenerator::startBold(void)
+void DocbookGenerator::startBold()
{
DB_GEN_C
t << "<emphasis role=\"strong\">";
}
-void DocbookGenerator::endBold(void)
+void DocbookGenerator::endBold()
{
DB_GEN_C
t << "</emphasis>";
@@ -755,7 +760,7 @@ DB_GEN_C2("extraIndentLevel " << extraIndentLevel)
t << "<section>" << endl;
t << "<title>";
}
-void DocbookGenerator::writeRuler(void)
+void DocbookGenerator::writeRuler()
{
DB_GEN_C2("m_inLevel " << m_inLevel)
DB_GEN_C2("m_inGroup " << m_inGroup)
@@ -945,12 +950,12 @@ void DocbookGenerator::endExamples()
DB_GEN_C
t << "</simplesect>" << endl;
}
-void DocbookGenerator::startSubsubsection(void)
+void DocbookGenerator::startSubsubsection()
{
DB_GEN_C
t << "<simplesect><title>";
}
-void DocbookGenerator::endSubsubsection(void)
+void DocbookGenerator::endSubsubsection()
{
DB_GEN_C
t << "</title></simplesect>" << endl;
@@ -995,19 +1000,6 @@ DB_GEN_C
if (closeBracket) t << ")";
}
}
-void DocbookGenerator::startCodeFragment()
-{
-DB_GEN_C
- t << "<programlisting>";
-}
-void DocbookGenerator::endCodeFragment()
-{
-DB_GEN_C
- //endCodeLine checks is there is still an open code line, if so closes it.
- endCodeLine();
-
- t << "</programlisting>";
-}
void DocbookGenerator::startMemberTemplateParams()
{
DB_GEN_C
diff --git a/src/docbookgen.h b/src/docbookgen.h
index 0fefe4b..112d0a0 100644
--- a/src/docbookgen.h
+++ b/src/docbookgen.h
@@ -53,8 +53,8 @@ class DocbookCodeGenerator : public CodeOutputInterface
void setCurrentDoc(const Definition *,const char *,bool);
void addWord(const char *,bool);
void finish();
- void startCodeFragment();
- void endCodeFragment();
+ void startCodeFragment(const char *style);
+ void endCodeFragment(const char *style);
private:
FTextStream m_t;
@@ -130,6 +130,10 @@ class DocbookGenerator : public OutputGenerator
{ m_codeGen.endFontClass(); }
void writeCodeAnchor(const char *anchor)
{ m_codeGen.writeCodeAnchor(anchor); }
+ void startCodeFragment(const char *style)
+ { m_codeGen.startCodeFragment(style); }
+ void endCodeFragment(const char *style)
+ { m_codeGen.endCodeFragment(style); }
// ---------------------------
void writeDoc(DocNode *,const Definition *ctx,const MemberDef *md);
@@ -169,35 +173,33 @@ class DocbookGenerator : public OutputGenerator
void writeChar(char);
void writeString(const char *);
void startParagraph(const char *);
- void endParagraph(void);
+ void endParagraph();
void writeObjectLink(const char *,const char *,const char *,const char *);
void startHtmlLink(const char *){DB_GEN_NEW};
- void endHtmlLink(void){DB_GEN_NEW};
- void startBold(void);
- void endBold(void);
- void startTypewriter(void);
- void endTypewriter(void);
- void startEmphasis(void){DB_GEN_NEW};
- void endEmphasis(void){DB_GEN_NEW};
- void startCodeFragment(void);
- void endCodeFragment(void);
- void writeRuler(void);
- void startDescription(void){DB_GEN_NEW};
- void endDescription(void){DB_GEN_NEW};
- void startDescItem(void){DB_GEN_NEW};
- void startDescForItem(void){DB_GEN_EMPTY};
- void endDescForItem(void){DB_GEN_EMPTY};
- void endDescItem(void){DB_GEN_NEW};
- void startCenter(void){DB_GEN_NEW};
- void endCenter(void){DB_GEN_NEW};
- void startSmall(void){DB_GEN_NEW};
- void endSmall(void){DB_GEN_NEW};
- void startExamples(void);
- void endExamples(void);
+ void endHtmlLink(){DB_GEN_NEW};
+ void startBold();
+ void endBold();
+ void startTypewriter();
+ void endTypewriter();
+ void startEmphasis(){DB_GEN_NEW};
+ void endEmphasis(){DB_GEN_NEW};
+ void writeRuler();
+ void startDescription(){DB_GEN_NEW};
+ void endDescription(){DB_GEN_NEW};
+ void startDescItem(){DB_GEN_NEW};
+ void startDescForItem(){DB_GEN_EMPTY};
+ void endDescForItem(){DB_GEN_EMPTY};
+ void endDescItem(){DB_GEN_NEW};
+ void startCenter(){DB_GEN_NEW};
+ void endCenter(){DB_GEN_NEW};
+ void startSmall(){DB_GEN_NEW};
+ void endSmall(){DB_GEN_NEW};
+ void startExamples();
+ void endExamples();
void startParamList(BaseOutputDocInterface::ParamListTypes,const char *){DB_GEN_NEW};
- void endParamList(void){DB_GEN_NEW};
- void startTitle(void){DB_GEN_NEW};
- void endTitle(void){DB_GEN_NEW};
+ void endParamList(){DB_GEN_NEW};
+ void startTitle(){DB_GEN_NEW};
+ void endTitle(){DB_GEN_NEW};
void writeAnchor(const char *,const char *){DB_GEN_EMPTY};
void startSection(const char *,const char *,SectionType);
void endSection(const char *,SectionType);
@@ -205,21 +207,21 @@ class DocbookGenerator : public OutputGenerator
void addIndexItem(const char *,const char *);
void writeNonBreakableSpace(int);
void startDescTable(const char *);
- void endDescTable(void);
- void startDescTableRow(void);
- void endDescTableRow(void);
- void startDescTableTitle(void);
- void endDescTableTitle(void);
- void startDescTableData(void);
- void endDescTableData(void);
+ void endDescTable();
+ void startDescTableRow();
+ void endDescTableRow();
+ void startDescTableTitle();
+ void endDescTableTitle();
+ void startDescTableData();
+ void endDescTableData();
void startTextLink(const char *,const char *){DB_GEN_NEW};
- void endTextLink(void){DB_GEN_NEW};
- void startPageRef(void){DB_GEN_NEW};
+ void endTextLink(){DB_GEN_NEW};
+ void startPageRef(){DB_GEN_NEW};
void endPageRef(const char *,const char *){DB_GEN_NEW};
- void startSubsection(void){DB_GEN_NEW};
- void endSubsection(void){DB_GEN_NEW};
- void startSubsubsection(void);
- void endSubsubsection(void);
+ void startSubsection(){DB_GEN_NEW};
+ void endSubsection(){DB_GEN_NEW};
+ void startSubsubsection();
+ void endSubsubsection();
void startGroupHeader(int);
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 78af6e0..bf6c827 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -316,9 +316,11 @@ DB_VIS_C
{
case DocVerbatim::Code: // fall though
m_t << "<literallayout><computeroutput>";
- Doxygen::parserManager->getCodeParser(m_langExt)
- .parseCode(m_ci,s->context(),s->text(),langExt,
- s->isExample(),s->exampleFile());
+ getCodeParser(m_langExt).parseCode(m_ci,s->context(),
+ s->text(),
+ langExt,
+ s->isExample(),
+ s->exampleFile());
m_t << "</computeroutput></literallayout>";
break;
case DocVerbatim::Verbatim:
@@ -425,24 +427,22 @@ DB_VIS_C
m_t << "<literallayout><computeroutput>";
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
- inc->text(),
- langExt,
- inc->isExample(),
- inc->exampleFile(), fd);
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
+ inc->text(),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile(), fd);
delete fd;
m_t << "</computeroutput></literallayout>";
}
break;
case DocInclude::Include:
m_t << "<literallayout><computeroutput>";
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
- inc->text(),
- langExt,
- inc->isExample(),
- inc->exampleFile());
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
+ inc->text(),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile());
m_t << "</computeroutput></literallayout>";
break;
case DocInclude::DontInclude:
@@ -463,14 +463,13 @@ DB_VIS_C
break;
case DocInclude::Snippet:
m_t << "<literallayout><computeroutput>";
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
- inc->context(),
- extractBlock(inc->text(),inc->blockId()),
- langExt,
- inc->isExample(),
- inc->exampleFile()
- );
+ getCodeParser(inc->extension()).parseCode(m_ci,
+ inc->context(),
+ extractBlock(inc->text(),inc->blockId()),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile()
+ );
m_t << "</computeroutput></literallayout>";
break;
case DocInclude::SnipWithLines:
@@ -478,8 +477,7 @@ DB_VIS_C
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
m_t << "<literallayout><computeroutput>";
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -531,17 +529,16 @@ DB_VIS_C
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),
- op->text(),langExt,op->isExample(),
- op->exampleFile(),
- fd, // fileDef
- op->line(), // startLine
- -1, // endLine
- FALSE, // inline fragment
- 0, // memberDef
- op->showLineNo() // show line numbers
- );
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),
+ op->text(),langExt,op->isExample(),
+ op->exampleFile(),
+ fd, // fileDef
+ op->line(), // startLine
+ -1, // endLine
+ FALSE, // inline fragment
+ 0, // memberDef
+ op->showLineNo() // show line numbers
+ );
if (fd) delete fd;
}
pushEnabled();
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 73131f6..b79f8c8 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -2448,8 +2448,8 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) :
}
m_isSubPage = pd && pd->hasParentPage();
if (sec->type()!=SectionType::Page || m_isSubPage) m_anchor = sec->label();
- //printf("m_text=%s,m_ref=%s,m_file=%s,m_refToAnchor=%d type=%d\n",
- // m_text.data(),m_ref.data(),m_file.data(),m_refToAnchor,sec->type);
+ //printf("m_text=%s,m_ref=%s,m_file=%s,type=%d\n",
+ // m_text.data(),m_ref.data(),m_file.data(),m_refType);
return;
}
else if (resolveLink(context,target,TRUE,&compound,anchor))
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index ac5b6d2..c20ae1a 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -6,8 +6,8 @@
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -49,7 +49,7 @@
#define USE_STATE2STRING 0
#define TK_COMMAND_SEL() (yytext[0] == '@' ? TK_COMMAND_AT : TK_COMMAND_BS)
-
+
//--------------------------------------------------------------------------
// context for tokenizer phase
@@ -187,7 +187,7 @@ static void processSection()
}
else
{
- warn(g_fileName,yylineno,"Found section/anchor %s without context\n",g_secLabel.data());
+ warn(g_fileName,yylineno,"Found section/anchor %s without context\n",g_secLabel.data());
}
SectionInfo *si = SectionManager::instance().find(g_secLabel);
if (si)
@@ -203,10 +203,10 @@ static void handleHtmlTag()
g_token->attribs.clear();
g_token->endTag = FALSE;
g_token->emptyTag = FALSE;
-
+
// Check for end tag
int startNamePos=1;
- if (tagText.at(1)=='/')
+ if (tagText.at(1)=='/')
{
g_token->endTag = TRUE;
startNamePos++;
@@ -234,7 +234,7 @@ static void handleHtmlTag()
// check for end of the tag
if (c == '>') break;
// Check for XML style "empty" tag.
- if (c == '/')
+ if (c == '/')
{
g_token->emptyTag = TRUE;
break;
@@ -244,42 +244,42 @@ static void handleHtmlTag()
while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { c=tagText.at(++i); }
endName=i;
HtmlAttrib opt;
- opt.name = tagText.mid(startName,endName-startName).lower();
+ opt.name = tagText.mid(startName,endName-startName).lower();
// skip spaces
- while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
+ while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
if (tagText.at(i)=='=') // option has value
{
c=tagText.at(++i);
// skip spaces
- while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
+ while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
if (tagText.at(i)=='\'') // option '...'
{
c=tagText.at(++i);
- startAttrib=i;
-
- // search for matching quote
- while (i<(int)yyleng && c!='\'') { c=tagText.at(++i); }
- endAttrib=i;
+ startAttrib=i;
+
+ // search for matching quote
+ while (i<(int)yyleng && c!='\'') { c=tagText.at(++i); }
+ endAttrib=i;
if (i<(int)yyleng) { c=tagText.at(++i);}
}
else if (tagText.at(i)=='"') // option "..."
{
c=tagText.at(++i);
- startAttrib=i;
- // search for matching quote
- while (i<(int)yyleng && c!='"') { c=tagText.at(++i); }
- endAttrib=i;
+ startAttrib=i;
+ // search for matching quote
+ while (i<(int)yyleng && c!='"') { c=tagText.at(++i); }
+ endAttrib=i;
if (i<(int)yyleng) { c=tagText.at(++i);}
}
else // value without any quotes
{
- startAttrib=i;
- // search for separator or end symbol
- while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { c=tagText.at(++i); }
- endAttrib=i;
+ startAttrib=i;
+ // search for separator or end symbol
+ while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { c=tagText.at(++i); }
+ endAttrib=i;
if (i<(int)yyleng) { c=tagText.at(++i);}
}
- opt.value = tagText.mid(startAttrib,endAttrib-startAttrib);
+ opt.value = tagText.mid(startAttrib,endAttrib-startAttrib);
if (opt.name == "align") opt.value = opt.value.lower();
else if (opt.name == "valign")
{
@@ -296,7 +296,7 @@ static void handleHtmlTag()
}
g_token->attribsStr = tagText.mid(startAttribList,i-startAttribList);
}
-
+
static QCString stripEmptyLines(const QCString &s)
{
if (s.isEmpty()) return QCString();
@@ -307,11 +307,11 @@ static QCString stripEmptyLines(const QCString &s)
{
int c;
while ((c=s[p]) && (c==' ' || c=='\t')) p++;
- if (s[p]=='\n')
+ if (s[p]=='\n')
{
- start=++p;
+ start=++p;
}
- else
+ else
{
break;
}
@@ -323,7 +323,7 @@ static QCString stripEmptyLines(const QCString &s)
{
int c;
while ((c=s[p]) && (c==' ' || c=='\t')) p--;
- if (s[p]=='\n')
+ if (s[p]=='\n')
{
end=p;
}
@@ -385,14 +385,14 @@ FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+&#]
FILEECHAR [a-z_A-Z0-9\-\+&#]
HFILEMASK ("."{FILESCHAR}*{FILEECHAR}+)+
FILEMASK ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|{HFILEMASK}
-LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)?
+LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)?
VERBATIM "verbatim"{BLANK}*
SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---")
SPCMD2 {CMD}[\\@<>&$#%~".+=|-]
SPCMD3 {CMD}_form#[0-9]+
SPCMD4 {CMD}"::"
SPCMD5 {CMD}":"
-INOUT "in"|"out"|("in"{BLANK}*","?{BLANK}*"out")|("out"{BLANK}*","?{BLANK}*"in")
+INOUT "in"|"out"|("in"{BLANK}*","?{BLANK}*"out")|("out"{BLANK}*","?{BLANK}*"in")
PARAMIO {CMD}param{BLANK}*"["{BLANK}*{INOUT}{BLANK}*"]"
VARARGS "..."
TEMPCHAR [a-z_A-Z0-9.,: \t\*\&\(\)\[\]]
@@ -427,7 +427,7 @@ WORD2 "."|","|"("|")"|"["|"]"|"::"|":"|";"|"\?"|"="|"'"
WORD1NQ {ESCWORD}|{CHARWORDQ}+|"{"|"}"
WORD2NQ "."|","|"("|")"|"["|"]"|"::"|":"|";"|"\?"|"="|"'"
CAPTION [cC][aA][pP][tT][iI][oO][nN]
-HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">"
+HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">"
HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"|"strike"|"u"|"del"|"ins"|"s"
HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"|"STRIKE"|"U"|"DEL"|"INS"|"S"
HTMLKEYW {HTMLKEYL}|{HTMLKEYU}
@@ -493,15 +493,15 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
%%
<St_Para>\r /* skip carriage return */
-<St_Para>^{LISTITEM} { /* list item */
+<St_Para>^{LISTITEM} { /* list item */
QCString text=yytext;
- int dashPos = text.findRev('-');
- g_token->isEnumList = text.at(dashPos+1)=='#';
+ int dashPos = text.findRev('-');
+ g_token->isEnumList = text.at(dashPos+1)=='#';
g_token->id = -1;
- g_token->indent = computeIndent(yytext,dashPos);
+ g_token->indent = computeIndent(yytext,dashPos);
return TK_LISTITEM;
}
-<St_Para>^{MLISTITEM} { /* list item */
+<St_Para>^{MLISTITEM} { /* list item */
if (!g_markdownSupport || g_insidePre)
{
REJECT;
@@ -517,7 +517,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
return TK_LISTITEM;
}
}
-<St_Para>^{OLISTITEM} { /* numbered list item */
+<St_Para>^{OLISTITEM} { /* numbered list item */
if (!g_markdownSupport || g_insidePre)
{
REJECT;
@@ -534,15 +534,15 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
return TK_LISTITEM;
}
}
-<St_Para>{BLANK}*(\n|"\\ilinebr"){LISTITEM} { /* list item on next line */
+<St_Para>{BLANK}*(\n|"\\ilinebr"){LISTITEM} { /* list item on next line */
QCString text=extractPartAfterNewLine(yytext);
- int dashPos = text.findRev('-');
- g_token->isEnumList = text.at(dashPos+1)=='#';
+ int dashPos = text.findRev('-');
+ g_token->isEnumList = text.at(dashPos+1)=='#';
g_token->id = -1;
- g_token->indent = computeIndent(text,dashPos);
+ g_token->indent = computeIndent(text,dashPos);
return TK_LISTITEM;
}
-<St_Para>{BLANK}*(\n|"\\ilinebr"){MLISTITEM} { /* list item on next line */
+<St_Para>{BLANK}*(\n|"\\ilinebr"){MLISTITEM} { /* list item on next line */
if (!g_markdownSupport || g_insidePre)
{
REJECT;
@@ -558,7 +558,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
return TK_LISTITEM;
}
}
-<St_Para>{BLANK}*(\n|"\\ilinebr"){OLISTITEM} { /* list item on next line */
+<St_Para>{BLANK}*(\n|"\\ilinebr"){OLISTITEM} { /* list item on next line */
if (!g_markdownSupport || g_insidePre)
{
REJECT;
@@ -575,41 +575,41 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
return TK_LISTITEM;
}
}
-<St_Para>^{ENDLIST} { /* end list */
+<St_Para>^{ENDLIST} { /* end list */
int dotPos = QCString(yytext).findRev('.');
- g_token->indent = computeIndent(yytext,dotPos);
+ g_token->indent = computeIndent(yytext,dotPos);
return TK_ENDLIST;
}
-<St_Para>{BLANK}*(\n|"\\ilinebr"){ENDLIST} { /* end list on next line */
+<St_Para>{BLANK}*(\n|"\\ilinebr"){ENDLIST} { /* end list on next line */
QCString text=extractPartAfterNewLine(yytext);
int dotPos = text.findRev('.');
- g_token->indent = computeIndent(text,dotPos);
+ g_token->indent = computeIndent(text,dotPos);
return TK_ENDLIST;
}
<St_Para>"{"{BLANK}*"@link"/{BLANK}+ {
- g_token->name = "javalink";
- return TK_COMMAND_AT;
- }
+ g_token->name = "javalink";
+ return TK_COMMAND_AT;
+ }
<St_Para>"{"{BLANK}*"@inheritDoc"{BLANK}*"}" {
- g_token->name = "inheritdoc";
- return TK_COMMAND_AT;
- }
+ g_token->name = "inheritdoc";
+ return TK_COMMAND_AT;
+ }
<St_Para>"@_fakenl" { // artificial new line
- yylineno++;
- }
+ //yylineno++;
+ }
<St_Para>{SPCMD3} {
- g_token->name = "_form";
- bool ok;
- g_token->id = QCString(yytext).right((int)yyleng-7).toInt(&ok);
- ASSERT(ok);
- return TK_COMMAND_SEL();
- }
+ g_token->name = "_form";
+ bool ok;
+ g_token->id = QCString(yytext).right((int)yyleng-7).toInt(&ok);
+ ASSERT(ok);
+ return TK_COMMAND_SEL();
+ }
<St_Para>{CMD}"n"\n { /* \n followed by real newline */
- yylineno++;
+ //yylineno++;
g_token->name = yytext+1;
- g_token->name = g_token->name.stripWhiteSpace();
- g_token->paramDir=TokenInfo::Unspecified;
- return TK_COMMAND_SEL();
+ g_token->name = g_token->name.stripWhiteSpace();
+ g_token->paramDir=TokenInfo::Unspecified;
+ return TK_COMMAND_SEL();
}
<St_Para>"\\ilinebr" {
}
@@ -618,108 +618,108 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_Para>{SPCMD5} |
<St_Para>{SPCMD4} { /* special command */
g_token->name = yytext+1;
- g_token->name = g_token->name.stripWhiteSpace();
- g_token->paramDir=TokenInfo::Unspecified;
+ g_token->name = g_token->name.stripWhiteSpace();
+ g_token->paramDir=TokenInfo::Unspecified;
return TK_COMMAND_SEL();
- }
+ }
<St_Para>{PARAMIO} { /* param [in,out] command */
- g_token->name = "param";
- QCString s(yytext);
- bool isIn = s.find("in")!=-1;
- bool isOut = s.find("out")!=-1;
- if (isIn)
- {
- if (isOut)
- {
- g_token->paramDir=TokenInfo::InOut;
- }
- else
- {
- g_token->paramDir=TokenInfo::In;
- }
- }
- else if (isOut)
- {
- g_token->paramDir=TokenInfo::Out;
- }
- else
- {
- g_token->paramDir=TokenInfo::Unspecified;
- }
- return TK_COMMAND_SEL();
- }
+ g_token->name = "param";
+ QCString s(yytext);
+ bool isIn = s.find("in")!=-1;
+ bool isOut = s.find("out")!=-1;
+ if (isIn)
+ {
+ if (isOut)
+ {
+ g_token->paramDir=TokenInfo::InOut;
+ }
+ else
+ {
+ g_token->paramDir=TokenInfo::In;
+ }
+ }
+ else if (isOut)
+ {
+ g_token->paramDir=TokenInfo::Out;
+ }
+ else
+ {
+ g_token->paramDir=TokenInfo::Unspecified;
+ }
+ return TK_COMMAND_SEL();
+ }
<St_Para>{URLPROTOCOL}{URLMASK}/[,\.] { // URL, or URL.
g_token->name=yytext;
- g_token->isEMailAddr=FALSE;
- return TK_URL;
+ g_token->isEMailAddr=FALSE;
+ return TK_URL;
}
<St_Para>{URLPROTOCOL}{URLMASK} { // URL
g_token->name=yytext;
- g_token->isEMailAddr=FALSE;
- return TK_URL;
+ g_token->isEMailAddr=FALSE;
+ return TK_URL;
}
<St_Para>"<"{URLPROTOCOL}{URLMASK}">" { // URL
g_token->name=yytext;
g_token->name = g_token->name.mid(1,g_token->name.length()-2);
- g_token->isEMailAddr=FALSE;
- return TK_URL;
+ g_token->isEMailAddr=FALSE;
+ return TK_URL;
}
<St_Para>{MAILADDR} { // Mail address
g_token->name=yytext;
g_token->name.stripPrefix("mailto:");
- g_token->isEMailAddr=TRUE;
- return TK_URL;
+ g_token->isEMailAddr=TRUE;
+ return TK_URL;
}
<St_Para>"<"{MAILADDR}">" { // Mail address
g_token->name=yytext;
g_token->name = g_token->name.mid(1,g_token->name.length()-2);
g_token->name.stripPrefix("mailto:");
- g_token->isEMailAddr=TRUE;
- return TK_URL;
+ g_token->isEMailAddr=TRUE;
+ return TK_URL;
}
<St_Para>"<"{MAILADDR2}">" { // anti spam mail address
g_token->name=yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_Para>"$"{ID}":"[^:\n$][^\n$]*"$" { /* RCS tag */
QCString tagName(yytext+1);
- int index=tagName.find(':');
- g_token->name = tagName.left(index);
- int text_begin = index+2;
- int text_end = tagName.length()-1;
- if (tagName[text_begin-1]==':') /* check for Subversion fixed-length keyword */
- {
- ++text_begin;
- if (tagName[text_end-1]=='#')
- --text_end;
- }
- g_token->text = tagName.mid(text_begin,text_end-text_begin);
- return TK_RCSTAG;
- }
+ int index=tagName.find(':');
+ g_token->name = tagName.left(index);
+ int text_begin = index+2;
+ int text_end = tagName.length()-1;
+ if (tagName[text_begin-1]==':') /* check for Subversion fixed-length keyword */
+ {
+ ++text_begin;
+ if (tagName[text_end-1]=='#')
+ --text_end;
+ }
+ g_token->text = tagName.mid(text_begin,text_end-text_begin);
+ return TK_RCSTAG;
+ }
<St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}")" | /* environment variable */
<St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}"("{ID}"))" { /* environment variable */
QCString name = &yytext[2];
- name = name.left(name.length()-1);
- QCString value = Portable::getenv(name);
- for (int i=value.length()-1;i>=0;i--) unput(value.at(i));
+ name = name.left(name.length()-1);
+ QCString value = Portable::getenv(name);
+ for (int i=value.length()-1;i>=0;i--) unput(value.at(i));
}
-<St_Para>{HTMLTAG} { /* html tag */
+<St_Para>{HTMLTAG} { /* html tag */
handleHtmlTag();
return TK_HTMLTAG;
}
-<St_Para,St_Text>"&"{ID}";" { /* special symbol */
+<St_Para,St_Text>"&"{ID}";" { /* special symbol */
g_token->name = yytext;
return TK_SYMBOL;
}
/********* patterns for linkable words ******************/
-<St_Para>{ID}/"<"{HTMLKEYW}">" { /* this rule is to prevent opening html
- * tag to be recognized as a templated classes
- */
+<St_Para>{ID}/"<"{HTMLKEYW}">" { /* this rule is to prevent opening html
+ * tag to be recognized as a templated classes
+ */
g_token->name = yytext;
return TK_LNKWORD;
- }
+ }
<St_Para>{LNKWORD1}/"<br>" | // prevent <br> html tag to be parsed as template arguments
<St_Para>{LNKWORD1} |
<St_Para>{LNKWORD1}{FUNCARG} |
@@ -727,34 +727,34 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_Para>{LNKWORD3} {
g_token->name = yytext;
return TK_LNKWORD;
- }
+ }
<St_Para>{LNKWORD1}{FUNCARG}{CVSPEC}[^a-z_A-Z0-9] {
g_token->name = yytext;
g_token->name = g_token->name.left(g_token->name.length()-1);
- unput(yytext[(int)yyleng-1]);
+ unput(yytext[(int)yyleng-1]);
return TK_LNKWORD;
}
/********* patterns for normal words ******************/
<St_Para,St_Text>[\-+0-9] |
<St_Para,St_Text>{WORD1} |
-<St_Para,St_Text>{WORD2} { /* function call */
+<St_Para,St_Text>{WORD2} { /* function call */
if (yytext[0]=='%') // strip % if present
- g_token->name = &yytext[1];
- else
+ g_token->name = &yytext[1];
+ else
g_token->name = yytext;
return TK_WORD;
- /* the following is dummy code to please the
- * compiler, removing this results in a warning
- * on my machine
- */
- goto find_rule;
+ /* the following is dummy code to please the
+ * compiler, removing this results in a warning
+ * on my machine
+ */
+ goto find_rule;
}
<St_Text>({ID}".")+{ID} {
g_token->name = yytext;
return TK_WORD;
- }
+ }
<St_Para,St_Text>"operator"/{BLANK}*"<"[a-zA-Z_0-9]+">" { // Special case: word "operator" followed by a HTML command
// avoid interpretation as "operator <"
g_token->name = yytext;
@@ -764,14 +764,14 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
/*******************************************************/
<St_Para,St_Text>{BLANK}+ |
-<St_Para,St_Text>{BLANK}*\n{BLANK}* { /* white space */
+<St_Para,St_Text>{BLANK}*\n{BLANK}* { /* white space */
g_token->chars=yytext;
return TK_WHITESPACE;
}
<St_Text>[\\@<>&$#%~] {
g_token->name = yytext;
return TK_COMMAND_SEL();
- }
+ }
<St_Para>({BLANK}*\n)+{BLANK}*\n/{LISTITEM} { /* skip trailing paragraph followed by new list item */
if (g_insidePre || g_autoListLevel==0)
{
@@ -798,11 +798,11 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
{
unput(' ');
}
- // tell flex that after putting the last indent
+ // tell flex that after putting the last indent
// back we are at the beginning of the line
YY_CURRENT_BUFFER->yy_at_bol=1;
// start of a new paragraph
- return TK_NEWPARA;
+ return TK_NEWPARA;
}
<St_CodeOpt>{BLANK}*"{"(".")?{LABELID}"}" {
g_token->name = yytext;
@@ -825,8 +825,8 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_Code,St_XmlCode>[^\\@\n<]+ |
<St_Code,St_XmlCode>\n |
<St_Code,St_XmlCode>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_HtmlOnlyOption>" [block]" { // the space is added in commentscan.l
g_token->name="block";
BEGIN(St_HtmlOnly);
@@ -845,77 +845,77 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_HtmlOnly>[^\\@\n$]+ |
<St_HtmlOnly>\n |
<St_HtmlOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_ManOnly>{CMD}"endmanonly" {
return RetVal_OK;
}
<St_ManOnly>[^\\@\n$]+ |
<St_ManOnly>\n |
<St_ManOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_RtfOnly>{CMD}"endrtfonly" {
return RetVal_OK;
}
<St_RtfOnly>[^\\@\n$]+ |
<St_RtfOnly>\n |
<St_RtfOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_LatexOnly>{CMD}"endlatexonly" {
return RetVal_OK;
}
<St_LatexOnly>[^\\@\n]+ |
<St_LatexOnly>\n |
<St_LatexOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_XmlOnly>{CMD}"endxmlonly" {
return RetVal_OK;
}
<St_XmlOnly>[^\\@\n]+ |
<St_XmlOnly>\n |
<St_XmlOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_DbOnly>{CMD}"enddocbookonly" {
return RetVal_OK;
}
<St_DbOnly>[^\\@\n]+ |
<St_DbOnly>\n |
<St_DbOnly>. {
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_Verbatim>{CMD}"endverbatim" {
- g_token->verb=stripEmptyLines(g_token->verb);
+ g_token->verb=stripEmptyLines(g_token->verb);
return RetVal_OK;
}
<St_Verbatim>[^\\@\n]+ |
<St_Verbatim>\n |
<St_Verbatim>. { /* Verbatim text */
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_Dot>{CMD}"enddot" {
return RetVal_OK;
}
<St_Dot>[^\\@\n]+ |
<St_Dot>\n |
<St_Dot>. { /* dot text */
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_Msc>{CMD}("endmsc") {
return RetVal_OK;
}
<St_Msc>[^\\@\n]+ |
<St_Msc>\n |
<St_Msc>. { /* msc text */
- g_token->verb+=yytext;
- }
+ g_token->verb+=yytext;
+ }
<St_PlantUMLOpt>{BLANK}*"{"[^}]*"}" { // case 1: file name is specified as {filename}
g_token->sectionId = QCString(yytext).stripWhiteSpace();
// skip curly brackets around the optional image name
- g_token->sectionId = g_token->sectionId.mid(1,g_token->sectionId.length()-2).stripWhiteSpace();
+ g_token->sectionId = g_token->sectionId.mid(1,g_token->sectionId.length()-2).stripWhiteSpace();
return RetVal_OK;
}
<St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}+/{ID}"=" { // case 2: plain file name specified followed by an attribute
@@ -947,117 +947,121 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_PlantUML>[^\\@\n]+ |
<St_PlantUML>\n |
<St_PlantUML>. { /* plantuml text */
- g_token->verb+=yytext;
- }
-<St_Title>"\"" { // quoted title
- BEGIN(St_TitleQ);
- }
+ g_token->verb+=yytext;
+ }
+<St_Title>"\"" { // quoted title
+ BEGIN(St_TitleQ);
+ }
<St_Title>[ \t]+ {
g_token->chars=yytext;
- return TK_WHITESPACE;
+ return TK_WHITESPACE;
}
-<St_Title>. { // non-quoted title
- unput(*yytext);
- BEGIN(St_TitleN);
+<St_Title>. { // non-quoted title
+ unput(*yytext);
+ BEGIN(St_TitleN);
}
-<St_Title>\n {
+<St_Title>\n {
unput(*yytext);
- return 0;
- }
+ return 0;
+ }
<St_Title>"\\ilinebr" {
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
+ return 0;
}
<St_TitleN>"&"{ID}";" { /* symbol */
g_token->name = yytext;
- return TK_SYMBOL;
+ return TK_SYMBOL;
}
<St_TitleN>{HTMLTAG} {
- }
-<St_TitleN>(\n|"\\ilinebr") { /* new line => end of title */
+ }
+<St_TitleN>\n { /* new line => end of title */
+ unput(*yytext);
+ return 0;
+ }
+<St_TitleN>"\\ilinebr" { /* new line => end of title */
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
+ return 0;
}
-<St_TitleN>{SPCMD1} |
-<St_TitleN>{SPCMD2} { /* special command */
+<St_TitleN>{SPCMD1} |
+<St_TitleN>{SPCMD2} { /* special command */
g_token->name = yytext+1;
- g_token->paramDir=TokenInfo::Unspecified;
+ g_token->paramDir=TokenInfo::Unspecified;
return TK_COMMAND_SEL();
}
<St_TitleN>{ID}"=" { /* attribute */
if (yytext[0]=='%') // strip % if present
- g_token->name = &yytext[1];
- else
+ g_token->name = &yytext[1];
+ else
g_token->name = yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_TitleN>[\-+0-9] |
<St_TitleN>{WORD1} |
<St_TitleN>{WORD2} { /* word */
if (yytext[0]=='%') // strip % if present
- g_token->name = &yytext[1];
- else
+ g_token->name = &yytext[1];
+ else
g_token->name = yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_TitleN>[ \t]+ {
g_token->chars=yytext;
- return TK_WHITESPACE;
+ return TK_WHITESPACE;
}
<St_TitleQ>"&"{ID}";" { /* symbol */
g_token->name = yytext;
- return TK_SYMBOL;
+ return TK_SYMBOL;
}
<St_TitleQ>(\n|"\\ilinebr") { /* new line => end of title */
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
+ return 0;
}
-<St_TitleQ>{SPCMD1} |
-<St_TitleQ>{SPCMD2} { /* special command */
+<St_TitleQ>{SPCMD1} |
+<St_TitleQ>{SPCMD2} { /* special command */
g_token->name = yytext+1;
- g_token->paramDir=TokenInfo::Unspecified;
+ g_token->paramDir=TokenInfo::Unspecified;
return TK_COMMAND_SEL();
}
<St_TitleQ>{WORD1NQ} |
<St_TitleQ>{WORD2NQ} { /* word */
g_token->name = yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_TitleQ>[ \t]+ {
g_token->chars=yytext;
- return TK_WHITESPACE;
+ return TK_WHITESPACE;
}
-<St_TitleQ>"\"" { /* closing quote => end of title */
- BEGIN(St_TitleA);
- return 0;
+<St_TitleQ>"\"" { /* closing quote => end of title */
+ BEGIN(St_TitleA);
+ return 0;
}
<St_TitleA>{BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute
- g_token->name = yytext;
- g_token->name = g_token->name.left(g_token->name.find('=')).stripWhiteSpace();
- BEGIN(St_TitleV);
- }
+ g_token->name = yytext;
+ g_token->name = g_token->name.left(g_token->name.find('=')).stripWhiteSpace();
+ BEGIN(St_TitleV);
+ }
<St_TitleV>[^ \t\r\n]+ { // attribute value
- g_token->chars = yytext;
- BEGIN(St_TitleN);
- return TK_WORD;
- }
+ g_token->chars = yytext;
+ BEGIN(St_TitleN);
+ return TK_WORD;
+ }
<St_TitleV,St_TitleA>. {
- unput(*yytext);
- return 0;
+ unput(*yytext);
+ return 0;
}
<St_TitleV,St_TitleA>(\n|"\\ilinebr") {
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
+ return 0;
}
<St_Anchor>{LABELID}{WS}? { // anchor
- g_token->name = QCString(yytext).stripWhiteSpace();
- return TK_WORD;
- }
-<St_Anchor>. {
- unput(*yytext);
- return 0;
- }
+ g_token->name = QCString(yytext).stripWhiteSpace();
+ return TK_WORD;
+ }
+<St_Anchor>. {
+ unput(*yytext);
+ return 0;
+ }
<St_Cite>{CITEID} { // label to cite
if (yytext[0] =='"')
{
@@ -1068,59 +1072,59 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
{
g_token->name=yytext;
}
- return TK_WORD;
- }
+ return TK_WORD;
+ }
<St_Cite>{BLANK} { // white space
- unput(' ');
- return 0;
+ unput(' ');
+ return 0;
}
<St_Cite>(\n|"\\ilinebr") { // new line
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
- }
-<St_Cite>. { // any other character
+ return 0;
+ }
+<St_Cite>. { // any other character
unput(*yytext);
- return 0;
- }
+ return 0;
+ }
<St_Ref>{REFWORD_NOCV}/{BLANK}("const")[a-z_A-Z0-9] { // see bug776988
- g_token->name=yytext;
- return TK_WORD;
+ g_token->name=yytext;
+ return TK_WORD;
}
<St_Ref>{REFWORD_NOCV}/{BLANK}("volatile")[a-z_A-Z0-9] { // see bug776988
- g_token->name=yytext;
- return TK_WORD;
+ g_token->name=yytext;
+ return TK_WORD;
}
<St_Ref>{REFWORD} { // label to refer to
- g_token->name=yytext;
- return TK_WORD;
- }
+ g_token->name=yytext;
+ return TK_WORD;
+ }
<St_Ref>{BLANK} { // white space
- unput(' ');
- return 0;
+ unput(' ');
+ return 0;
}
<St_Ref>{WS}+"\""{WS}* { // white space following by quoted string
- BEGIN(St_Ref2);
+ BEGIN(St_Ref2);
}
<St_Ref>(\n|"\\ilinebr") { // new line
for (int i=yyleng-1;i>=0;i--) unput(yytext[i]);
- return 0;
- }
-<St_Ref>. { // any other character
+ return 0;
+ }
+<St_Ref>. { // any other character
unput(*yytext);
- return 0;
- }
+ return 0;
+ }
<St_IntRef>[A-Z_a-z0-9.:/#\-\+\(\)]+ {
g_token->name = yytext;
- return TK_WORD;
- }
+ return TK_WORD;
+ }
<St_IntRef>{BLANK}+"\"" {
BEGIN(St_Ref2);
}
<St_SetScope>({SCOPEMASK}|{ANONNS}){BLANK}|{FILEMASK} {
g_token->name = yytext;
g_token->name = g_token->name.stripWhiteSpace();
- return TK_WORD;
- }
+ return TK_WORD;
+ }
<St_SetScope>{SCOPEMASK}"<" {
g_token->name = yytext;
g_token->name = g_token->name.stripWhiteSpace();
@@ -1146,26 +1150,26 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
}
<St_Ref2>"&"{ID}";" { /* symbol */
g_token->name = yytext;
- return TK_SYMBOL;
+ return TK_SYMBOL;
}
<St_Ref2>"\""|\n|"\\ilinebr" { /* " or \n => end of title */
- return 0;
+ return 0;
}
-<St_Ref2>{SPCMD1} |
-<St_Ref2>{SPCMD2} { /* special command */
+<St_Ref2>{SPCMD1} |
+<St_Ref2>{SPCMD2} { /* special command */
g_token->name = yytext+1;
- g_token->paramDir=TokenInfo::Unspecified;
+ g_token->paramDir=TokenInfo::Unspecified;
return TK_COMMAND_SEL();
}
<St_Ref2>{WORD1NQ} |
<St_Ref2>{WORD2NQ} {
/* word */
g_token->name = yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_Ref2>[ \t]+ {
g_token->chars=yytext;
- return TK_WHITESPACE;
+ return TK_WHITESPACE;
}
<St_XRefItem>{LABELID} {
g_token->name=yytext;
@@ -1174,39 +1178,39 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
BEGIN(St_XRefItem2);
}
<St_XRefItem2>[0-9]+"." {
- QCString numStr=yytext;
- numStr=numStr.left((int)yyleng-1);
- g_token->id=numStr.toInt();
- return RetVal_OK;
- }
+ QCString numStr=yytext;
+ numStr=numStr.left((int)yyleng-1);
+ g_token->id=numStr.toInt();
+ return RetVal_OK;
+ }
<St_Para,St_Title,St_Ref2>"<!--" { /* html style comment block */
g_commentState = YY_START;
- BEGIN(St_Comment);
+ BEGIN(St_Comment);
}
<St_Param>"\""[^\n\"]+"\"" {
- g_token->name = yytext+1;
- g_token->name = g_token->name.left((int)yyleng-2);
- return TK_WORD;
+ g_token->name = yytext+1;
+ g_token->name = g_token->name.left((int)yyleng-2);
+ return TK_WORD;
}
<St_Param>({PHPTYPE}{BLANK}*("["{BLANK}*"]")*{BLANK}*"|"{BLANK}*)*{PHPTYPE}{BLANK}*("["{BLANK}*"]")*{WS}+("&")?"$"{LABELID} {
- QCString params = yytext;
- int j = params.find('&');
- int i = params.find('$');
- if (j<i && j!=-1) i=j;
- QCString types = params.left(i).stripWhiteSpace();
- g_token->name = types+"#"+params.mid(i);
- return TK_WORD;
- }
+ QCString params = yytext;
+ int j = params.find('&');
+ int i = params.find('$');
+ if (j<i && j!=-1) i=j;
+ QCString types = params.left(i).stripWhiteSpace();
+ g_token->name = types+"#"+params.mid(i);
+ return TK_WORD;
+ }
<St_Param>[^ \t\n,@\\]+ {
- g_token->name = yytext;
+ g_token->name = yytext;
if (g_token->name.at(static_cast<uint>(yyleng)-1)==':')
{
g_token->name=g_token->name.left(static_cast<uint>(yyleng)-1);
}
- return TK_WORD;
+ return TK_WORD;
}
<St_Param>{WS}*","{WS}* /* param separator */
-<St_Param>{WS} {
+<St_Param>{WS} {
g_token->chars=yytext;
return TK_WHITESPACE;
}
@@ -1234,25 +1238,34 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
return 0;
}
<St_File>{FILEMASK} {
- g_token->name = yytext;
- return TK_WORD;
- }
-<St_File>"\""[^\n\"]+"\"" {
- QCString text=yytext;
- g_token->name = text.mid(1,text.length()-2);
- return TK_WORD;
- }
-<St_Pattern>[^\r\n]+ {
g_token->name = yytext;
+ return TK_WORD;
+ }
+<St_File>"\""[^\n\"]+"\"" {
+ QCString text=yytext;
+ g_token->name = text.mid(1,text.length()-2);
+ return TK_WORD;
+ }
+<St_Pattern>[^\\\r\n]+ {
+ g_token->name += yytext;
+ }
+<St_Pattern>"\\ilinebr" {
g_token->name = g_token->name.stripWhiteSpace();
- return TK_WORD;
- }
+ return TK_WORD;
+ }
+<St_Pattern>\n {
+ g_token->name = g_token->name.stripWhiteSpace();
+ return TK_WORD;
+ }
+<St_Pattern>. {
+ g_token->name += yytext;
+ }
<St_Link>{LINKMASK}|{REFWORD} {
g_token->name = yytext;
- return TK_WORD;
+ return TK_WORD;
}
<St_Comment>"-->" { /* end of html comment */
- BEGIN(g_commentState);
+ BEGIN(g_commentState);
}
<St_Comment>[^-]+ /* inside html comment */
<St_Comment>. /* inside html comment */
@@ -1262,7 +1275,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
<St_SkipTitle>.
<St_SkipTitle>(\n|"\\ilinebr") { return 0; }
- /* State for the pass used to find the anchors and sections */
+ /* State for the pass used to find the anchors and sections */
<St_Sections>[^\n@\\<]+
<St_Sections>{CMD}("<"|{CMD})
@@ -1284,142 +1297,142 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
}
}
}
-<St_Sections>{CMD}"anchor"{BLANK}+ {
- g_secType = SectionType::Anchor;
- BEGIN(St_SecLabel1);
+<St_Sections>{CMD}"anchor"{BLANK}+ {
+ g_secType = SectionType::Anchor;
+ BEGIN(St_SecLabel1);
}
-<St_Sections>{CMD}"section"{BLANK}+ {
- g_secType = SectionType::Section;
- BEGIN(St_SecLabel2);
+<St_Sections>{CMD}"section"{BLANK}+ {
+ g_secType = SectionType::Section;
+ BEGIN(St_SecLabel2);
}
-<St_Sections>{CMD}"subsection"{BLANK}+ {
- g_secType = SectionType::Subsection;
- BEGIN(St_SecLabel2);
+<St_Sections>{CMD}"subsection"{BLANK}+ {
+ g_secType = SectionType::Subsection;
+ BEGIN(St_SecLabel2);
}
-<St_Sections>{CMD}"subsubsection"{BLANK}+ {
- g_secType = SectionType::Subsubsection;
- BEGIN(St_SecLabel2);
+<St_Sections>{CMD}"subsubsection"{BLANK}+ {
+ g_secType = SectionType::Subsubsection;
+ BEGIN(St_SecLabel2);
}
-<St_Sections>{CMD}"paragraph"{BLANK}+ {
- g_secType = SectionType::Paragraph;
- BEGIN(St_SecLabel2);
+<St_Sections>{CMD}"paragraph"{BLANK}+ {
+ g_secType = SectionType::Paragraph;
+ BEGIN(St_SecLabel2);
}
<St_Sections>{CMD}"verbatim"/[^a-z_A-Z0-9] {
g_endMarker="endverbatim";
- BEGIN(St_SecSkip);
- }
+ BEGIN(St_SecSkip);
+ }
<St_Sections>{CMD}"dot"/[^a-z_A-Z0-9] {
g_endMarker="enddot";
- BEGIN(St_SecSkip);
- }
+ BEGIN(St_SecSkip);
+ }
<St_Sections>{CMD}"msc"/[^a-z_A-Z0-9] {
g_endMarker="endmsc";
- BEGIN(St_SecSkip);
- }
+ BEGIN(St_SecSkip);
+ }
<St_Sections>{CMD}"startuml"/[^a-z_A-Z0-9] {
g_endMarker="enduml";
- BEGIN(St_SecSkip);
- }
+ BEGIN(St_SecSkip);
+ }
<St_Sections>{CMD}"htmlonly"/[^a-z_A-Z0-9] {
g_endMarker="endhtmlonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"latexonly"/[^a-z_A-Z0-9] {
g_endMarker="endlatexonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"manonly"/[^a-z_A-Z0-9] {
g_endMarker="endmanonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"rtfonly"/[^a-z_A-Z0-9] {
g_endMarker="endrtfonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"xmlonly"/[^a-z_A-Z0-9] {
g_endMarker="endxmlonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"docbookonly"/[^a-z_A-Z0-9] {
g_endMarker="enddocbookonly";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
<St_Sections>{CMD}"code"/[^a-z_A-Z0-9] {
g_endMarker="endcode";
- BEGIN(St_SecSkip);
- }
+ BEGIN(St_SecSkip);
+ }
<St_Sections>"<!--" {
g_endMarker="-->";
- BEGIN(St_SecSkip);
+ BEGIN(St_SecSkip);
}
-<St_SecSkip>{CMD}{ID} {
+<St_SecSkip>{CMD}{ID} {
if (qstrcmp(yytext+1,g_endMarker)==0)
- {
- BEGIN(St_Sections);
- }
+ {
+ BEGIN(St_Sections);
+ }
}
-<St_SecSkip>"-->" {
+<St_SecSkip>"-->" {
if (qstrcmp(yytext,g_endMarker)==0)
- {
- BEGIN(St_Sections);
- }
+ {
+ BEGIN(St_Sections);
+ }
}
<St_SecSkip>[^a-z_A-Z0-9\-\\\@]+
<St_SecSkip>.
<St_SecSkip>(\n|"\\ilinebr")
<St_Sections>.
<St_Sections>(\n|"\\ilinebr")
-<St_SecLabel1>{LABELID} {
+<St_SecLabel1>{LABELID} {
g_secLabel = yytext;
processSection();
BEGIN(St_Sections);
}
-<St_SecLabel2>{LABELID}{BLANK}+ |
-<St_SecLabel2>{LABELID} {
+<St_SecLabel2>{LABELID}{BLANK}+ |
+<St_SecLabel2>{LABELID} {
g_secLabel = yytext;
- g_secLabel = g_secLabel.stripWhiteSpace();
+ g_secLabel = g_secLabel.stripWhiteSpace();
BEGIN(St_SecTitle);
}
<St_SecTitle>[^\n]+ |
<St_SecTitle>[^\n]*\n {
g_secTitle = yytext;
- g_secTitle = g_secTitle.stripWhiteSpace();
+ g_secTitle = g_secTitle.stripWhiteSpace();
if (g_secTitle.right(8)=="\\ilinebr")
{
g_secTitle.left(g_secTitle.length()-8);
}
processSection();
BEGIN(St_Sections);
- }
+ }
<St_SecTitle,St_SecLabel1,St_SecLabel2>. {
- warn(g_fileName,yylineno,"Unexpected character '%s' while looking for section label or title",yytext);
+ warn(g_fileName,yylineno,"Unexpected character '%s' while looking for section label or title",yytext);
}
<St_Snippet>[^\\\n]+ {
- g_token->name += yytext;
+ g_token->name += yytext;
}
<St_Snippet>"\\" {
- g_token->name += yytext;
+ g_token->name += yytext;
}
<St_Snippet>(\n|"\\ilinebr") {
- g_token->name = g_token->name.stripWhiteSpace();
- return TK_WORD;
- }
-
- /* Generic rules that work for all states */
-<*>\n {
- warn(g_fileName,yylineno,"Unexpected new line character");
- }
+ g_token->name = g_token->name.stripWhiteSpace();
+ return TK_WORD;
+ }
+
+ /* Generic rules that work for all states */
+<*>\n {
+ warn(g_fileName,yylineno,"Unexpected new line character");
+ }
<*>"\\ilinebr" {
}
<*>[\\@<>&$#%~"=] { /* unescaped special character */
- //warn(g_fileName,yylineno,"Unexpected character '%s', assuming command \\%s was meant.",yytext,yytext);
- g_token->name = yytext;
- return TK_COMMAND_SEL();
+ //warn(g_fileName,yylineno,"Unexpected character '%s', assuming command \\%s was meant.",yytext,yytext);
+ g_token->name = yytext;
+ return TK_COMMAND_SEL();
}
-<*>. {
+<*>. {
warn(g_fileName,yylineno,"Unexpected character '%s'",yytext);
- }
+ }
%%
//--------------------------------------------------------------------------
@@ -1565,6 +1578,7 @@ void doctokenizerYYsetStateFile()
void doctokenizerYYsetStatePattern()
{
+ g_token->name = "";
BEGIN(St_Pattern);
}
diff --git a/src/docvisitor.cpp b/src/docvisitor.cpp
new file mode 100644
index 0000000..17aefc2
--- /dev/null
+++ b/src/docvisitor.cpp
@@ -0,0 +1,58 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ */
+
+
+#include <unordered_map>
+
+#include "parserintf.h"
+#include "docvisitor.h"
+#include "util.h"
+#include "types.h"
+#include "doxygen.h"
+
+struct DocVisitor::Private
+{
+ int id;
+ std::unordered_map< std::string, std::unique_ptr<CodeParserInterface> > parserFactoryMap;
+};
+
+DocVisitor::DocVisitor(int id) : m_p(std::make_unique<Private>())
+{
+ m_p->id = id;
+}
+
+DocVisitor::~DocVisitor()
+{
+}
+
+CodeParserInterface &DocVisitor::getCodeParser(const char *extension)
+{
+ std::string ext(extension?extension:"");
+ // for each extension we create a code parser once per visitor, so that
+ // the context of the same parser object is reused thoughout multiple passes for instance
+ // for code fragments shown via dontinclude.
+ auto it = m_p->parserFactoryMap.find(ext);
+ if (it==m_p->parserFactoryMap.end())
+ {
+ auto factory = Doxygen::parserManager->getCodeParserFactory(extension);
+ auto result = m_p->parserFactoryMap.insert(std::make_pair(ext,factory()));
+ it = result.first;
+ }
+ return *it->second.get();
+}
+
+int DocVisitor::id() const
+{
+ return m_p->id;
+}
diff --git a/src/docvisitor.h b/src/docvisitor.h
index 0a53595..4d4b263 100644
--- a/src/docvisitor.h
+++ b/src/docvisitor.h
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -19,6 +16,8 @@
#ifndef _DOCVISITOR_H
#define _DOCVISITOR_H
+#include <memory>
+
// ids
const int DocVisitor_Html = 0;
const int DocVisitor_Latex = 1;
@@ -84,18 +83,21 @@ class DocSimpleSectSep;
class DocHtmlBlockQuote;
class DocVhdlFlow;
class DocParBlock;
+class CodeParserInterface;
/*! @brief Abstract visitor that participates in the visitor pattern.
*/
class DocVisitor
{
- int m_id;
+ struct Private;
+ std::unique_ptr<Private> m_p;
public:
- DocVisitor(int id) : m_id(id) {}
- virtual ~DocVisitor() {}
- int id() const { return m_id; }
+ DocVisitor(int id);
+ virtual ~DocVisitor();
+ int id() const;
+ CodeParserInterface &getCodeParser(const char *langExt);
- /*! @name Visitor functions for leaf nodes
+ /*! @name Visitor functions for leaf nodes
* @{
*/
virtual void visit(DocWord *) = 0;
@@ -117,7 +119,7 @@ class DocVisitor
virtual void visit(DocCite *) = 0;
/*! @} */
- /*! @name Visitor functions for internal nodes
+ /*! @name Visitor functions for internal nodes
* @{
*/
virtual void visitPre(DocAutoList *) = 0;
@@ -167,7 +169,7 @@ class DocVisitor
virtual void visitPre(DocDotFile *) = 0;
virtual void visitPost(DocDotFile *) = 0;
virtual void visitPre(DocMscFile *) = 0;
- virtual void visitPost(DocMscFile *) = 0;
+ virtual void visitPost(DocMscFile *) = 0;
virtual void visitPre(DocDiaFile *) = 0;
virtual void visitPost(DocDiaFile *) = 0;
virtual void visitPre(DocLink *) = 0;
diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp
index 17f8cb7..285c0bb 100644
--- a/src/dotfilepatcher.cpp
+++ b/src/dotfilepatcher.cpp
@@ -174,6 +174,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath,
if (!ref.isEmpty())
{
result = externalLinkTarget(true);
+ if (!result.isEmpty())targetAlreadySet=true;
}
result+= href+"=\"";
result+=externalRef(relPath,ref,TRUE);
@@ -460,7 +461,7 @@ bool DotFilePatcher::run() const
convertMapFile(tt,map->mapFile,map->relPath,map->urlOnly,map->context);
if (!result.isEmpty())
{
- t << "<map name=\"" << map->label << "\" id=\"" << correctId(map->label) << "\">" << endl;
+ t << "<map name=\"" << correctId(map->label) << "\" id=\"" << correctId(map->label) << "\">" << endl;
t << result;
t << "</map>" << endl;
}
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index d551292..d442857 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -32,6 +32,7 @@
#include <algorithm>
#include <unordered_map>
#include <memory>
+#include <cinttypes>
#include "version.h"
#include "doxygen.h"
@@ -145,7 +146,7 @@ QDict<DefinitionIntf> *Doxygen::symbolMap = 0;
QDict<Definition> *Doxygen::clangUsrMap = 0;
bool Doxygen::outputToWizard=FALSE;
QDict<int> * Doxygen::htmlDirMap = 0;
-QCache<LookupInfo> *Doxygen::lookupCache;
+Cache<std::string,LookupInfo> *Doxygen::lookupCache;
DirSDict *Doxygen::directories;
SDict<DirRelation> Doxygen::dirRelations(257);
ParserManager *Doxygen::parserManager = 0;
@@ -164,7 +165,7 @@ DefinesPerFileList Doxygen::macroDefinitions;
bool Doxygen::clangAssistedParsing = FALSE;
// locally accessible globals
-static std::unordered_map< std::string, const Entry* > g_classEntries;
+static std::map< std::string, const Entry* > g_classEntries;
static StringVector g_inputFiles;
static QDict<void> g_compoundKeywordDict(7); // keywords recognised as compounds
static OutputList *g_outputList = 0; // list of output generating objects
@@ -7513,8 +7514,9 @@ static void generateFileSources()
{
msg("Generating code for file %s...\n",fd->docName().data());
clangParser->parse();
- fd->writeSource(*g_outputList,clangParser.get());
-
+ fd->writeSourceHeader(*g_outputList);
+ fd->writeSourceBody(*g_outputList,clangParser.get());
+ fd->writeSourceFooter(*g_outputList);
}
else if (!fd->isReference() && Doxygen::parseSourcesNeeded)
// we needed to parse the sources even if we do not show them
@@ -7538,7 +7540,9 @@ static void generateFileSources()
if (ifd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output
{
msg(" Generating code for file %s...\n",ifd->docName().data());
- ifd->writeSource(*g_outputList,clangParser.get());
+ ifd->writeSourceHeader(*g_outputList);
+ ifd->writeSourceBody(*g_outputList,clangParser.get());
+ ifd->writeSourceFooter(*g_outputList);
}
else if (!ifd->isReference() && Doxygen::parseSourcesNeeded)
// we needed to parse the sources even if we do not show them
@@ -7566,15 +7570,18 @@ static void generateFileSources()
{
msg("Generating code for file %s...\n",fd->docName().data());
clangParser->parse();
- fd->writeSource(*g_outputList,clangParser.get());
-
+ fd->writeSourceHeader(*g_outputList);
+ fd->writeSourceBody(*g_outputList,clangParser.get());
+ fd->writeSourceFooter(*g_outputList);
}
else if (!fd->isReference() && Doxygen::parseSourcesNeeded)
// we needed to parse the sources even if we do not show them
{
msg("Parsing code for file %s...\n",fd->docName().data());
clangParser->parse();
- fd->parseSource(clangParser.get());
+ fd->writeSourceHeader(*g_outputList);
+ fd->writeSourceBody(*g_outputList,clangParser.get());
+ fd->writeSourceFooter(*g_outputList);
}
}
}
@@ -7583,6 +7590,66 @@ static void generateFileSources()
else
#endif
{
+#define MULTITHREADED_SOURCE_GENERATOR 0 // not ready to be enabled yet
+#if MULTITHREADED_SOURCE_GENERATOR
+ std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS));
+ if (numThreads==0)
+ {
+ numThreads = std::thread::hardware_concurrency();
+ }
+ msg("Generating code files using %zu threads.\n",numThreads);
+ struct SourceContext
+ {
+ SourceContext(FileDef *fd_,bool gen_,OutputList ol_)
+ : fd(fd_), generateSourceFile(gen_), ol(ol_) {}
+ FileDef *fd;
+ bool generateSourceFile;
+ OutputList ol;
+ };
+ ThreadPool threadPool(numThreads);
+ std::vector< std::future< std::shared_ptr<SourceContext> > > results;
+ for (const auto &fn : *Doxygen::inputNameLinkedMap)
+ {
+ for (const auto &fd : *fn)
+ {
+ bool generateSourceFile = fd->generateSourceFile() && !Htags::useHtags && !g_useOutputTemplate;
+ auto ctx = std::make_shared<SourceContext>(fd.get(),generateSourceFile,*g_outputList);
+ if (generateSourceFile)
+ {
+ msg("Generating code for file %s...\n",fd->docName().data());
+ fd->writeSourceHeader(ctx->ol);
+ }
+ else
+ {
+ msg("Parsing code for file %s...\n",fd->docName().data());
+ }
+ auto processFile = [ctx]() {
+ StringVector filesInSameTu;
+ ctx->fd->getAllIncludeFilesRecursively(filesInSameTu);
+ if (ctx->generateSourceFile) // sources need to be shown in the output
+ {
+ ctx->fd->writeSourceBody(ctx->ol,nullptr);
+ }
+ else if (!ctx->fd->isReference() && Doxygen::parseSourcesNeeded)
+ // we needed to parse the sources even if we do not show them
+ {
+ ctx->fd->parseSource(nullptr);
+ }
+ return ctx;
+ };
+ results.emplace_back(threadPool.queue(processFile));
+ }
+ }
+ for (auto &f : results)
+ {
+ std::shared_ptr<SourceContext> ctx = f.get();
+ if (ctx->generateSourceFile)
+ {
+ ctx->fd->writeSourceFooter(ctx->ol);
+ }
+ }
+
+#else // single threaded version
for (const auto &fn : *Doxygen::inputNameLinkedMap)
{
for (const auto &fd : *fn)
@@ -7592,7 +7659,9 @@ static void generateFileSources()
if (fd->generateSourceFile() && !Htags::useHtags && !g_useOutputTemplate) // sources need to be shown in the output
{
msg("Generating code for file %s...\n",fd->docName().data());
- fd->writeSource(*g_outputList,nullptr);
+ fd->writeSourceHeader(*g_outputList);
+ fd->writeSourceBody(*g_outputList,nullptr);
+ fd->writeSourceFooter(*g_outputList);
}
else if (!fd->isReference() && Doxygen::parseSourcesNeeded)
// we needed to parse the sources even if we do not show them
@@ -7602,6 +7671,7 @@ static void generateFileSources()
}
}
}
+#endif
}
}
}
@@ -8047,15 +8117,20 @@ static void flushCachedTemplateRelations()
// as there can be new template instances in the inheritance path
// to this class. Optimization: only remove those classes that
// have inheritance instances as direct or indirect sub classes.
- QCacheIterator<LookupInfo> ci(*Doxygen::lookupCache);
- LookupInfo *li=0;
- for (ci.toFirst();(li=ci.current());++ci)
+ StringVector elementsToRemove;
+ for (const auto &ci : *Doxygen::lookupCache)
{
- if (li->classDef)
+ const LookupInfo &li = ci.second;
+ if (li.classDef)
{
- Doxygen::lookupCache->remove(ci.currentKey());
+ elementsToRemove.push_back(ci.first);
}
}
+ for (const auto &k : elementsToRemove)
+ {
+ Doxygen::lookupCache->remove(k);
+ }
+
// remove all cached typedef resolutions whose target is a
// template class as this may now be a template instance
// for each global function name
@@ -8099,16 +8174,20 @@ static void flushUnresolvedRelations()
// class A { class I {} };
// class B : public A {};
// class C : public B::I {};
- //
- QCacheIterator<LookupInfo> ci(*Doxygen::lookupCache);
- LookupInfo *li=0;
- for (ci.toFirst();(li=ci.current());++ci)
+
+ StringVector elementsToRemove;
+ for (const auto &ci : *Doxygen::lookupCache)
{
- if (li->classDef==0 && li->typeDef==0)
+ const LookupInfo &li = ci.second;
+ if (li.classDef==0 && li.typeDef==0)
{
- Doxygen::lookupCache->remove(ci.currentKey());
+ elementsToRemove.push_back(ci.first);
}
}
+ for (const auto &k : elementsToRemove)
+ {
+ Doxygen::lookupCache->remove(k);
+ }
// for each global function name
for (const auto &fn : *Doxygen::functionNameLinkedMap)
@@ -8624,8 +8703,8 @@ static void generateExampleDocs()
for (pdi.toFirst();(pd=pdi.current());++pdi)
{
msg("Generating docs for example %s...\n",pd->name().data());
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(".c"); // TODO: do this on code type
- intf.resetCodeParserState();
+ auto intf = Doxygen::parserManager->getCodeParser(".c"); // TODO: do this on code type
+ intf->resetCodeParserState();
QCString n=pd->getOutputFileBase();
startFile(*g_outputList,n,n,pd->name());
startTitle(*g_outputList,n);
@@ -9473,7 +9552,7 @@ static int readDir(QFileInfo *fi,
{
if (errorIfNotExist)
{
- warn_uncond("source %s is not a readable file or directory... skipping.\n",cfi->absFilePath().data());
+ warn_uncond("source '%s' is not a readable file or directory... skipping.\n",cfi->absFilePath().data());
}
}
else if (cfi->isFile() &&
@@ -9553,7 +9632,7 @@ int readFileOrDirectory(const char *s,
{
if (errorIfNotExist)
{
- warn_uncond("source %s is not a readable file or directory... skipping.\n",s);
+ warn_uncond("source '%s' is not a readable file or directory... skipping.\n",s);
}
}
else if (!Config_getBool(EXCLUDE_SYMLINKS) || !fi.isSymLink())
@@ -9825,7 +9904,7 @@ class NullOutlineParser : public OutlineParserInterface
};
-template<class T> std::function< std::unique_ptr<T>() > make_output_parser_factory()
+template<class T> std::function< std::unique_ptr<T>() > make_parser_factory()
{
return []() { return std::make_unique<T>(); };
}
@@ -9842,26 +9921,26 @@ void initDoxygen()
Portable::correct_path();
Debug::startTimer();
- Doxygen::parserManager = new ParserManager( make_output_parser_factory<NullOutlineParser>(),
- std::make_unique<FileCodeParser>());
- Doxygen::parserManager->registerParser("c", make_output_parser_factory<COutlineParser>(),
- std::make_unique<CCodeParser>());
- Doxygen::parserManager->registerParser("python", make_output_parser_factory<PythonOutlineParser>(),
- std::make_unique<PythonCodeParser>());
- Doxygen::parserManager->registerParser("fortran", make_output_parser_factory<FortranOutlineParser>(),
- std::make_unique<FortranCodeParser>());
- Doxygen::parserManager->registerParser("fortranfree", make_output_parser_factory<FortranOutlineParserFree>(),
- std::make_unique<FortranCodeParserFree>());
- Doxygen::parserManager->registerParser("fortranfixed", make_output_parser_factory<FortranOutlineParserFixed>(),
- std::make_unique<FortranCodeParserFixed>());
- Doxygen::parserManager->registerParser("vhdl", make_output_parser_factory<VHDLOutlineParser>(),
- std::make_unique<VHDLCodeParser>());
- Doxygen::parserManager->registerParser("xml", make_output_parser_factory<NullOutlineParser>(),
- std::make_unique<XMLCodeParser>());
- Doxygen::parserManager->registerParser("sql", make_output_parser_factory<NullOutlineParser>(),
- std::make_unique<SQLCodeParser>());
- Doxygen::parserManager->registerParser("md", make_output_parser_factory<MarkdownOutlineParser>(),
- std::make_unique<FileCodeParser>());
+ Doxygen::parserManager = new ParserManager( make_parser_factory<NullOutlineParser>(),
+ make_parser_factory<FileCodeParser>());
+ Doxygen::parserManager->registerParser("c", make_parser_factory<COutlineParser>(),
+ make_parser_factory<CCodeParser>());
+ Doxygen::parserManager->registerParser("python", make_parser_factory<PythonOutlineParser>(),
+ make_parser_factory<PythonCodeParser>());
+ Doxygen::parserManager->registerParser("fortran", make_parser_factory<FortranOutlineParser>(),
+ make_parser_factory<FortranCodeParser>());
+ Doxygen::parserManager->registerParser("fortranfree", make_parser_factory<FortranOutlineParserFree>(),
+ make_parser_factory<FortranCodeParserFree>());
+ Doxygen::parserManager->registerParser("fortranfixed", make_parser_factory<FortranOutlineParserFixed>(),
+ make_parser_factory<FortranCodeParserFixed>());
+ Doxygen::parserManager->registerParser("vhdl", make_parser_factory<VHDLOutlineParser>(),
+ make_parser_factory<VHDLCodeParser>());
+ Doxygen::parserManager->registerParser("xml", make_parser_factory<NullOutlineParser>(),
+ make_parser_factory<XMLCodeParser>());
+ Doxygen::parserManager->registerParser("sql", make_parser_factory<NullOutlineParser>(),
+ make_parser_factory<SQLCodeParser>());
+ Doxygen::parserManager->registerParser("md", make_parser_factory<MarkdownOutlineParser>(),
+ make_parser_factory<FileCodeParser>());
// register any additional parsers here...
@@ -10037,15 +10116,15 @@ void readConfiguration(int argc, char **argv)
debugLabel=getArg(argc,argv,optind);
if (!debugLabel)
{
- err("option \"-d\" is missing debug specifier.\n");
devUsage();
cleanUpDoxygen();
- exit(1);
+ exit(0);
}
retVal = Debug::setFlag(debugLabel);
if (!retVal)
{
err("option \"-d\" has unknown debug specifier: \"%s\".\n",debugLabel);
+ devUsage();
cleanUpDoxygen();
exit(1);
}
@@ -10838,14 +10917,14 @@ void parseInput()
if (!dir.mkdir(outputDirectory))
{
err("tag OUTPUT_DIRECTORY: Output directory '%s' does not "
- "exist and cannot be created\n",outputDirectory.data());
+ "exist and cannot be created\n",outputDirectory.data());
cleanUpDoxygen();
exit(1);
}
else
{
- msg("Notice: Output directory '%s' does not exist. "
- "I have created it for you.\n", outputDirectory.data());
+ msg("Notice: Output directory '%s' does not exist. "
+ "I have created it for you.\n", outputDirectory.data());
}
dir.cd(outputDirectory);
}
@@ -10861,8 +10940,7 @@ void parseInput()
if (cacheSize<0) cacheSize=0;
if (cacheSize>9) cacheSize=9;
uint lookupSize = 65536 << cacheSize;
- Doxygen::lookupCache = new QCache<LookupInfo>(lookupSize,lookupSize);
- Doxygen::lookupCache->setAutoDelete(TRUE);
+ Doxygen::lookupCache = new Cache<std::string,LookupInfo>(lookupSize);
#ifdef HAS_SIGNALS
signal(SIGINT, stopDoxygen);
@@ -11691,9 +11769,9 @@ void generateOutput()
}
int cacheParam;
- msg("lookup cache used %d/%d hits=%d misses=%d\n",
- Doxygen::lookupCache->count(),
+ msg("lookup cache used %zu/%zu hits=%" PRIu64 " misses=%" PRIu64 "\n",
Doxygen::lookupCache->size(),
+ Doxygen::lookupCache->capacity(),
Doxygen::lookupCache->hits(),
Doxygen::lookupCache->misses());
cacheParam = computeIdealCacheParam(Doxygen::lookupCache->misses()*2/3); // part of the cache is flushed, hence the 2/3 correction factor
diff --git a/src/doxygen.h b/src/doxygen.h
index dc05750..f2b7dda 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -17,7 +17,6 @@
#define DOXYGEN_H
#include <qdatetime.h>
-#include <qcache.h>
#include <qstrlist.h>
#include <qdict.h>
#include <qintdict.h>
@@ -29,6 +28,7 @@
#include "dirdef.h"
#include "memberlist.h"
#include "define.h"
+#include "cache.h"
#define THREAD_LOCAL thread_local
#define AtomicInt std::atomic_int
@@ -78,11 +78,11 @@ class StringDict : public QDict<QCString>
struct LookupInfo
{
- LookupInfo() : classDef(0), typeDef(0) {}
+ LookupInfo() = default;
LookupInfo(const ClassDef *cd,const MemberDef *td,QCString ts,QCString rt)
: classDef(cd), typeDef(td), templSpec(ts),resolvedType(rt) {}
- const ClassDef *classDef;
- const MemberDef *typeDef;
+ const ClassDef *classDef = 0;
+ const MemberDef *typeDef = 0;
QCString templSpec;
QCString resolvedType;
};
@@ -127,7 +127,7 @@ class Doxygen
static QDict<Definition> *clangUsrMap;
static bool outputToWizard;
static QDict<int> *htmlDirMap;
- static QCache<LookupInfo> *lookupCache;
+ static Cache<std::string,LookupInfo> *lookupCache;
static DirSDict *directories;
static SDict<DirRelation> dirRelations;
static ParserManager *parserManager;
diff --git a/src/filedef.cpp b/src/filedef.cpp
index f07201d..6ab4e85 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -101,7 +101,9 @@ class FileDefImpl : public DefinitionImpl, public FileDef
virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const;
virtual void writeSummaryLinks(OutputList &ol) const;
virtual void writeTagFile(FTextStream &t);
- virtual void writeSource(OutputList &ol,ClangTUParser *clangParser);
+ virtual void writeSourceHeader(OutputList &ol);
+ virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser);
+ virtual void writeSourceFooter(OutputList &ol);
virtual void parseSource(ClangTUParser *clangParser);
virtual void setDiskName(const QCString &name);
virtual void insertMember(MemberDef *md);
@@ -208,6 +210,8 @@ class DevNullCodeDocInterface : public CodeOutputInterface
virtual void linkableSymbol(int, const char *,Definition *,Definition *) {}
virtual void setCurrentDoc(const Definition *,const char *,bool) {}
virtual void addWord(const char *,bool) {}
+ virtual void startCodeFragment(const char *) {}
+ virtual void endCodeFragment(const char *) {}
};
//---------------------------------------------------------------------------
@@ -311,6 +315,7 @@ void FileDefImpl::distributeMemberGroupDocumentation()
void FileDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
if (m_memberGroupSDict)
{
@@ -1149,14 +1154,12 @@ void FileDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *currentM
}
/*! Write a source listing of this file to the output */
-void FileDefImpl::writeSource(OutputList &ol,ClangTUParser *clangParser)
+void FileDefImpl::writeSourceHeader(OutputList &ol)
{
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
- bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE);
bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING);
bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE);
- DevNullCodeDocInterface devNullIntf;
QCString title = m_docname;
if (!m_fileVersion.isEmpty())
{
@@ -1206,22 +1209,27 @@ void FileDefImpl::writeSource(OutputList &ol,ClangTUParser *clangParser)
ol.endTextLink();
ol.popGeneratorState();
}
+}
+void FileDefImpl::writeSourceBody(OutputList &ol,ClangTUParser *clangParser)
+{
+ bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
+ DevNullCodeDocInterface devNullIntf;
#if USE_LIBCLANG
if (Doxygen::clangAssistedParsing && clangParser &&
(getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC))
{
- ol.startCodeFragment();
+ ol.startCodeFragment("DoxyCode");
clangParser->switchToFile(this);
clangParser->writeSources(ol,this);
- ol.endCodeFragment();
+ ol.endCodeFragment("DoxyCode");
}
else
#endif
{
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
- intf.resetCodeParserState();
- ol.startCodeFragment();
+ auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
+ intf->resetCodeParserState();
+ ol.startCodeFragment("DoxyCode");
bool needs2PassParsing =
Doxygen::parseSourcesNeeded && // we need to parse (filtered) sources for cross-references
!filterSourceFiles && // but user wants to show sources as-is
@@ -1230,13 +1238,13 @@ void FileDefImpl::writeSource(OutputList &ol,ClangTUParser *clangParser)
if (needs2PassParsing)
{
// parse code for cross-references only (see bug707641)
- intf.parseCode(devNullIntf,0,
+ intf->parseCode(devNullIntf,0,
fileToString(absFilePath(),TRUE,TRUE),
getLanguage(),
FALSE,0,this
);
}
- intf.parseCode(ol,0,
+ intf->parseCode(ol,0,
fileToString(absFilePath(),filterSourceFiles,TRUE),
getLanguage(), // lang
FALSE, // isExampleBlock
@@ -1250,8 +1258,12 @@ void FileDefImpl::writeSource(OutputList &ol,ClangTUParser *clangParser)
0, // searchCtx
!needs2PassParsing // collectXRefs
);
- ol.endCodeFragment();
+ ol.endCodeFragment("DoxyCode");
}
+}
+
+void FileDefImpl::writeSourceFooter(OutputList &ol)
+{
ol.endContents();
endFileWithNavPath(this,ol);
ol.enableAll();
@@ -1271,9 +1283,9 @@ void FileDefImpl::parseSource(ClangTUParser *clangParser)
else
#endif
{
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
- intf.resetCodeParserState();
- intf.parseCode(
+ auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
+ intf->resetCodeParserState();
+ intf->parseCode(
devNullIntf,0,
fileToString(absFilePath(),filterSourceFiles,TRUE),
getLanguage(),
diff --git a/src/filedef.h b/src/filedef.h
index e4bb549..2e11b97 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -150,7 +150,9 @@ class FileDef : virtual public Definition
virtual void writeSummaryLinks(OutputList &ol) const = 0;
virtual void writeTagFile(FTextStream &t) = 0;
- virtual void writeSource(OutputList &ol,ClangTUParser *clangParser) = 0;
+ virtual void writeSourceHeader(OutputList &ol) = 0;
+ virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0;
+ virtual void writeSourceFooter(OutputList &ol) = 0;
virtual void parseSource(ClangTUParser *clangParser) = 0;
virtual void setDiskName(const QCString &name) = 0;
diff --git a/src/fortrancode.h b/src/fortrancode.h
index 7da6a61..b8cac31 100644
--- a/src/fortrancode.h
+++ b/src/fortrancode.h
@@ -1,12 +1,12 @@
/******************************************************************************
*
- *
+ *
*
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -26,13 +26,11 @@ class MemberDef;
class QCString;
class Definition;
-void codeFreeScanner();
-
-
class FortranCodeParser : public CodeParserInterface
{
public:
- FortranCodeParser(FortranFormat format=FortranFormat_Unknown) : m_format(format) { }
+ FortranCodeParser(FortranFormat format=FortranFormat_Unknown);
+ virtual ~FortranCodeParser();
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
@@ -51,7 +49,8 @@ class FortranCodeParser : public CodeParserInterface
void resetCodeParserState();
private:
- FortranFormat m_format;
+ struct Private;
+ std::unique_ptr<Private> p;
};
class FortranCodeParserFree : public FortranCodeParser
diff --git a/src/fortrancode.l b/src/fortrancode.l
index 5d036e8..f2b0ee8 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -4,6 +4,7 @@
*
* Copyright (C) by Anke Visser
* based on the work of Dimitri van Heesch.
+ * Copyright (C) 2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -25,7 +26,9 @@
**/
%option never-interactive
%option case-insensitive
+%option reentrant
%option prefix="fortrancodeYY"
+%option extra-type="struct fortrancodeYY_state *"
%option noyy_top_state
%top{
#include <stdint.h>
@@ -34,7 +37,7 @@
%{
/*
- * includes
+ * includes
*/
#include <stdio.h>
#include <assert.h>
@@ -58,6 +61,7 @@
#include "namespacedef.h"
#include "tooltip.h"
#include "fortrancode.h"
+#include "fortranscanner.h"
#include "containers.h"
const int fixedCommentAfter = 72;
@@ -121,217 +125,892 @@ class Scope
/*===================================================================*/
/*
- * statics
+ * statics
*/
-static QCString docBlock; //!< contents of all lines of a documentation block
-static QCString currentModule=0; //!< name of the current enclosing module
-static QCString currentClass=0; //!< name of the current enclosing class
-static UseSDict *useMembers= new UseSDict; //!< info about used modules
-static UseEntry *useEntry = 0; //!< current use statement info
-static QList<Scope> scopeStack;
-static bool g_isExternal = false;
-// static QCStringList *currentUseNames= new QCStringList; //! contains names of used modules of current program unit
-static QCString g_str=""; //!> contents of fortran string
-
-static CodeOutputInterface * g_code;
-
-// TODO: is this still needed? if so, make it work
-static QCString g_parmType;
-static QCString g_parmName;
-
-static const char * g_inputString; //!< the code fragment as text
-static int g_inputPosition; //!< read offset during parsing
-static int g_inputLines; //!< number of line in the code fragment
-static int g_yyLineNr; //!< current line number
-static int g_contLineNr; //!< current, local, line number for continuation determination
-static int *g_hasContLine = NULL; //!< signals whether or not a line has a continuation line (fixed source form)
-static bool g_needsTermination;
-static const Definition *g_searchCtx;
-static bool g_collectXRefs;
-static bool g_isFixedForm;
-
-static bool g_insideBody; //!< inside subprog/program body? => create links
-static const char * g_currentFontClass;
-
-static bool g_exampleBlock;
-static QCString g_exampleName;
-static QCString g_exampleFile;
-
-static FileDef * g_sourceFileDef;
-static Definition * g_currentDefinition;
-static MemberDef * g_currentMemberDef;
-static bool g_includeCodeFragment;
-
-static char stringStartSymbol; // single or double quote
+struct fortrancodeYY_state
+{
+ QCString docBlock; //!< contents of all lines of a documentation block
+ QCString currentModule=0; //!< name of the current enclosing module
+ UseSDict * useMembers= 0; //!< info about used modules
+ UseEntry * useEntry = 0; //!< current use statement info
+ QList<Scope> scopeStack;
+ bool isExternal = false;
+ QCString str=""; //!> contents of fortran string
+
+ CodeOutputInterface * code = 0;
+
+ const char * inputString = 0; //!< the code fragment as text
+ int inputPosition = 0; //!< read offset during parsing
+ int inputLines = 0; //!< number of line in the code fragment
+ int yyLineNr = 0; //!< current line number
+ int contLineNr = 0; //!< current, local, line number for continuation determination
+ int *hasContLine = 0; //!< signals whether or not a line has a continuation line (fixed source form)
+ bool needsTermination = false;
+ const Definition *searchCtx = 0;
+ bool collectXRefs = false;
+ bool isFixedForm = false;
+
+ bool insideBody = false; //!< inside subprog/program body? => create links
+ const char * currentFontClass = 0;
+
+ bool exampleBlock = false;
+ QCString exampleName;
+ QCString exampleFile;
+
+ FileDef * sourceFileDef = 0;
+ Definition * currentDefinition = 0;
+ MemberDef * currentMemberDef = 0;
+ bool includeCodeFragment = false;
+
+ char stringStartSymbol = '\0'; // single or double quote
// count in variable declaration to filter out
// declared from referenced names
-static int bracketCount = 0;
+ int bracketCount = 0;
// signal when in type / class /procedure declaration
-static int inTypeDecl = 0;
+ int inTypeDecl = 0;
-static bool g_endComment;
+ bool endComment = false;
+};
#if USE_STATE2STRING
static const char *stateToString(int state);
#endif
-static void endFontClass()
+static bool getFortranNamespaceDefs(const QCString &mname,
+ NamespaceDef *&cd);
+static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName,
+ ClassDef *&cd, UseSDict *usedict=0);
+
+//----------------------------------------------------------------------------
+
+static void endFontClass(yyscan_t yyscanner);
+static void startFontClass(yyscan_t yyscanner,const char *s);
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor);
+static void addToSearchIndex(yyscan_t yyscanner,const char *text);
+static void startCodeLine(yyscan_t yyscanner);
+static void endCodeLine(yyscan_t yyscanner);
+static void nextCodeLine(yyscan_t yyscanner);
+static void codifyLines(yyscan_t yyscanner,const char *text);
+static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
+ Definition *d,const char *text);
+static bool getGenericProcedureLink(yyscan_t yyscanner,const ClassDef *cd,
+ const char *memberText,
+ CodeOutputInterface &ol);
+static bool getLink(yyscan_t yyscanner,UseSDict *usedict, // dictionary with used modules
+ const char *memberText, // exact member text
+ CodeOutputInterface &ol,
+ const char *text);
+static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, char *lname);
+static int countLines(yyscan_t yyscanner);
+static void startScope(yyscan_t yyscanner);
+static void endScope(yyscan_t yyscanner);
+static void addUse(yyscan_t yyscanner,const QCString &moduleName);
+static void addLocalVar(yyscan_t yyscanner,const QCString &varName);
+static MemberDef *getFortranDefs(yyscan_t yyscanner,const QCString &memberName, const QCString &moduleName,
+ UseSDict *usedict=0);
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
+
+
+/* -----------------------------------------------------------------*/
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+
+%}
+
+IDSYM [a-z_A-Z0-9]
+ID [a-z_A-Z]+{IDSYM}*
+SUBPROG (subroutine|function)
+B [ \t]
+BS [ \t]*
+BS_ [ \t]+
+COMMA {BS},{BS}
+ARGS_L0 ("("[^)]*")")
+ARGS_L1a [^()]*"("[^)]*")"[^)]*
+ARGS_L1 ("("{ARGS_L1a}*")")
+ARGS_L2 "("({ARGS_L0}|[^()]|{ARGS_L1a}|{ARGS_L1})*")"
+ARGS {BS}({ARGS_L0}|{ARGS_L1}|{ARGS_L2})
+
+NUM_TYPE (complex|integer|logical|real)
+LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.)
+KIND {ARGS}
+CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
+TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE|ENUMERATOR)
+
+INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
+ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|(NON_)?RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED|CONTIGUOUS|VOLATILE)
+ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC)
+/* Assume that attribute statements are almost the same as attributes. */
+ATTR_STMT {ATTR_SPEC}|DIMENSION
+FLOW (DO|SELECT|CASE|SELECT{BS}(CASE|TYPE)|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT|GO{BS}TO)
+COMMANDS (FORMAT|CONTAINS|MODULE{BS_}PROCEDURE|WRITE|READ|ALLOCATE|ALLOCATED|ASSOCIATED|PRESENT|DEALLOCATE|NULLIFY|SIZE|INQUIRE|OPEN|CLOSE|FLUSH|DATA|COMMON)
+IGNORE (CALL)
+PREFIX ((NON_)?RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,4}((NON_)?RECURSIVE|IMPURE|PURE|ELEMENTAL)?0
+LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")"
+
+/* | */
+
+%option noyywrap
+%option stack
+%option caseless
+/*%option debug*/
+
+%x Start
+%x SubCall
+%x FuncDef
+%x ClassName
+%x ClassVar
+%x Subprog
+%x DocBlock
+%x Use
+%x UseOnly
+%x Import
+%x Declaration
+%x DeclarationBinding
+%x DeclContLine
+%x Parameterlist
+%x String
+%x Subprogend
+
+%%
+ /*==================================================================*/
+
+ /*-------- ignore ------------------------------------------------------------*/
+
+<Start>{IGNORE}/{BS}"(" { // do not search keywords, intrinsics... TODO: complete list
+ codifyLines(yyscanner,yytext);
+ }
+ /*-------- inner construct ---------------------------------------------------*/
+
+<Start>{COMMANDS}/{BS}[,( \t\n] { // highlight
+ /* font class is defined e.g. in doxygen.css */
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>{FLOW}/{BS}[,( \t\n] {
+ if (yyextra->isFixedForm)
+ {
+ if ((yy_my_start == 1) && ((yytext[0] == 'c') || (yytext[0] == 'C'))) YY_FTN_REJECT;
+ }
+ if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
+ {
+ yyextra->currentMemberDef->incrementFlowKeyWordCount();
+ }
+ /* font class is defined e.g. in doxygen.css */
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>{BS}(CASE|CLASS|TYPE){BS_}(IS|DEFAULT) {
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>{BS}"end"({BS}{FLOW})/[ \t\n] { // list is a bit long as not all have possible end
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>"implicit"{BS}("none"|{TYPE_SPEC}) {
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>^{BS}"namelist"/[//] { // Namelist specification
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ /*-------- use statement -------------------------------------------*/
+<Start>"use"{BS_} {
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Use);
+ }
+<Use>"ONLY" { // TODO: rename
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(UseOnly);
+ }
+<Use>{ID} {
+ QCString tmp = yytext;
+ tmp = tmp.lower();
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+
+ /* append module name to use dict */
+ yyextra->useEntry = new UseEntry();
+ //yyextra->useEntry->module = yytext;
+ //yyextra->useMembers->append(yytext, yyextra->useEntry);
+ //addUse(yytext);
+ yyextra->useEntry->module = tmp;
+ yyextra->useMembers->append(tmp, yyextra->useEntry);
+ addUse(yyscanner,tmp);
+ }
+<Use,UseOnly,Import>{BS},{BS} { codifyLines(yyscanner,yytext); }
+<UseOnly,Import>{BS}&{BS}"\n" { codifyLines(yyscanner,yytext);
+ yyextra->contLineNr++;
+ YY_FTN_RESET}
+<UseOnly>{ID} {
+ QCString tmp = yytext;
+ tmp = tmp.lower();
+ yyextra->useEntry->onlyNames.append(tmp);
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+ }
+<Use,UseOnly,Import>"\n" {
+ unput(*yytext);
+ yy_pop_state(yyscanner);
+ YY_FTN_RESET
+ }
+<*>"import"{BS}/"\n" |
+<*>"import"{BS_} {
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Import);
+ }
+<Import>{ID} {
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+ }
+<Import>("ONLY"|"NONE"|"ALL") {
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ /*-------- fortran module -----------------------------------------*/
+<Start>("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { //
+ startScope(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(ClassName);
+ if (!qstricmp(yytext,"module")) yyextra->currentModule="module";
+ }
+<Start>("enum")/{BS_}|{BS}{COMMA}{BS}{LANGUAGE_BIND_SPEC}|\n { //
+ startScope(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(ClassName);
+ }
+<*>{LANGUAGE_BIND_SPEC} { //
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { //
+ startScope(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(ClassName);
+ }
+<ClassName>{ID} {
+ if (yyextra->currentModule == "module")
+ {
+ yyextra->currentModule=yytext;
+ yyextra->currentModule = yyextra->currentModule.lower();
+ }
+ generateLink(yyscanner,*yyextra->code,yytext);
+ yy_pop_state(yyscanner);
+ }
+<ClassName>({ACCESS_SPEC}|ABSTRACT|EXTENDS)/[,:( ] { //| variable declaration
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<ClassName>\n { // interface may be without name
+ yy_pop_state(yyscanner);
+ YY_FTN_REJECT;
+ }
+<Start>^{BS}"end"({BS_}"enum").* {
+ YY_FTN_REJECT;
+ }
+<Start>^{BS}"end"({BS_}"type").* {
+ YY_FTN_REJECT;
+ }
+<Start>^{BS}"end"({BS_}"module").* { // just reset yyextra->currentModule, rest is done in following rule
+ yyextra->currentModule=0;
+ YY_FTN_REJECT;
+ }
+ /*-------- subprog definition -------------------------------------*/
+<Start>({PREFIX}{BS_})?{TYPE_SPEC}{BS_}({PREFIX}{BS_})?{BS}/{SUBPROG}{BS_} { // TYPE_SPEC is for old function style function result
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Subprog);
+ }
+<Subprog>{ID} { // subroutine/function name
+ DBG_CTX((stderr, "===> start subprogram %s\n", yytext));
+ startScope(yyscanner);
+ generateLink(yyscanner,*yyextra->code,yytext);
+ }
+<Subprog>"result"/{BS}"("[^)]*")" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<Subprog>"("[^)]*")" { // ignore rest of line
+ codifyLines(yyscanner,yytext);
+ }
+<Subprog,Subprogend>"\n" { codifyLines(yyscanner,yytext);
+ yyextra->contLineNr++;
+ yy_pop_state(yyscanner);
+ YY_FTN_RESET
+ }
+<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface")?{BS} { // Fortran subroutine or function ends
+ //cout << "===> end function " << yytext << endl;
+ endScope(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Subprogend);
+ }
+<Subprogend>{ID}/{BS}(\n|!|;) {
+ generateLink(yyscanner,*yyextra->code,yytext);
+ yy_pop_state(yyscanner);
+ }
+<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface"){BS}/(\n|!|;) { // Fortran subroutine or function ends
+ //cout << "===> end function " << yytext << endl;
+ endScope(yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ /*-------- variable declaration ----------------------------------*/
+<Start>^{BS}"real"/[,:( ] { // real is a bit tricky as it is a data type but also a function.
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Declaration);
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Start>{TYPE_SPEC}/[,:( ] {
+ QCString typ = yytext;
+ typ = removeRedundantWhiteSpace(typ.lower());
+ if (typ.startsWith("real")) YY_FTN_REJECT;
+ if (typ == "type" || typ == "class" || typ == "procedure") yyextra->inTypeDecl = 1;
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Declaration);
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Start>{ATTR_SPEC} {
+ if (QCString(yytext) == "external")
+ {
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Declaration);
+ yyextra->isExternal = true;
+ }
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Declaration>({TYPE_SPEC}|{ATTR_SPEC})/[,:( ] { //| variable declaration
+ if (QCString(yytext) == "external") yyextra->isExternal = true;
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+<Declaration>{ID} { // local var
+ if (yyextra->isFixedForm && yy_my_start == 1)
+ {
+ startFontClass(yyscanner,"comment");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+ else if (yyextra->currentMemberDef &&
+ ((yyextra->currentMemberDef->isFunction() && (yyextra->currentMemberDef->typeString()!=QCString("subroutine") || yyextra->inTypeDecl)) ||
+ yyextra->currentMemberDef->isVariable() || yyextra->currentMemberDef->isEnumValue()
+ )
+ )
+ {
+ generateLink(yyscanner,*yyextra->code, yytext);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ addLocalVar(yyscanner,yytext);
+ }
+ }
+<Declaration>{BS}("=>"|"="){BS} { // Procedure binding
+ BEGIN(DeclarationBinding);
+ yyextra->code->codify(yytext);
+ }
+<DeclarationBinding>{ID} { // Type bound procedure link
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yy_pop_state(yyscanner);
+ }
+<Declaration>[(] { // start of array or type / class specification
+ yyextra->bracketCount++;
+ yyextra->code->codify(yytext);
+ }
+
+<Declaration>[)] { // end array specification
+ yyextra->bracketCount--;
+ if (!yyextra->bracketCount) yyextra->inTypeDecl = 0;
+ yyextra->code->codify(yytext);
+ }
+
+<Declaration,DeclarationBinding>"&" { // continuation line
+ yyextra->code->codify(yytext);
+ if (!yyextra->isFixedForm)
+ {
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(DeclContLine);
+ }
+ }
+<DeclContLine>"\n" { // declaration not yet finished
+ yyextra->contLineNr++;
+ codifyLines(yyscanner,yytext);
+ yyextra->bracketCount = 0;
+ yy_pop_state(yyscanner);
+ YY_FTN_RESET
+ }
+<Declaration,DeclarationBinding>"\n" { // end declaration line (?)
+ if (yyextra->endComment)
+ {
+ yyextra->endComment=FALSE;
+ }
+ else
+ {
+ codifyLines(yyscanner,yytext);
+ }
+ yyextra->bracketCount = 0;
+ yyextra->contLineNr++;
+ if (!(yyextra->hasContLine && yyextra->hasContLine[yyextra->contLineNr - 1]))
+ {
+ yyextra->isExternal = false;
+ yy_pop_state(yyscanner);
+ }
+ YY_FTN_RESET
+ }
+
+ /*-------- subprog calls -----------------------------------------*/
+
+<Start>"call"{BS_} {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(SubCall);
+ }
+<SubCall>{ID} { // subroutine call
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+ yy_pop_state(yyscanner);
+ }
+<Start>{ID}{BS}/"(" { // function call
+ if (yyextra->isFixedForm && yy_my_start == 6)
+ {
+ // fixed form continuation line
+ YY_FTN_REJECT;
+ }
+ else if (QCString(yytext).stripWhiteSpace().lower() == "type")
+ {
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(Declaration);
+ startFontClass(yyscanner,"keywordtype");
+ yyextra->code->codify(QCString(yytext).stripWhiteSpace());
+ endFontClass(yyscanner);
+ yyextra->code->codify(yytext + 4);
+ }
+ else
+ {
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+ }
+ }
+
+ /*-------- comments ---------------------------------------------------*/
+<Start,Declaration,DeclarationBinding>\n?{BS}"!>"|"!<" { // start comment line or comment block
+ if (yytext[0] == '\n')
+ {
+ yyextra->contLineNr++;
+ yy_old_start = 0;
+ yy_my_start = 1;
+ yy_end = static_cast<int>(yyleng);
+ }
+ // Actually we should see if ! on position 6, can be continuation
+ // but the chance is very unlikely, so no effort to solve it here
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(DocBlock);
+ yyextra->docBlock=yytext;
+ }
+<Declaration,DeclarationBinding>{BS}"!<" { // start comment line or comment block
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(DocBlock);
+ yyextra->docBlock=yytext;
+ }
+
+<DocBlock>.* { // contents of current comment line
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>"\n"{BS}("!>"|"!<"|"!!") { // comment block (next line is also comment line)
+ yyextra->contLineNr++;
+ yy_old_start = 0;
+ yy_my_start = 1;
+ yy_end = static_cast<int>(yyleng);
+ // Actually we should see if ! on position 6, can be continuation
+ // but the chance is very unlikely, so no effort to solve it here
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>"\n" { // comment block ends at the end of this line
+ // remove special comment (default config)
+ yyextra->contLineNr++;
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr+=((QCString)yyextra->docBlock).contains('\n');
+ yyextra->yyLineNr+=1;
+ nextCodeLine(yyscanner);
+ yyextra->endComment=TRUE;
+ }
+ else // do not remove comment
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yyextra->docBlock);
+ endFontClass(yyscanner);
+ }
+ unput(*yytext);
+ yyextra->contLineNr--;
+ yy_pop_state(yyscanner);
+ YY_FTN_RESET
+ }
+
+<*>"!"[^><\n].*|"!"$ { // normal comment
+ if(YY_START == String) YY_FTN_REJECT; // ignore in strings
+ if (yyextra->isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+<*>^[Cc*].* { // normal comment
+ if(! yyextra->isFixedForm) YY_FTN_REJECT;
+
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<*>"assignment"/{BS}"("{BS}"="{BS}")" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<*>"operator"/{BS}"("[^)]*")" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+ /*------ preprocessor --------------------------------------------*/
+<Start>"#".*\n {
+ if (yyextra->isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
+ yyextra->contLineNr++;
+ startFontClass(yyscanner,"preprocessor");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ YY_FTN_RESET
+ }
+ /*------ variable references? -------------------------------------*/
+
+<Start>"%"{BS}{ID} { // ignore references to elements
+ yyextra->code->codify(yytext);
+ }
+<Start>{ID} {
+ yyextra->insideBody=TRUE;
+ generateLink(yyscanner,*yyextra->code, yytext);
+ yyextra->insideBody=FALSE;
+ }
+ /*------ strings --------------------------------------------------*/
+<String>\n { // string with \n inside
+ yyextra->contLineNr++;
+ yyextra->str+=yytext;
+ startFontClass(yyscanner,"stringliteral");
+ codifyLines(yyscanner,yyextra->str);
+ endFontClass(yyscanner);
+ yyextra->str = "";
+ YY_FTN_RESET
+ }
+<String>\"|\' { // string ends with next quote without previous backspace
+ if(yytext[0]!=yyextra->stringStartSymbol) YY_FTN_REJECT; // single vs double quote
+ yyextra->str+=yytext;
+ startFontClass(yyscanner,"stringliteral");
+ codifyLines(yyscanner,yyextra->str);
+ endFontClass(yyscanner);
+ yy_pop_state(yyscanner);
+ }
+<String>. {yyextra->str+=yytext;}
+
+<*>\"|\' { /* string starts */
+ /* if(YY_START == StrIgnore) YY_FTN_REJECT; // ignore in simple comments */
+ if (yyextra->isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
+ yy_push_state(YY_START,yyscanner);
+ yyextra->stringStartSymbol=yytext[0]; // single or double quote
+ BEGIN(String);
+ yyextra->str=yytext;
+ }
+ /*-----------------------------------------------------------------------------*/
+
+<*>\n {
+ if (yyextra->endComment)
+ {
+ yyextra->endComment=FALSE;
+ }
+ else
+ {
+ codifyLines(yyscanner,yytext);
+ // comment cannot extend over the end of a line so should always be terminated at the end of the line.
+ if (yyextra->currentFontClass && !strcmp(yyextra->currentFontClass,"comment")) endFontClass(yyscanner);
+ }
+ yyextra->contLineNr++;
+ YY_FTN_RESET
+ }
+<*>^{BS}"type"{BS}"=" { yyextra->code->codify(yytext); }
+
+<*>[\x80-\xFF]* { // keep utf8 characters together...
+ if (yyextra->isFixedForm && yy_my_start > fixedCommentAfter)
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ }
+ }
+<*>. {
+ if (yyextra->isFixedForm && yy_my_start > fixedCommentAfter)
+ {
+ //yy_push_state(YY_START,yyscanner);
+ //BEGIN(DocBlock);
+ //yyextra->docBlock=yytext;
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ }
+ else
+ {
+ yyextra->code->codify(yytext);
+ }
+ }
+<*>{LOG_OPER} { // Fortran logical comparison keywords
+ yyextra->code->codify(yytext);
+ }
+<*><<EOF>> {
+ if (YY_START == DocBlock) {
+ if (!Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yyextra->docBlock);
+ endFontClass(yyscanner);
+ }
+ }
+ yyterminate();
+ }
+%%
+
+/*@ ----------------------------------------------------------------------------
+ */
+
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
{
- if (g_currentFontClass)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yy_size_t inputPosition = yyextra->inputPosition;
+ const char *s = yyextra->inputString + inputPosition;
+ yy_size_t c=0;
+ while( c < max_size && *s)
{
- g_code->endFontClass();
- g_currentFontClass=0;
+ *buf++ = *s++;
+ c++;
}
+ yyextra->inputPosition += c;
+ return c;
}
-static void startFontClass(const char *s)
+static void endFontClass(yyscan_t yyscanner)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->currentFontClass)
+ {
+ yyextra->code->endFontClass();
+ yyextra->currentFontClass=0;
+ }
+}
+
+static void startFontClass(yyscan_t yyscanner,const char *s)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
// if font class is already set don't stop and start it.
// strcmp does not like null pointers as input.
- if (!g_currentFontClass || !s || strcmp(g_currentFontClass,s))
+ if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
{
- endFontClass();
- g_code->startFontClass(s);
- g_currentFontClass=s;
+ endFontClass(yyscanner);
+ yyextra->code->startFontClass(s);
+ yyextra->currentFontClass=s;
}
}
-static void setCurrentDoc(const QCString &anchor)
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- if (g_searchCtx)
+ if (yyextra->searchCtx)
{
- Doxygen::searchIndex->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE);
+ yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),FALSE);
}
else
{
- Doxygen::searchIndex->setCurrentDoc(g_sourceFileDef,anchor,TRUE);
+ yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,TRUE);
}
}
}
-static void addToSearchIndex(const char *text)
+static void addToSearchIndex(yyscan_t yyscanner,const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- Doxygen::searchIndex->addWord(text,FALSE);
+ yyextra->code->addWord(text,FALSE);
}
}
-/*! start a new line of code, inserting a line number if g_sourceFileDef
+/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
* is TRUE. If a definition starts at the current line, then the line
* number is linked to the documentation of that definition.
*/
-static void startCodeLine()
+static void startCodeLine(yyscan_t yyscanner)
{
- if (g_sourceFileDef)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->sourceFileDef)
{
//QCString lineNumber,lineAnchor;
- //lineNumber.sprintf("%05d",g_yyLineNr);
- //lineAnchor.sprintf("l%05d",g_yyLineNr);
+ //lineNumber.sprintf("%05d",yyextra->yyLineNr);
+ //lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
- Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr);
- //printf("startCodeLine %d d=%s\n", g_yyLineNr,d ? d->name().data() : "<null>");
- if (!g_includeCodeFragment && d)
+ Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
+ //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,d ? d->name().data() : "<null>");
+ if (!yyextra->includeCodeFragment && d)
{
- g_currentDefinition = d;
- g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr);
- g_insideBody = FALSE;
- g_endComment = FALSE;
- g_parmType.resize(0);
- g_parmName.resize(0);
+ yyextra->currentDefinition = d;
+ yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
+ yyextra->insideBody = FALSE;
+ yyextra->endComment = FALSE;
QCString lineAnchor;
- lineAnchor.sprintf("l%05d",g_yyLineNr);
- if (g_currentMemberDef)
+ lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+ if (yyextra->currentMemberDef)
{
- g_code->writeLineNumber(g_currentMemberDef->getReference(),
- g_currentMemberDef->getOutputFileBase(),
- g_currentMemberDef->anchor(),g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
+ yyextra->currentMemberDef->getOutputFileBase(),
+ yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
else if (d->isLinkableInProject())
{
- g_code->writeLineNumber(d->getReference(),
- d->getOutputFileBase(),
- 0,g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(d->getReference(),
+ d->getOutputFileBase(),
+ 0,yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
}
else
{
- g_code->writeLineNumber(0,0,0,g_yyLineNr);
+ yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr);
}
}
- g_code->startCodeLine(g_sourceFileDef);
- if (g_currentFontClass)
+ yyextra->code->startCodeLine(yyextra->sourceFileDef);
+ if (yyextra->currentFontClass)
{
- g_code->startFontClass(g_currentFontClass);
+ yyextra->code->startFontClass(yyextra->currentFontClass);
}
}
-static void endFontClass();
-static void endCodeLine()
+static void endCodeLine(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endFontClass(yyscanner);
+ yyextra->code->endCodeLine();
+}
+
+static void nextCodeLine(yyscan_t yyscanner)
{
- endFontClass();
- g_code->endCodeLine();
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char * fc = yyextra->currentFontClass;
+ endCodeLine(yyscanner);
+ if (yyextra->yyLineNr<yyextra->inputLines)
+ {
+ yyextra->currentFontClass = fc;
+ startCodeLine(yyscanner);
+ }
}
/*! write a code fragment 'text' that may span multiple lines, inserting
* line numbers for each line.
*/
-static void codifyLines(char *text)
+static void codifyLines(yyscan_t yyscanner,const char *text)
{
- //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text);
- char *p=text,*sp=p;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text);
+ const char *p=text,*sp=p;
char c;
bool done=FALSE;
- const char * tmp_currentFontClass = g_currentFontClass;
while (!done)
{
sp=p;
while ((c=*p++) && c!='\n') { }
if (c=='\n')
{
- g_yyLineNr++;
- *(p-1)='\0';
- g_code->codify(sp);
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
- {
- startCodeLine();
- }
- if (tmp_currentFontClass)
- {
- startFontClass(tmp_currentFontClass);
- }
+ yyextra->yyLineNr++;
+ int l = (int)(p-sp-1);
+ char *tmp = (char*)malloc(l+1);
+ memcpy(tmp,sp,l);
+ tmp[l]='\0';
+ yyextra->code->codify(tmp);
+ free(tmp);
+ nextCodeLine(yyscanner);
}
else
{
- g_code->codify(sp);
+ yyextra->code->codify(sp);
done=TRUE;
}
}
}
-static void codifyLines(QCString str)
-{
- char *tmp= (char *) malloc(str.length()+1);
- strcpy(tmp, str);
- codifyLines(tmp);
- free(tmp);
-}
-
/*! writes a link to a fragment \a text that may span multiple lines, inserting
* line numbers for each line. If \a text contains newlines, the link will be
* split into multiple links with the same destination, one for each line.
*/
-static void writeMultiLineCodeLink(CodeOutputInterface &ol,
+static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
Definition *d,const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
@@ -351,15 +1030,11 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
while ((c=*p++) && c!='\n') { }
if (c=='\n')
{
- g_yyLineNr++;
+ yyextra->yyLineNr++;
*(p-1)='\0';
//printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
- {
- startCodeLine();
- }
+ nextCodeLine(yyscanner);
}
else
{
@@ -396,7 +1071,7 @@ static bool getFortranNamespaceDefs(const QCString &mname,
@returns true, if type is found
*/
static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName,
- ClassDef *&cd, UseSDict *usedict=0)
+ ClassDef *&cd, UseSDict *usedict)
{
if (tname.isEmpty()) return FALSE; /* empty name => nothing to link */
@@ -420,7 +1095,7 @@ static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName
{
if ((cd= Doxygen::classSDict->find(use->module+"::"+tname)))
{
- //cout << "=== type found in used module" << endl;
+ //cout << "=== type found in used module" << endl;
return TRUE;
}
}
@@ -436,13 +1111,14 @@ static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName
@param usedict array of data of USE-statement
@returns MemberDef pointer, if found, or nullptr otherwise
*/
-static MemberDef *getFortranDefs(const QCString &memberName, const QCString &moduleName,
- UseSDict *usedict=0)
+static MemberDef *getFortranDefs(yyscan_t yyscanner,const QCString &memberName, const QCString &moduleName,
+ UseSDict *usedict)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (memberName.isEmpty()) return nullptr; /* empty name => nothing to link */
// look in local variables
- QListIterator<Scope> it(scopeStack);
+ QListIterator<Scope> it(yyextra->scopeStack);
Scope *scope;
for (it.toLast();(scope=it.current());--it)
{
@@ -524,9 +1200,9 @@ static MemberDef *getFortranDefs(const QCString &memberName, const QCString &mod
gets the link to a generic procedure which depends not on the name, but on the parameter list
@todo implementation
*/
-static bool getGenericProcedureLink(const ClassDef *cd,
+static bool getGenericProcedureLink(yyscan_t yyscanner,const ClassDef *cd,
const char *memberText,
- CodeOutputInterface &ol)
+ CodeOutputInterface &ol)
{
(void)cd;
(void)memberText;
@@ -534,31 +1210,32 @@ static bool getGenericProcedureLink(const ClassDef *cd,
return FALSE;
}
-static bool getLink(UseSDict *usedict, // dictionary with used modules
+static bool getLink(yyscan_t yyscanner,UseSDict *usedict, // dictionary with used modules
const char *memberText, // exact member text
- CodeOutputInterface &ol,
- const char *text)
+ CodeOutputInterface &ol,
+ const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
MemberDef *md=0;
QCString memberName= removeRedundantWhiteSpace(memberText);
- if ((md=getFortranDefs(memberName, currentModule, usedict)) && md->isLinkable())
+ if ((md=getFortranDefs(yyscanner,memberName, yyextra->currentModule, usedict)) && md->isLinkable())
{
if (md->isVariable() && (md->getLanguage()!=SrcLangExt_Fortran)) return FALSE; // Non Fortran variables aren't handled yet,
// see also linkifyText in util.cpp
const Definition *d = md->getOuterScope()==Doxygen::globalScope ?
- md->getBodyDef() : md->getOuterScope();
+ md->getBodyDef() : md->getOuterScope();
if (md->getGroupDef()) d = md->getGroupDef();
if (d && d->isLinkable())
{
- if (g_currentDefinition && g_currentMemberDef &&
- md!=g_currentMemberDef && g_insideBody && g_collectXRefs)
+ if (yyextra->currentDefinition && yyextra->currentMemberDef &&
+ md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs)
{
- addDocCrossReference(g_currentMemberDef,md);
+ addDocCrossReference(yyextra->currentMemberDef,md);
}
- writeMultiLineCodeLink(ol,md,text ? text : memberText);
- addToSearchIndex(text ? text : memberText);
+ writeMultiLineCodeLink(yyscanner,ol,md,text ? text : memberText);
+ addToSearchIndex(yyscanner, text ? text : memberText);
return TRUE;
}
}
@@ -566,35 +1243,36 @@ static bool getLink(UseSDict *usedict, // dictionary with used modules
}
-static void generateLink(CodeOutputInterface &ol, char *lname)
+static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, char *lname)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
ClassDef *cd=0;
NamespaceDef *nsd=0;
QCString tmp = lname;
tmp = removeRedundantWhiteSpace(tmp.lower());
// check if lowercase lname is a linkable type or interface
- if ( (getFortranTypeDefs(tmp, currentModule, cd, useMembers)) && cd->isLinkable() )
+ if ( (getFortranTypeDefs(tmp, yyextra->currentModule, cd, yyextra->useMembers)) && cd->isLinkable() )
{
if ( (cd->compoundType() == ClassDef::Class) && // was Entry::INTERFACE_SEC) &&
- (getGenericProcedureLink(cd, tmp, ol)) )
+ (getGenericProcedureLink(yyscanner, cd, tmp, ol)) )
{
//cout << "=== generic procedure resolved" << endl;
}
else
{ // write type or interface link
- writeMultiLineCodeLink(ol,cd,tmp);
- addToSearchIndex(tmp.data());
+ writeMultiLineCodeLink(yyscanner, ol,cd,tmp);
+ addToSearchIndex(yyscanner, tmp);
}
}
// check for module
else if ( (getFortranNamespaceDefs(tmp, nsd)) && nsd->isLinkable() )
{ // write module link
- writeMultiLineCodeLink(ol,nsd,tmp);
- addToSearchIndex(tmp.data());
+ writeMultiLineCodeLink(yyscanner,ol,nsd,tmp);
+ addToSearchIndex(yyscanner,tmp);
}
// check for function/variable
- else if (getLink(useMembers, tmp, ol, tmp))
+ else if (getLink(yyscanner,yyextra->useMembers, tmp, ol, tmp))
{
//cout << "=== found link for lowercase " << lname << endl;
}
@@ -602,16 +1280,17 @@ static void generateLink(CodeOutputInterface &ol, char *lname)
{
// nothing found, just write out the word
//startFontClass("charliteral"); //test
- codifyLines(tmp);
- //endFontClass(); //test
- addToSearchIndex(tmp.data());
+ codifyLines(yyscanner,tmp);
+ //endFontClass(yyscanner); //test
+ addToSearchIndex(yyscanner,tmp);
}
}
/*! counts the number of lines in the input */
-static int countLines()
+static int countLines(yyscan_t yyscanner)
{
- const char *p=g_inputString;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *p=yyextra->inputString;
char c;
int count=1;
while ((c=*p))
@@ -619,712 +1298,69 @@ static int countLines()
p++ ;
if (c=='\n') count++;
}
- if (p>g_inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
count++,
- g_needsTermination=TRUE;
+ yyextra->needsTermination=TRUE;
}
return count;
}
//----------------------------------------------------------------------------
/** start scope */
-static void startScope()
+static void startScope(yyscan_t yyscanner)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
DBG_CTX((stderr, "===> startScope %s",yytext));
Scope *scope = new Scope;
- scopeStack.append(scope);
+ yyextra->scopeStack.append(scope);
}
/** end scope */
-static void endScope()
+static void endScope(yyscan_t yyscanner)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
DBG_CTX((stderr,"===> endScope %s",yytext));
- if (scopeStack.isEmpty())
+ if (yyextra->scopeStack.isEmpty())
{
DBG_CTX((stderr,"WARNING: fortrancode.l: stack empty!\n"));
return;
}
- Scope *scope = scopeStack.getLast();
- scopeStack.removeLast();
+ Scope *scope = yyextra->scopeStack.getLast();
+ yyextra->scopeStack.removeLast();
for ( QCStringList::Iterator it = scope->useNames.begin(); it != scope->useNames.end(); ++it)
{
- useMembers->remove(*it);
+ yyextra->useMembers->remove(*it);
}
delete scope;
}
-static void addUse(const QCString &moduleName)
+static void addUse(yyscan_t yyscanner,const QCString &moduleName)
{
- if (!scopeStack.isEmpty())
- scopeStack.getLast()->useNames.append(moduleName);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->scopeStack.isEmpty())
+ yyextra->scopeStack.getLast()->useNames.append(moduleName);
}
-static void addLocalVar(const QCString &varName)
+static void addLocalVar(yyscan_t yyscanner,const QCString &varName)
{
- if (!scopeStack.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->scopeStack.isEmpty())
{
std::string lowVarName = varName.lower().str();
- scopeStack.getLast()->localVars.insert(lowVarName);
- if (g_isExternal) scopeStack.getLast()->externalVars.insert(lowVarName);
- }
-}
-
-//----------------------------------------------------------------------------
-
-/* -----------------------------------------------------------------*/
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
-
-static yy_size_t yyread(char *buf,yy_size_t max_size)
-{
- yy_size_t c=0;
- while( c < max_size && g_inputString[g_inputPosition] )
- {
- *buf = g_inputString[g_inputPosition++] ;
- c++; buf++;
+ yyextra->scopeStack.getLast()->localVars.insert(lowVarName);
+ if (yyextra->isExternal) yyextra->scopeStack.getLast()->externalVars.insert(lowVarName);
}
- return c;
}
-%}
-
-IDSYM [a-z_A-Z0-9]
-ID [a-z_A-Z]+{IDSYM}*
-SUBPROG (subroutine|function)
-B [ \t]
-BS [ \t]*
-BS_ [ \t]+
-COMMA {BS},{BS}
-ARGS_L0 ("("[^)]*")")
-ARGS_L1a [^()]*"("[^)]*")"[^)]*
-ARGS_L1 ("("{ARGS_L1a}*")")
-ARGS_L2 "("({ARGS_L0}|[^()]|{ARGS_L1a}|{ARGS_L1})*")"
-ARGS {BS}({ARGS_L0}|{ARGS_L1}|{ARGS_L2})
-
-NUM_TYPE (complex|integer|logical|real)
-LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.)
-KIND {ARGS}
-CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
-TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE|ENUMERATOR)
-
-INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
-ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|(NON_)?RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED|CONTIGUOUS|VOLATILE)
-ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC)
-/* Assume that attribute statements are almost the same as attributes. */
-ATTR_STMT {ATTR_SPEC}|DIMENSION
-FLOW (DO|SELECT|CASE|SELECT{BS}(CASE|TYPE)|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT|GO{BS}TO)
-COMMANDS (FORMAT|CONTAINS|MODULE{BS_}PROCEDURE|WRITE|READ|ALLOCATE|ALLOCATED|ASSOCIATED|PRESENT|DEALLOCATE|NULLIFY|SIZE|INQUIRE|OPEN|CLOSE|FLUSH|DATA|COMMON)
-IGNORE (CALL)
-PREFIX ((NON_)?RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,4}((NON_)?RECURSIVE|IMPURE|PURE|ELEMENTAL)?0
-LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")"
-
-/* | */
-
-%option noyywrap
-%option stack
-%option caseless
-/*%option debug*/
-
-%x Start
-%x SubCall
-%x FuncDef
-%x ClassName
-%x ClassVar
-%x Subprog
-%x DocBlock
-%x Use
-%x UseOnly
-%x Import
-%x Declaration
-%x DeclarationBinding
-%x DeclContLine
-%x Parameterlist
-%x String
-%x Subprogend
-
-%%
- /*==================================================================*/
-
- /*-------- ignore ------------------------------------------------------------*/
-
-<Start>{IGNORE}/{BS}"(" { // do not search keywords, intrinsics... TODO: complete list
- codifyLines(yytext);
- }
- /*-------- inner construct ---------------------------------------------------*/
-
-<Start>{COMMANDS}/{BS}[,( \t\n] { // highlight
- /* font class is defined e.g. in doxygen.css */
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>{FLOW}/{BS}[,( \t\n] {
- if (g_isFixedForm)
- {
- if ((yy_my_start == 1) && ((yytext[0] == 'c') || (yytext[0] == 'C'))) YY_FTN_REJECT;
- }
- if (g_currentMemberDef && g_currentMemberDef->isFunction())
- {
- g_currentMemberDef->incrementFlowKeyWordCount();
- }
- /* font class is defined e.g. in doxygen.css */
- startFontClass("keywordflow");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>{BS}(CASE|CLASS|TYPE){BS_}(IS|DEFAULT) {
- startFontClass("keywordflow");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>{BS}"end"({BS}{FLOW})/[ \t\n] { // list is a bit long as not all have possible end
- startFontClass("keywordflow");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>"implicit"{BS}("none"|{TYPE_SPEC}) {
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>^{BS}"namelist"/[//] { // Namelist specification
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- }
- /*-------- use statement -------------------------------------------*/
-<Start>"use"{BS_} {
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(Use);
- }
-<Use>"ONLY" { // TODO: rename
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(UseOnly);
- }
-<Use>{ID} {
- QCString tmp = yytext;
- tmp = tmp.lower();
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
-
- /* append module name to use dict */
- useEntry = new UseEntry();
- //useEntry->module = yytext;
- //useMembers->append(yytext, useEntry);
- //addUse(yytext);
- useEntry->module = tmp;
- useMembers->append(tmp, useEntry);
- addUse(tmp);
- }
-<Use,UseOnly,Import>{BS},{BS} { codifyLines(yytext); }
-<UseOnly,Import>{BS}&{BS}"\n" { codifyLines(yytext);
- g_contLineNr++;
- YY_FTN_RESET}
-<UseOnly>{ID} {
- QCString tmp = yytext;
- tmp = tmp.lower();
- useEntry->onlyNames.append(tmp);
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
- }
-<Use,UseOnly,Import>"\n" {
- unput(*yytext);
- yy_pop_state();YY_FTN_RESET
- }
-<*>"import"{BS}/"\n" |
-<*>"import"{BS_} {
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(Import);
- }
-<Import>{ID} {
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
- }
-<Import>("ONLY"|"NONE"|"ALL") {
- startFontClass("keywordtype");
- codifyLines(yytext);
- endFontClass();
- }
- /*-------- fortran module -----------------------------------------*/
-<Start>("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { //
- startScope();
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(ClassName);
- if (!qstricmp(yytext,"module")) currentModule="module";
- }
-<Start>("enum")/{BS_}|{BS}{COMMA}{BS}{LANGUAGE_BIND_SPEC}|\n { //
- startScope();
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(ClassName);
- currentClass="class";
- }
-<*>{LANGUAGE_BIND_SPEC} { //
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { //
- startScope();
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(ClassName);
- currentClass="class";
- }
-<ClassName>{ID} {
- if (currentModule == "module")
- {
- currentModule=yytext;
- currentModule = currentModule.lower();
- }
- generateLink(*g_code,yytext);
- yy_pop_state();
- }
-<ClassName>({ACCESS_SPEC}|ABSTRACT|EXTENDS)/[,:( ] { //| variable declaration
- startFontClass("keyword");
- g_code->codify(yytext);
- endFontClass();
- }
-<ClassName>\n { // interface may be without name
- yy_pop_state();
- YY_FTN_REJECT;
- }
-<Start>^{BS}"end"({BS_}"enum").* { // just reset currentClass, rest is done in following rule
- currentClass=0;
- YY_FTN_REJECT;
- }
-<Start>^{BS}"end"({BS_}"type").* { // just reset currentClass, rest is done in following rule
- currentClass=0;
- YY_FTN_REJECT;
- }
-<Start>^{BS}"end"({BS_}"module").* { // just reset currentModule, rest is done in following rule
- currentModule=0;
- YY_FTN_REJECT;
- }
- /*-------- subprog definition -------------------------------------*/
-<Start>({PREFIX}{BS_})?{TYPE_SPEC}{BS_}({PREFIX}{BS_})?{BS}/{SUBPROG}{BS_} { // TYPE_SPEC is for old function style function result
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(Subprog);
- }
-<Subprog>{ID} { // subroutine/function name
- DBG_CTX((stderr, "===> start subprogram %s\n", yytext));
- startScope();
- generateLink(*g_code,yytext);
- }
-<Subprog>"result"/{BS}"("[^)]*")" {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-<Subprog>"("[^)]*")" { // ignore rest of line
- codifyLines(yytext);
- }
-<Subprog,Subprogend>"\n" { codifyLines(yytext);
- g_contLineNr++;
- yy_pop_state();
- YY_FTN_RESET
- }
-<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface")?{BS} { // Fortran subroutine or function ends
- //cout << "===> end function " << yytext << endl;
- endScope();
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(Subprogend);
- }
-<Subprogend>{ID}/{BS}(\n|!|;) {
- generateLink(*g_code,yytext);
- yy_pop_state();
- }
-<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface"){BS}/(\n|!|;) { // Fortran subroutine or function ends
- //cout << "===> end function " << yytext << endl;
- endScope();
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
- /*-------- variable declaration ----------------------------------*/
-<Start>^{BS}"real"/[,:( ] { // real is a bit tricky as it is a data type but also a function.
- yy_push_state(YY_START);
- BEGIN(Declaration);
- startFontClass("keywordtype");
- g_code->codify(yytext);
- endFontClass();
- }
-<Start>{TYPE_SPEC}/[,:( ] {
- QCString typ = yytext;
- typ = removeRedundantWhiteSpace(typ.lower());
- if (typ.startsWith("real")) YY_FTN_REJECT;
- if (typ == "type" || typ == "class" || typ == "procedure") inTypeDecl = 1;
- yy_push_state(YY_START);
- BEGIN(Declaration);
- startFontClass("keywordtype");
- g_code->codify(yytext);
- endFontClass();
- }
-<Start>{ATTR_SPEC} {
- if (QCString(yytext) == "external")
- {
- yy_push_state(YY_START);
- BEGIN(Declaration);
- g_isExternal = true;
- }
- startFontClass("keywordtype");
- g_code->codify(yytext);
- endFontClass();
- }
-<Declaration>({TYPE_SPEC}|{ATTR_SPEC})/[,:( ] { //| variable declaration
- if (QCString(yytext) == "external") g_isExternal = true;
- startFontClass("keywordtype");
- g_code->codify(yytext);
- endFontClass();
- }
-<Declaration>{ID} { // local var
- if (g_isFixedForm && yy_my_start == 1)
- {
- startFontClass("comment");
- g_code->codify(yytext);
- endFontClass();
- }
- else if (g_currentMemberDef &&
- ((g_currentMemberDef->isFunction() && (g_currentMemberDef->typeString()!=QCString("subroutine") || inTypeDecl)) ||
- g_currentMemberDef->isVariable() || g_currentMemberDef->isEnumValue()
- )
- )
- {
- generateLink(*g_code, yytext);
- }
- else
- {
- g_code->codify(yytext);
- addLocalVar(yytext);
- }
- }
-<Declaration>{BS}("=>"|"="){BS} { // Procedure binding
- BEGIN(DeclarationBinding);
- g_code->codify(yytext);
- }
-<DeclarationBinding>{ID} { // Type bound procedure link
- generateLink(*g_code, yytext);
- yy_pop_state();
- }
-<Declaration>[(] { // start of array or type / class specification
- bracketCount++;
- g_code->codify(yytext);
- }
-
-<Declaration>[)] { // end array specification
- bracketCount--;
- if (!bracketCount) inTypeDecl = 0;
- g_code->codify(yytext);
- }
-
-<Declaration,DeclarationBinding>"&" { // continuation line
- g_code->codify(yytext);
- if (!g_isFixedForm)
- {
- yy_push_state(YY_START);
- BEGIN(DeclContLine);
- }
- }
-<DeclContLine>"\n" { // declaration not yet finished
- g_contLineNr++;
- codifyLines(yytext);
- bracketCount = 0;
- yy_pop_state();
- YY_FTN_RESET
- }
-<Declaration,DeclarationBinding>"\n" { // end declaration line (?)
- if (g_endComment)
- {
- g_endComment=FALSE;
- }
- else
- {
- codifyLines(yytext);
- }
- bracketCount = 0;
- g_contLineNr++;
- if (!(g_hasContLine && g_hasContLine[g_contLineNr - 1]))
- {
- g_isExternal = false;
- yy_pop_state();
- }
- YY_FTN_RESET
- }
-
- /*-------- subprog calls -----------------------------------------*/
-
-<Start>"call"{BS_} {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- yy_push_state(YY_START);
- BEGIN(SubCall);
- }
-<SubCall>{ID} { // subroutine call
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
- yy_pop_state();
- }
-<Start>{ID}{BS}/"(" { // function call
- if (g_isFixedForm && yy_my_start == 6)
- {
- // fixed form continuation line
- YY_FTN_REJECT;
- }
- else if (QCString(yytext).stripWhiteSpace().lower() == "type")
- {
- yy_push_state(YY_START);
- BEGIN(Declaration);
- startFontClass("keywordtype");
- g_code->codify(QCString(yytext).stripWhiteSpace());
- endFontClass();
- g_code->codify(yytext + 4);
- }
- else
- {
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
- }
- }
-
- /*-------- comments ---------------------------------------------------*/
-<Start,Declaration,DeclarationBinding>\n?{BS}"!>"|"!<" { // start comment line or comment block
- if (yytext[0] == '\n')
- {
- g_contLineNr++;
- yy_old_start = 0;
- yy_my_start = 1;
- yy_end = static_cast<int>(yyleng);
- }
- // Actually we should see if ! on position 6, can be continuation
- // but the chance is very unlikely, so no effort to solve it here
- yy_push_state(YY_START);
- BEGIN(DocBlock);
- docBlock=yytext;
- }
-<Declaration,DeclarationBinding>{BS}"!<" { // start comment line or comment block
- yy_push_state(YY_START);
- BEGIN(DocBlock);
- docBlock=yytext;
- }
-
-<DocBlock>.* { // contents of current comment line
- docBlock+=yytext;
- }
-<DocBlock>"\n"{BS}("!>"|"!<"|"!!") { // comment block (next line is also comment line)
- g_contLineNr++;
- yy_old_start = 0;
- yy_my_start = 1;
- yy_end = static_cast<int>(yyleng);
- // Actually we should see if ! on position 6, can be continuation
- // but the chance is very unlikely, so no effort to solve it here
- docBlock+=yytext;
- }
-<DocBlock>"\n" { // comment block ends at the end of this line
- // remove special comment (default config)
- g_contLineNr++;
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- g_yyLineNr+=((QCString)docBlock).contains('\n');
- g_yyLineNr+=1;
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
- {
- startCodeLine();
- }
- g_endComment=TRUE;
- }
- else // do not remove comment
- {
- startFontClass("comment");
- codifyLines(docBlock);
- endFontClass();
- }
- unput(*yytext);
- g_contLineNr--;
- yy_pop_state();
- YY_FTN_RESET
- }
-
-<*>"!"[^><\n].*|"!"$ { // normal comment
- if(YY_START == String) YY_FTN_REJECT; // ignore in strings
- if (g_isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
- startFontClass("comment");
- codifyLines(yytext);
- endFontClass();
- }
-
-<*>^[Cc*].* { // normal comment
- if(! g_isFixedForm) YY_FTN_REJECT;
-
- startFontClass("comment");
- codifyLines(yytext);
- endFontClass();
- }
-<*>"assignment"/{BS}"("{BS}"="{BS}")" {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-<*>"operator"/{BS}"("[^)]*")" {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- }
-
- /*------ preprocessor --------------------------------------------*/
-<Start>"#".*\n {
- if (g_isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
- g_contLineNr++;
- startFontClass("preprocessor");
- codifyLines(yytext);
- endFontClass();
- YY_FTN_RESET
- }
- /*------ variable references? -------------------------------------*/
-
-<Start>"%"{BS}{ID} { // ignore references to elements
- g_code->codify(yytext);
- }
-<Start>{ID} {
- g_insideBody=TRUE;
- generateLink(*g_code, yytext);
- g_insideBody=FALSE;
- }
- /*------ strings --------------------------------------------------*/
-<String>\n { // string with \n inside
- g_contLineNr++;
- g_str+=yytext;
- startFontClass("stringliteral");
- codifyLines(g_str);
- endFontClass();
- g_str = "";
- YY_FTN_RESET
- }
-<String>\"|\' { // string ends with next quote without previous backspace
- if(yytext[0]!=stringStartSymbol) YY_FTN_REJECT; // single vs double quote
- g_str+=yytext;
- startFontClass("stringliteral");
- codifyLines(g_str);
- endFontClass();
- yy_pop_state();
- }
-<String>. {g_str+=yytext;}
-
-<*>\"|\' { /* string starts */
- /* if(YY_START == StrIgnore) YY_FTN_REJECT; // ignore in simple comments */
- if (g_isFixedForm && yy_my_start == 6) YY_FTN_REJECT;
- yy_push_state(YY_START);
- stringStartSymbol=yytext[0]; // single or double quote
- BEGIN(String);
- g_str=yytext;
- }
- /*-----------------------------------------------------------------------------*/
-
-<*>\n {
- if (g_endComment)
- {
- g_endComment=FALSE;
- }
- else
- {
- codifyLines(yytext);
- // comment cannot extend over the end of a line so should always be terminated at the end of the line.
- if (g_currentFontClass && !strcmp(g_currentFontClass,"comment")) endFontClass();
- }
- g_contLineNr++;
- YY_FTN_RESET
- }
-<*>^{BS}"type"{BS}"=" { g_code->codify(yytext); }
-
-<*>[\x80-\xFF]* { // keep utf8 characters together...
- if (g_isFixedForm && yy_my_start > fixedCommentAfter)
- {
- startFontClass("comment");
- codifyLines(yytext);
- }
- else
- {
- g_code->codify(yytext);
- }
- }
-<*>. {
- if (g_isFixedForm && yy_my_start > fixedCommentAfter)
- {
- //yy_push_state(YY_START);
- //BEGIN(DocBlock);
- //docBlock=yytext;
- startFontClass("comment");
- codifyLines(yytext);
- }
- else
- {
- g_code->codify(yytext);
- }
- }
-<*>{LOG_OPER} { // Fortran logical comparison keywords
- g_code->codify(yytext);
- }
-<*><<EOF>> {
- if (YY_START == DocBlock) {
- if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- startFontClass("comment");
- codifyLines(docBlock);
- endFontClass();
- }
- }
- yyterminate();
- }
-%%
-
-/*@ ----------------------------------------------------------------------------
- */
-
/*===================================================================*/
-void resetFortranCodeParserState() {}
-
-bool recognizeFixedForm(const char* contents, FortranFormat format); /* prototype, implementation in fortranscanner.l */
-const char* prepassFixedForm(const char* contents, int *hasContLine); /* prototype, implementation in fortranscanner.l */
-static void checkContLines(const char *s)
+static void checkContLines(yyscan_t yyscanner,const char *s)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
int numLines = 0;
int i = 0;
const char *p = s;
@@ -1336,91 +1372,60 @@ static void checkContLines(const char *s)
p++;
}
- g_hasContLine = (int *) malloc((numLines) * sizeof(int));
+ yyextra->hasContLine = (int *) malloc((numLines) * sizeof(int));
for (i = 0; i < numLines; i++)
- g_hasContLine[i] = 0;
- p = prepassFixedForm(s, g_hasContLine);
- g_hasContLine[0] = 0;
+ yyextra->hasContLine[i] = 0;
+ p = prepassFixedForm(s, yyextra->hasContLine);
+ yyextra->hasContLine[0] = 0;
}
void parseFortranCode(CodeOutputInterface &od,const char *,const QCString &s,
bool exBlock, const char *exName,FileDef *fd,
- int startLine,int endLine,bool inlineFragment,
- const MemberDef *,bool,const Definition *searchCtx,
+ int startLine,int endLine,bool inlineFragment,
+ const MemberDef *,bool,const Definition *searchCtx,
bool collectXRefs, FortranFormat format)
{
//printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
- if (s.isEmpty()) return;
- printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
- g_code = &od;
- g_inputString = s;
- g_inputPosition = 0;
- g_isFixedForm = recognizeFixedForm((const char*)s,format);
- g_contLineNr = 1;
- g_hasContLine = NULL;
- if (g_isFixedForm)
- {
- checkContLines(g_inputString);
- }
- g_currentFontClass = 0;
- g_needsTermination = FALSE;
- g_searchCtx = searchCtx;
- g_collectXRefs = collectXRefs;
- if (startLine!=-1)
- g_yyLineNr = startLine;
- else
- g_yyLineNr = 1;
-
- if (endLine!=-1)
- g_inputLines = endLine+1;
- else
- g_inputLines = g_yyLineNr + countLines() - 1;
-
- g_exampleBlock = exBlock;
- g_exampleName = exName;
- g_sourceFileDef = fd;
- if (exBlock && fd==0)
- {
- // create a dummy filedef for the example
- g_sourceFileDef = createFileDef("",exName);
- }
- if (g_sourceFileDef)
- {
- setCurrentDoc("l00001");
- }
- g_currentDefinition = 0;
- g_currentMemberDef = 0;
- if (!g_exampleName.isEmpty())
- {
- g_exampleFile = convertNameToFile(g_exampleName+"-example");
- }
- g_includeCodeFragment = inlineFragment;
- startCodeLine();
- g_parmName.resize(0);
- g_parmType.resize(0);
- fortrancodeYYrestart( fortrancodeYYin );
- BEGIN( Start );
- fortrancodeYYlex();
- if (g_needsTermination)
- {
- endFontClass();
- g_code->endCodeLine();
- }
- if (exBlock && g_sourceFileDef)
- {
- // delete the temporary file definition used for this example
- delete g_sourceFileDef;
- g_sourceFileDef=0;
- }
- if (g_hasContLine) free(g_hasContLine);
- g_hasContLine = NULL;
- printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
return;
}
//---------------------------------------------------------
+struct FortranCodeParser::Private
+{
+ yyscan_t yyscanner;
+ fortrancodeYY_state state;
+ FortranFormat format;
+};
+
+FortranCodeParser::FortranCodeParser(FortranFormat format) : p(std::make_unique<Private>())
+{
+ p->format = format;
+ fortrancodeYYlex_init_extra(&p->state,&p->yyscanner);
+#ifdef FLEX_DEBUG
+ fortrancodeYYset_debug(1,p->yyscanner);
+#endif
+ resetCodeParserState();
+ p->state.useMembers = new UseSDict;
+}
+
+FortranCodeParser::~FortranCodeParser()
+{
+ delete p->state.useMembers;
+ fortrancodeYYlex_destroy(p->yyscanner);
+}
+
+void FortranCodeParser::resetCodeParserState()
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+ yyextra->currentFontClass = 0;
+ yyextra->needsTermination = FALSE;
+ BEGIN( Start );
+}
+
void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf,
const char * scopeName,
const QCString & input,
@@ -1431,20 +1436,85 @@ void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf,
int startLine,
int endLine,
bool inlineFragment,
- const MemberDef *memberDef,
+ const MemberDef *memberDef,
bool showLineNumbers,
const Definition *searchCtx,
bool collectXRefs
)
{
- ::parseFortranCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
- fileDef,startLine,endLine,inlineFragment,memberDef,
- showLineNumbers,searchCtx,collectXRefs,m_format);
-}
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ //::parseFortranCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
+ // fileDef,startLine,endLine,inlineFragment,memberDef,
+ // showLineNumbers,searchCtx,collectXRefs,m_format);
+ // parseFortranCode(CodeOutputInterface &od,const char *,const QCString &s,
+ // bool exBlock, const char *exName,FileDef *fd,
+ // int startLine,int endLine,bool inlineFragment,
+ // const MemberDef *,bool,const Definition *searchCtx,
+ // bool collectXRefs, FortranFormat format)
+ if (input.isEmpty()) return;
+ printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
+ yyextra->code = &codeOutIntf;
+ yyextra->inputString = input;
+ yyextra->inputPosition = 0;
+ yyextra->isFixedForm = recognizeFixedForm(input,p->format);
+ yyextra->contLineNr = 1;
+ yyextra->hasContLine = NULL;
+ if (yyextra->isFixedForm)
+ {
+ checkContLines(yyscanner,yyextra->inputString);
+ }
+ yyextra->currentFontClass = 0;
+ yyextra->needsTermination = FALSE;
+ yyextra->searchCtx = searchCtx;
+ yyextra->collectXRefs = collectXRefs;
+ if (startLine!=-1)
+ yyextra->yyLineNr = startLine;
+ else
+ yyextra->yyLineNr = 1;
-void FortranCodeParser::resetCodeParserState()
-{
- ::resetFortranCodeParserState();
+ if (endLine!=-1)
+ yyextra->inputLines = endLine+1;
+ else
+ yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
+
+ yyextra->exampleBlock = isExampleBlock;
+ yyextra->exampleName = exampleName;
+ yyextra->sourceFileDef = fileDef;
+ if (isExampleBlock && fileDef==0)
+ {
+ // create a dummy filedef for the example
+ yyextra->sourceFileDef = createFileDef("",exampleName);
+ }
+ if (yyextra->sourceFileDef)
+ {
+ setCurrentDoc(yyscanner,"l00001");
+ }
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+ if (!yyextra->exampleName.isEmpty())
+ {
+ yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example");
+ }
+ yyextra->includeCodeFragment = inlineFragment;
+ startCodeLine(yyscanner);
+ fortrancodeYYrestart(0, yyscanner);
+ BEGIN( Start );
+ fortrancodeYYlex(yyscanner);
+ if (yyextra->needsTermination)
+ {
+ endFontClass(yyscanner);
+ yyextra->code->endCodeLine();
+ }
+ if (isExampleBlock && yyextra->sourceFileDef)
+ {
+ // delete the temporary file definition used for this example
+ delete yyextra->sourceFileDef;
+ yyextra->sourceFileDef=0;
+ }
+ if (yyextra->hasContLine) free(yyextra->hasContLine);
+ yyextra->hasContLine = NULL;
+ printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
}
//---------------------------------------------------------
diff --git a/src/fortranscanner.h b/src/fortranscanner.h
index 0e67bb2..0fbba89 100644
--- a/src/fortranscanner.h
+++ b/src/fortranscanner.h
@@ -53,5 +53,6 @@ class FortranOutlineParserFixed : public FortranOutlineParser
FortranOutlineParserFixed() : FortranOutlineParser(FortranFormat_Fixed) { }
};
+const char* prepassFixedForm(const char* contents, int *hasContLine);
#endif
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index cf48a3e..dfca1f8 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -1498,49 +1498,6 @@ void truncatePrepass(yyscan_t yyscanner,int index)
yyextra->inputStringPrepass.truncate(index);
}
-// simplified way to know if this is fixed form
-bool recognizeFixedForm(const char* contents, FortranFormat format)
-{
- int column=0;
- bool skipLine=FALSE;
-
- if (format == FortranFormat_Fixed) return TRUE;
- if (format == FortranFormat_Free) return FALSE;
-
- for(int i=0;;i++) {
- column++;
-
- switch(contents[i]) {
- case '\n':
- column=0;
- skipLine=FALSE;
- break;
- case ' ':
- break;
- case '\000':
- return FALSE;
- case '#':
- skipLine=TRUE;
- break;
- case 'C':
- case 'c':
- case '*':
- if (column==1) return TRUE;
- if (skipLine) break;
- return FALSE;
- case '!':
- if (column>1 && column<7) return FALSE;
- skipLine=TRUE;
- break;
- default:
- if (skipLine) break;
- if (column>=7) return TRUE;
- return FALSE;
- }
- }
- return FALSE;
-}
-
/* This function assumes that contents has at least size=length+1 */
static void insertCharacter(char *contents, int length, int pos, char c)
{
@@ -2687,6 +2644,9 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB
char *tmpBuf = NULL;
initParser(yyscanner);
+
+ if (fileBuf==0 || fileBuf[0]=='\0') return;
+
yyextra->defaultProtection = Public;
yyextra->inputString = fileBuf;
yyextra->inputPosition = 0;
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 9b33356..7cd6cf2 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -228,6 +228,7 @@ void GroupDefImpl::distributeMemberGroupDocumentation()
void GroupDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
MemberGroupSDict::Iterator mgli(*m_memberGroupSDict);
MemberGroup *mg;
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index ea2dffb..6f740ba 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -53,7 +50,7 @@ enum contexts_t
INTERDD, // 8
INTERTD // 9
};
-static const char *contexts[10] =
+static const char *contexts[10] =
{ "", // 0
"startli", // 1
"startdd", // 2
@@ -281,8 +278,8 @@ static QCString htmlAttribsToString(const HtmlAttribList &attribs, QCString *pAl
//-------------------------------------------------------------------------
HtmlDocVisitor::HtmlDocVisitor(FTextStream &t,CodeOutputInterface &ci,
- const Definition *ctx)
- : DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE),
+ const Definition *ctx)
+ : DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_hide(FALSE), m_ctx(ctx)
{
if (ctx) m_langExt=ctx->getDefFileExtension();
@@ -439,12 +436,12 @@ void HtmlDocVisitor::visit(DocStyleChange *s)
if (s->enable()) m_t << "<sup" << htmlAttribsToString(s->attribs()) << ">"; else m_t << "</sup>";
break;
case DocStyleChange::Center:
- if (s->enable())
+ if (s->enable())
{
forceEndParagraph(s);
- m_t << "<center" << htmlAttribsToString(s->attribs()) << ">";
+ m_t << "<center" << htmlAttribsToString(s->attribs()) << ">";
}
- else
+ else
{
m_t << "</center>";
forceStartParagraph(s);
@@ -468,12 +465,12 @@ void HtmlDocVisitor::visit(DocStyleChange *s)
}
break;
case DocStyleChange::Div:
- if (s->enable())
+ if (s->enable())
{
forceEndParagraph(s);
- m_t << "<div" << htmlAttribsToString(s->attribs()) << ">";
+ m_t << "<div" << htmlAttribsToString(s->attribs()) << ">";
}
- else
+ else
{
m_t << "</div>";
forceStartParagraph(s);
@@ -490,7 +487,7 @@ void HtmlDocVisitor::visit(DocStyleChange *s)
static void visitPreCaption(FTextStream &t, DocVerbatim *s)
{
if (s->hasCaption())
- {
+ {
t << "<div class=\"caption\">" << endl;
}
}
@@ -523,11 +520,10 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
SrcLangExt langExt = getLanguageFromFileName(lang);
switch(s->type())
{
- case DocVerbatim::Code:
+ case DocVerbatim::Code:
forceEndParagraph(s);
- m_t << PREFRAG_START;
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,
+ m_ci.startCodeFragment("DoxyCode");
+ getCodeParser(lang).parseCode(m_ci,
s->context(),
s->text(),
langExt,
@@ -541,14 +537,14 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
TRUE, // show line numbers
m_ctx // search context
);
- m_t << PREFRAG_END;
+ m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(s);
break;
- case DocVerbatim::Verbatim:
+ case DocVerbatim::Verbatim:
forceEndParagraph(s);
- m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">";
+ m_t << "<pre class=\"fragment\">";
filter(s->text());
- m_t << "</pre>" /*<< PREFRAG_END*/;
+ m_t << "</pre>";
forceStartParagraph(s);
break;
case DocVerbatim::HtmlOnly:
@@ -558,12 +554,12 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
if (s->isBlock()) forceStartParagraph(s);
}
break;
- case DocVerbatim::ManOnly:
- case DocVerbatim::LatexOnly:
- case DocVerbatim::XmlOnly:
+ case DocVerbatim::ManOnly:
+ case DocVerbatim::LatexOnly:
+ case DocVerbatim::XmlOnly:
case DocVerbatim::RtfOnly:
case DocVerbatim::DocbookOnly:
- /* nothing */
+ /* nothing */
break;
case DocVerbatim::Dot:
@@ -572,8 +568,8 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
QCString fileName(4096);
forceEndParagraph(s);
- fileName.sprintf("%s%d%s",
- (Config_getString(HTML_OUTPUT)+"/inline_dotgraph_").data(),
+ fileName.sprintf("%s%d%s",
+ (Config_getString(HTML_OUTPUT)+"/inline_dotgraph_").data(),
dotindex++,
".dot"
);
@@ -606,8 +602,8 @@ void HtmlDocVisitor::visit(DocVerbatim *s)
static int mscindex = 1;
QCString baseName(4096);
- baseName.sprintf("%s%d",
- (Config_getString(HTML_OUTPUT)+"/inline_mscgraph_").data(),
+ baseName.sprintf("%s%d",
+ (Config_getString(HTML_OUTPUT)+"/inline_mscgraph_").data(),
mscindex++
);
QFile file(baseName+".msc");
@@ -671,11 +667,10 @@ void HtmlDocVisitor::visit(DocInclude *inc)
SrcLangExt langExt = getLanguageFromFileName(inc->extension());
switch(inc->type())
{
- case DocInclude::Include:
+ case DocInclude::Include:
forceEndParagraph(inc);
- m_t << PREFRAG_START;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ m_ci.startCodeFragment("DoxyCode");
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
inc->text(),
langExt,
@@ -687,24 +682,23 @@ void HtmlDocVisitor::visit(DocInclude *inc)
TRUE, // inlineFragment
0, // memberDef
FALSE, // show line numbers
- m_ctx // search context
+ m_ctx // search context
);
- m_t << PREFRAG_END;
+ m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(inc);
break;
case DocInclude::IncWithLines:
- {
+ {
forceEndParagraph(inc);
- m_t << PREFRAG_START;
+ m_ci.startCodeFragment("DoxyCode");
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
inc->text(),
langExt,
inc->isExample(),
- inc->exampleFile(),
+ inc->exampleFile(),
fd, // fileDef,
-1, // start line
-1, // end line
@@ -714,7 +708,7 @@ void HtmlDocVisitor::visit(DocInclude *inc)
m_ctx // search context
);
delete fd;
- m_t << PREFRAG_END;
+ m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(inc);
}
break;
@@ -733,24 +727,23 @@ void HtmlDocVisitor::visit(DocInclude *inc)
if (inc->isBlock()) forceStartParagraph(inc);
}
break;
- case DocInclude::VerbInclude:
+ case DocInclude::VerbInclude:
forceEndParagraph(inc);
- m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">";
+ m_t << "<pre class=\"fragment\">";
filter(inc->text());
- m_t << "</pre>" /*<< PREFRAG_END*/;
+ m_t << "</pre>";
forceStartParagraph(inc);
break;
case DocInclude::Snippet:
{
forceEndParagraph(inc);
- m_t << PREFRAG_START;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ m_ci.startCodeFragment("DoxyCode");
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
inc->isExample(),
- inc->exampleFile(),
+ inc->exampleFile(),
0,
-1, // startLine
-1, // endLine
@@ -759,23 +752,22 @@ void HtmlDocVisitor::visit(DocInclude *inc)
FALSE, // show line number
m_ctx // search context
);
- m_t << PREFRAG_END;
+ m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(inc);
}
break;
case DocInclude::SnipWithLines:
{
forceEndParagraph(inc);
- m_t << PREFRAG_START;
+ m_ci.startCodeFragment("DoxyCode");
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
inc->isExample(),
- inc->exampleFile(),
+ inc->exampleFile(),
fd,
lineBlock(inc->text(),inc->blockId()),
-1, // endLine
@@ -785,12 +777,12 @@ void HtmlDocVisitor::visit(DocInclude *inc)
m_ctx // search context
);
delete fd;
- m_t << PREFRAG_END;
+ m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(inc);
}
break;
- case DocInclude::SnippetDoc:
- case DocInclude::IncludeDoc:
+ case DocInclude::SnippetDoc:
+ case DocInclude::IncludeDoc:
err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
"Please create a bug report\n",__FILE__);
break;
@@ -801,20 +793,20 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
{
//printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
// op->type(),op->isFirst(),op->isLast(),op->text().data());
- if (op->isFirst())
+ if (op->isFirst())
{
forceEndParagraph(op);
- if (!m_hide) m_t << PREFRAG_START;
+ if (!m_hide) m_ci.startCodeFragment("DoxyCode");
pushEnabled();
m_hide=TRUE;
}
QCString locLangExt = getFileNameExtension(op->includeFileName());
if (locLangExt.isEmpty()) locLangExt = m_langExt;
SrcLangExt langExt = getLanguageFromFileName(locLangExt);
- if (op->type()!=DocIncOperator::Skip)
+ if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
- if (!m_hide)
+ if (!m_hide)
{
FileDef *fd = 0;
if (!op->includeFileName().isEmpty())
@@ -822,8 +814,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
QFileInfo cfi( op->includeFileName() );
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(
+ getCodeParser(locLangExt).parseCode(
m_ci,
op->context(),
op->text(),
@@ -843,10 +834,10 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide=TRUE;
}
- if (op->isLast())
+ if (op->isLast())
{
popEnabled();
- if (!m_hide) m_t << PREFRAG_END;
+ if (!m_hide) m_ci.endCodeFragment("DoxyCode");
forceStartParagraph(op);
}
else
@@ -859,7 +850,7 @@ void HtmlDocVisitor::visit(DocFormula *f)
{
if (m_hide) return;
bool bDisplay = !f->isInline();
- if (bDisplay)
+ if (bDisplay)
{
forceEndParagraph(f);
m_t << "<p class=\"formulaDsp\">" << endl;
@@ -869,7 +860,7 @@ void HtmlDocVisitor::visit(DocFormula *f)
{
QCString text = f->text();
bool closeInline = FALSE;
- if (!bDisplay && !text.isEmpty() && text.at(0)=='$' &&
+ if (!bDisplay && !text.isEmpty() && text.at(0)=='$' &&
text.at(text.length()-1)=='$')
{
closeInline=TRUE;
@@ -884,7 +875,7 @@ void HtmlDocVisitor::visit(DocFormula *f)
}
else
{
- m_t << "<img class=\"formula"
+ m_t << "<img class=\"formula"
<< (bDisplay ? "Dsp" : "Inl");
m_t << "\" alt=\"";
filterQuotedCdataAttr(f->text());
@@ -919,7 +910,7 @@ void HtmlDocVisitor::visit(DocFormula *f)
void HtmlDocVisitor::visit(DocIndexEntry *e)
{
QCString anchor = convertIndexWordToAnchor(e->entry());
- if (e->member())
+ if (e->member())
{
anchor.prepend(e->member()->anchor()+"_");
}
@@ -941,7 +932,7 @@ void HtmlDocVisitor::visit(DocSimpleSectSep *)
void HtmlDocVisitor::visit(DocCite *cite)
{
if (m_hide) return;
- if (!cite->file().isEmpty())
+ if (!cite->file().isEmpty())
{
startLink(cite->ref(),cite->file(),cite->relPath(),cite->anchor());
}
@@ -950,7 +941,7 @@ void HtmlDocVisitor::visit(DocCite *cite)
m_t << "<b>[";
}
filter(cite->text());
- if (!cite->file().isEmpty())
+ if (!cite->file().isEmpty())
{
endLink();
}
@@ -978,7 +969,7 @@ void HtmlDocVisitor::visitPre(DocAutoList *l)
// 1.
// a.
// i.
- // A.
+ // A.
// 1. (repeat)...
//
m_t << "<ol type=\"" << types[l->depth() % NUM_HTML_LIST_TYPES] << "\"";
@@ -1013,20 +1004,20 @@ void HtmlDocVisitor::visitPre(DocAutoListItem *)
m_t << "<li>";
}
-void HtmlDocVisitor::visitPost(DocAutoListItem *li)
+void HtmlDocVisitor::visitPost(DocAutoListItem *li)
{
if (m_hide) return;
m_t << "</li>";
if (!li->isPreformatted()) m_t << "\n";
}
-template<class T>
+template<class T>
bool isFirstChildNode(T *parent, DocNode *node)
{
return parent->children().getFirst()==node;
}
-template<class T>
+template<class T>
bool isLastChildNode(T *parent, DocNode *node)
{
return parent->children().getLast()==node;
@@ -1070,7 +1061,7 @@ static int getParagraphContext(DocPara *p,bool &isFirst,bool &isLast)
isLast=FALSE;
if (p && p->parent())
{
- switch (p->parent()->kind())
+ switch (p->parent()->kind())
{
case DocNode::Kind_ParBlock:
{ // hierarchy: node N -> para -> parblock -> para
@@ -1215,7 +1206,7 @@ static int getParagraphContext(DocPara *p,bool &isFirst,bool &isLast)
return t;
}
-void HtmlDocVisitor::visitPre(DocPara *p)
+void HtmlDocVisitor::visitPre(DocPara *p)
{
if (m_hide) return;
@@ -1223,9 +1214,9 @@ void HtmlDocVisitor::visitPre(DocPara *p)
// p->parent() ? p->parent()->kind() : -1);
bool needsTag = FALSE;
- if (p && p->parent())
+ if (p && p->parent())
{
- switch (p->parent()->kind())
+ switch (p->parent()->kind())
{
case DocNode::Kind_Section:
case DocNode::Kind_Internal:
@@ -1250,7 +1241,7 @@ void HtmlDocVisitor::visitPre(DocPara *p)
}
// if the first element of a paragraph is something that should be outside of
- // the paragraph (<ul>,<dl>,<table>,..) then that will already started the
+ // the paragraph (<ul>,<dl>,<table>,..) then that will already started the
// paragraph and we don't need to do it here
bool paragraphAlreadyStarted = false;
uint nodeIndex = 0;
@@ -1296,9 +1287,9 @@ void HtmlDocVisitor::visitPost(DocPara *p)
// p->parent() ? p->parent()->kind() : -1);
bool needsTag = FALSE;
- if (p->parent())
+ if (p->parent())
{
- switch (p->parent()->kind())
+ switch (p->parent()->kind())
{
case DocNode::Kind_Section:
case DocNode::Kind_Internal:
@@ -1323,7 +1314,7 @@ void HtmlDocVisitor::visitPost(DocPara *p)
}
// if the last element of a paragraph is something that should be outside of
- // the paragraph (<ul>,<dl>,<table>) then that will already have ended the
+ // the paragraph (<ul>,<dl>,<table>) then that will already have ended the
// paragraph and we don't need to do it here
int nodeIndex = p->children().count()-1;
if (nodeIndex>=0)
@@ -1372,21 +1363,21 @@ void HtmlDocVisitor::visitPre(DocSimpleSect *s)
m_t << "<dl class=\"section " << s->typeString() << "\"><dt>";
switch(s->type())
{
- case DocSimpleSect::See:
+ case DocSimpleSect::See:
m_t << theTranslator->trSeeAlso(); break;
- case DocSimpleSect::Return:
+ case DocSimpleSect::Return:
m_t << theTranslator->trReturns(); break;
- case DocSimpleSect::Author:
+ case DocSimpleSect::Author:
m_t << theTranslator->trAuthor(TRUE,TRUE); break;
- case DocSimpleSect::Authors:
+ case DocSimpleSect::Authors:
m_t << theTranslator->trAuthor(TRUE,FALSE); break;
- case DocSimpleSect::Version:
+ case DocSimpleSect::Version:
m_t << theTranslator->trVersion(); break;
- case DocSimpleSect::Since:
+ case DocSimpleSect::Since:
m_t << theTranslator->trSince(); break;
- case DocSimpleSect::Date:
+ case DocSimpleSect::Date:
m_t << theTranslator->trDate(); break;
- case DocSimpleSect::Note:
+ case DocSimpleSect::Note:
m_t << theTranslator->trNote(); break;
case DocSimpleSect::Warning:
m_t << theTranslator->trWarning(); break;
@@ -1454,7 +1445,7 @@ void HtmlDocVisitor::visitPre(DocSimpleListItem *)
m_t << "<li>";
}
-void HtmlDocVisitor::visitPost(DocSimpleListItem *li)
+void HtmlDocVisitor::visitPost(DocSimpleListItem *li)
{
if (m_hide) return;
m_t << "</li>";
@@ -1472,7 +1463,7 @@ void HtmlDocVisitor::visitPre(DocSection *s)
m_t << "</h" << s->level() << ">\n";
}
-void HtmlDocVisitor::visitPost(DocSection *s)
+void HtmlDocVisitor::visitPost(DocSection *s)
{
forceStartParagraph(s);
}
@@ -1481,26 +1472,26 @@ void HtmlDocVisitor::visitPre(DocHtmlList *s)
{
if (m_hide) return;
forceEndParagraph(s);
- if (s->type()==DocHtmlList::Ordered)
+ if (s->type()==DocHtmlList::Ordered)
{
- m_t << "<ol" << htmlAttribsToString(s->attribs());
+ m_t << "<ol" << htmlAttribsToString(s->attribs());
}
- else
+ else
{
m_t << "<ul" << htmlAttribsToString(s->attribs());
}
m_t << getDirHtmlClassOfNode(getTextDirByConfig(s)) << ">\n";
}
-void HtmlDocVisitor::visitPost(DocHtmlList *s)
+void HtmlDocVisitor::visitPost(DocHtmlList *s)
{
if (m_hide) return;
- if (s->type()==DocHtmlList::Ordered)
+ if (s->type()==DocHtmlList::Ordered)
{
- m_t << "</ol>";
+ m_t << "</ol>";
}
else
- {
+ {
m_t << "</ul>";
}
if (!s->isPreformatted()) m_t << "\n";
@@ -1514,7 +1505,7 @@ void HtmlDocVisitor::visitPre(DocHtmlListItem *i)
if (!i->isPreformatted()) m_t << "\n";
}
-void HtmlDocVisitor::visitPost(DocHtmlListItem *)
+void HtmlDocVisitor::visitPost(DocHtmlListItem *)
{
if (m_hide) return;
m_t << "</li>\n";
@@ -1527,7 +1518,7 @@ void HtmlDocVisitor::visitPre(DocHtmlDescList *dl)
m_t << "<dl" << htmlAttribsToString(dl->attribs()) << ">\n";
}
-void HtmlDocVisitor::visitPost(DocHtmlDescList *dl)
+void HtmlDocVisitor::visitPost(DocHtmlDescList *dl)
{
if (m_hide) return;
m_t << "</dl>\n";
@@ -1542,7 +1533,7 @@ void HtmlDocVisitor::visitPre(DocHtmlDescTitle *dt)
<< ">";
}
-void HtmlDocVisitor::visitPost(DocHtmlDescTitle *)
+void HtmlDocVisitor::visitPost(DocHtmlDescTitle *)
{
if (m_hide) return;
m_t << "</dt>\n";
@@ -1551,12 +1542,12 @@ void HtmlDocVisitor::visitPost(DocHtmlDescTitle *)
void HtmlDocVisitor::visitPre(DocHtmlDescData *dd)
{
if (m_hide) return;
- m_t << "<dd" << htmlAttribsToString(dd->attribs())
+ m_t << "<dd" << htmlAttribsToString(dd->attribs())
<< getDirHtmlClassOfNode(getTextDirByConfig(dd))
<< ">";
}
-void HtmlDocVisitor::visitPost(DocHtmlDescData *)
+void HtmlDocVisitor::visitPost(DocHtmlDescData *)
{
if (m_hide) return;
m_t << "</dd>\n";
@@ -1598,7 +1589,7 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t)
}
}
-void HtmlDocVisitor::visitPost(DocHtmlTable *t)
+void HtmlDocVisitor::visitPost(DocHtmlTable *t)
{
if (m_hide) return;
m_t << "</table>\n";
@@ -1611,7 +1602,7 @@ void HtmlDocVisitor::visitPre(DocHtmlRow *tr)
m_t << "<tr" << htmlAttribsToString(tr->attribs()) << ">\n";
}
-void HtmlDocVisitor::visitPost(DocHtmlRow *)
+void HtmlDocVisitor::visitPost(DocHtmlRow *)
{
if (m_hide) return;
m_t << "</tr>\n";
@@ -1620,17 +1611,17 @@ void HtmlDocVisitor::visitPost(DocHtmlRow *)
void HtmlDocVisitor::visitPre(DocHtmlCell *c)
{
if (m_hide) return;
- if (c->isHeading())
+ if (c->isHeading())
{
- m_t << "<th" << htmlAttribsToString(c->attribs()) << ">";
+ m_t << "<th" << htmlAttribsToString(c->attribs()) << ">";
}
- else
+ else
{
m_t << "<td" << htmlAttribsToString(c->attribs()) << ">";
}
}
-void HtmlDocVisitor::visitPost(DocHtmlCell *c)
+void HtmlDocVisitor::visitPost(DocHtmlCell *c)
{
if (m_hide) return;
if (c->isHeading()) m_t << "</th>"; else m_t << "</td>";
@@ -1642,7 +1633,7 @@ void HtmlDocVisitor::visitPre(DocHtmlCaption *c)
m_t << "<caption" << htmlAttribsToString(c->attribs()) << ">";
}
-void HtmlDocVisitor::visitPost(DocHtmlCaption *)
+void HtmlDocVisitor::visitPost(DocHtmlCaption *)
{
if (m_hide) return;
m_t << "</caption>\n";
@@ -1655,7 +1646,7 @@ void HtmlDocVisitor::visitPre(DocInternal *)
//m_t << "<p><b>" << theTranslator->trForInternalUseOnly() << "</b></p>" << endl;
}
-void HtmlDocVisitor::visitPost(DocInternal *)
+void HtmlDocVisitor::visitPost(DocInternal *)
{
if (m_hide) return;
//forceStartParagraph(i);
@@ -1676,7 +1667,7 @@ void HtmlDocVisitor::visitPre(DocHRef *href)
}
}
-void HtmlDocVisitor::visitPost(DocHRef *)
+void HtmlDocVisitor::visitPost(DocHRef *)
{
if (m_hide) return;
m_t << "</a>";
@@ -1686,13 +1677,13 @@ void HtmlDocVisitor::visitPre(DocHtmlHeader *header)
{
if (m_hide) return;
forceEndParagraph(header);
- m_t << "<h" << header->level()
- << htmlAttribsToString(header->attribs())
+ m_t << "<h" << header->level()
+ << htmlAttribsToString(header->attribs())
<< getDirHtmlClassOfNode(getTextDirByConfig(header))
<< ">";
}
-void HtmlDocVisitor::visitPost(DocHtmlHeader *header)
+void HtmlDocVisitor::visitPost(DocHtmlHeader *header)
{
if (m_hide) return;
m_t << "</h" << header->level() << ">\n";
@@ -1834,12 +1825,12 @@ void HtmlDocVisitor::visitPre(DocDotFile *df)
m_t << "<div class=\"dotgraph\">" << endl;
writeDotFile(df->file(),df->relPath(),df->context());
if (df->hasCaption())
- {
+ {
m_t << "<div class=\"caption\">" << endl;
}
}
-void HtmlDocVisitor::visitPost(DocDotFile *df)
+void HtmlDocVisitor::visitPost(DocDotFile *df)
{
if (m_hide) return;
if (df->hasCaption())
@@ -1855,11 +1846,11 @@ void HtmlDocVisitor::visitPre(DocMscFile *df)
m_t << "<div class=\"mscgraph\">" << endl;
writeMscFile(df->file(),df->relPath(),df->context());
if (df->hasCaption())
- {
+ {
m_t << "<div class=\"caption\">" << endl;
}
}
-void HtmlDocVisitor::visitPost(DocMscFile *df)
+void HtmlDocVisitor::visitPost(DocMscFile *df)
{
if (m_hide) return;
if (df->hasCaption())
@@ -1895,7 +1886,7 @@ void HtmlDocVisitor::visitPre(DocLink *lnk)
startLink(lnk->ref(),lnk->file(),lnk->relPath(),lnk->anchor());
}
-void HtmlDocVisitor::visitPost(DocLink *)
+void HtmlDocVisitor::visitPost(DocLink *)
{
if (m_hide) return;
endLink();
@@ -1904,7 +1895,7 @@ void HtmlDocVisitor::visitPost(DocLink *)
void HtmlDocVisitor::visitPre(DocRef *ref)
{
if (m_hide) return;
- if (!ref->file().isEmpty())
+ if (!ref->file().isEmpty())
{
// when ref->isSubPage()==TRUE we use ref->file() for HTML and
// ref->anchor() for LaTeX/RTF
@@ -1913,7 +1904,7 @@ void HtmlDocVisitor::visitPre(DocRef *ref)
if (!ref->hasLinkText()) filter(ref->targetTitle());
}
-void HtmlDocVisitor::visitPost(DocRef *ref)
+void HtmlDocVisitor::visitPost(DocRef *ref)
{
if (m_hide) return;
if (!ref->file().isEmpty()) endLink();
@@ -1928,7 +1919,7 @@ void HtmlDocVisitor::visitPre(DocSecRefItem *ref)
}
-void HtmlDocVisitor::visitPost(DocSecRefItem *)
+void HtmlDocVisitor::visitPost(DocSecRefItem *)
{
if (m_hide) return;
m_t << "</a></li>\n";
@@ -1942,7 +1933,7 @@ void HtmlDocVisitor::visitPre(DocSecRefList *s)
m_t << "<ul class=\"multicol\">" << endl;
}
-void HtmlDocVisitor::visitPost(DocSecRefList *s)
+void HtmlDocVisitor::visitPost(DocSecRefList *s)
{
if (m_hide) return;
m_t << "</ul>" << endl;
@@ -1960,7 +1951,7 @@ void HtmlDocVisitor::visitPost(DocSecRefList *s)
// }
//}
//
-//void HtmlDocVisitor::visitPost(DocLanguage *l)
+//void HtmlDocVisitor::visitPost(DocLanguage *l)
//{
// QCString langId = Config_getEnum(OUTPUT_LANGUAGE);
// if (l->id().lower()!=langId.lower())
@@ -1977,19 +1968,19 @@ void HtmlDocVisitor::visitPre(DocParamSect *s)
QCString heading;
switch(s->type())
{
- case DocParamSect::Param:
- heading=theTranslator->trParameters();
+ case DocParamSect::Param:
+ heading=theTranslator->trParameters();
className="params";
break;
- case DocParamSect::RetVal:
- heading=theTranslator->trReturnValues();
+ case DocParamSect::RetVal:
+ heading=theTranslator->trReturnValues();
className="retval";
break;
- case DocParamSect::Exception:
- heading=theTranslator->trExceptions();
+ case DocParamSect::Exception:
+ heading=theTranslator->trExceptions();
className="exception";
break;
- case DocParamSect::TemplateParam:
+ case DocParamSect::TemplateParam:
heading=theTranslator->trTemplateParameters();
className="tparams";
break;
@@ -2052,11 +2043,11 @@ void HtmlDocVisitor::visitPre(DocParamList *pl)
{
if (type->kind()==DocNode::Kind_Word)
{
- visit((DocWord*)type);
+ visit((DocWord*)type);
}
else if (type->kind()==DocNode::Kind_LinkedWord)
{
- visit((DocLinkedWord*)type);
+ visit((DocLinkedWord*)type);
}
else if (type->kind()==DocNode::Kind_Sep)
{
@@ -2076,11 +2067,11 @@ void HtmlDocVisitor::visitPre(DocParamList *pl)
if (!first) m_t << ","; else first=FALSE;
if (param->kind()==DocNode::Kind_Word)
{
- visit((DocWord*)param);
+ visit((DocWord*)param);
}
else if (param->kind()==DocNode::Kind_LinkedWord)
{
- visit((DocLinkedWord*)param);
+ visit((DocLinkedWord*)param);
}
}
m_t << "</td><td>";
@@ -2102,12 +2093,12 @@ void HtmlDocVisitor::visitPre(DocXRefItem *x)
bool anonymousEnum = x->file()=="@";
if (!anonymousEnum)
{
- m_t << "<dl" << getDirHtmlClassOfNode(getTextDirByConfig(x), x->key())
+ m_t << "<dl" << getDirHtmlClassOfNode(getTextDirByConfig(x), x->key())
<< "><dt><b><a class=\"el\" href=\""
<< x->relPath() << addHtmlExtensionIfMissing(x->file())
<< "#" << x->anchor() << "\">";
}
- else
+ else
{
m_t << "<dl class=\"" << x->key() << "\"><dt><b>";
}
@@ -2131,7 +2122,7 @@ void HtmlDocVisitor::visitPre(DocInternalRef *ref)
startLink(0,ref->file(),ref->relPath(),ref->anchor());
}
-void HtmlDocVisitor::visitPost(DocInternalRef *)
+void HtmlDocVisitor::visitPost(DocInternalRef *)
{
if (m_hide) return;
endLink();
@@ -2180,7 +2171,7 @@ void HtmlDocVisitor::visitPre(DocVhdlFlow *vf)
m_t << "<p>";
m_t << "flowchart: " ; // TODO: translate me
m_t << "<a href=\"";
- m_t << fname.data();
+ m_t << fname.data();
m_t << ".svg\">";
m_t << VhdlDocGen::getFlowMember()->name().data();
m_t << "</a>";
@@ -2214,7 +2205,7 @@ void HtmlDocVisitor::visitPost(DocParBlock *)
void HtmlDocVisitor::filter(const char *str)
-{
+{
if (str==0) return;
const char *p=str;
char c;
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 601c02e..ea4d895 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -16,8 +16,10 @@
*/
#include <stdlib.h>
-
#include <assert.h>
+
+#include <mutex>
+
#include <qdir.h>
#include <qregexp.h>
#include "message.h"
@@ -59,8 +61,6 @@ static QCString g_footer;
static QCString g_mathjax_code;
static QCString g_latex_macro;
-static bool DoxyCodeLineOpen = FALSE;
-
// note: this is only active if DISABLE_INDEX=YES, if DISABLE_INDEX is disabled, this
// part will be rendered inside menu.js
static void writeClientSearchBox(FTextStream &t,const char *relPath)
@@ -608,12 +608,11 @@ static QCString substituteHtmlKeywords(const QCString &str,
//--------------------------------------------------------------------------
HtmlCodeGenerator::HtmlCodeGenerator()
- : m_streamSet(FALSE), m_col(0)
{
}
HtmlCodeGenerator::HtmlCodeGenerator(FTextStream &t,const QCString &relPath)
- : m_col(0), m_relPath(relPath)
+ : m_relPath(relPath)
{
setTextStream(t);
}
@@ -726,10 +725,10 @@ void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename,
qsnprintf(lineNumber,maxLineNrStr,"%5d",l);
qsnprintf(lineAnchor,maxLineNrStr,"l%05d",l);
- if (!DoxyCodeLineOpen)
+ if (!m_lineOpen)
{
m_t << "<div class=\"line\">";
- DoxyCodeLineOpen = TRUE;
+ m_lineOpen = TRUE;
}
m_t << "<a name=\"" << lineAnchor << "\"></a><span class=\"lineno\">";
@@ -868,10 +867,10 @@ void HtmlCodeGenerator::startCodeLine(bool)
if (m_streamSet)
{
m_col=0;
- if (!DoxyCodeLineOpen)
+ if (!m_lineOpen)
{
m_t << "<div class=\"line\">";
- DoxyCodeLineOpen = TRUE;
+ m_lineOpen = TRUE;
}
}
}
@@ -885,10 +884,10 @@ void HtmlCodeGenerator::endCodeLine()
m_t << " ";
m_col++;
}
- if (DoxyCodeLineOpen)
+ if (m_lineOpen)
{
m_t << "</div>\n";
- DoxyCodeLineOpen = FALSE;
+ m_lineOpen = FALSE;
}
}
}
@@ -908,6 +907,20 @@ void HtmlCodeGenerator::writeCodeAnchor(const char *anchor)
if (m_streamSet) m_t << "<a name=\"" << anchor << "\"></a>";
}
+void HtmlCodeGenerator::startCodeFragment(const char *)
+{
+ if (m_streamSet) m_t << "<div class=\"fragment\">";
+}
+
+void HtmlCodeGenerator::endCodeFragment(const char *)
+{
+ //endCodeLine checks is there is still an open code line, if so closes it.
+ endCodeLine();
+
+ if (m_streamSet) m_t << "</div><!-- fragment -->";
+}
+
+
//--------------------------------------------------------------------------
HtmlGenerator::HtmlGenerator() : OutputGenerator(Config_getString(HTML_OUTPUT))
@@ -1114,6 +1127,8 @@ void HtmlGenerator::writeFooterFile(QFile &file)
t << ResourceMgr::instance().getAsString("footer.html");
}
+static std::mutex g_indexLock;
+
void HtmlGenerator::startFile(const char *name,const char *,
const char *title)
{
@@ -1125,7 +1140,10 @@ void HtmlGenerator::startFile(const char *name,const char *,
startPlainFile(fileName);
m_codeGen.setTextStream(t);
m_codeGen.setRelativePath(m_relPath);
- Doxygen::indexList->addIndexFile(fileName);
+ {
+ std::lock_guard<std::mutex> lock(g_indexLock);
+ Doxygen::indexList->addIndexFile(fileName);
+ }
m_lastFile = fileName;
t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),m_relPath);
@@ -1139,7 +1157,7 @@ void HtmlGenerator::startFile(const char *name,const char *,
t << "<script type=\"text/javascript\">\n";
t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */\n";
t << "var searchBox = new SearchBox(\"searchBox\", \""
- << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "');\n";
+ << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n";
t << "/* @license-end */\n";
t << "</script>\n";
}
@@ -2674,7 +2692,7 @@ void HtmlGenerator::writeSearchPage()
t << "<script type=\"text/javascript\">\n";
t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */\n";
t << "var searchBox = new SearchBox(\"searchBox\", \""
- << "search\",false,'" << theTranslator->trSearch() << "');\n";
+ << "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n";
t << "/* @license-end */\n";
t << "</script>\n";
if (!Config_getBool(DISABLE_INDEX))
@@ -2728,7 +2746,7 @@ void HtmlGenerator::writeExternalSearchPage()
t << "<script type=\"text/javascript\">\n";
t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */\n";
t << "var searchBox = new SearchBox(\"searchBox\", \""
- << "search\",false,'" << theTranslator->trSearch() << "');\n";
+ << "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n";
t << "/* @license-end */\n";
t << "</script>\n";
if (!Config_getBool(DISABLE_INDEX))
@@ -2861,19 +2879,6 @@ void HtmlGenerator::endConstraintList()
t << "</div>" << endl;
}
-void HtmlGenerator::startCodeFragment()
-{
- t << PREFRAG_START;
-}
-
-void HtmlGenerator::endCodeFragment()
-{
- //endCodeLine checks is there is still an open code line, if so closes it.
- endCodeLine();
-
- t << PREFRAG_END;
-}
-
void HtmlGenerator::lineBreak(const char *style)
{
if (style)
diff --git a/src/htmlgen.h b/src/htmlgen.h
index 9487e60..45899a6 100644
--- a/src/htmlgen.h
+++ b/src/htmlgen.h
@@ -1,8 +1,6 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -21,11 +19,6 @@
#include "outputgen.h"
#include "ftextstream.h"
-//#define PREFRAG_START "<div class=\"fragment\"><pre class=\"fragment\">"
-//#define PREFRAG_END "</pre></div>"
-#define PREFRAG_START "<div class=\"fragment\">"
-#define PREFRAG_END "</div><!-- fragment -->"
-
class QFile;
class HtmlCodeGenerator : public CodeOutputInterface
@@ -54,6 +47,8 @@ class HtmlCodeGenerator : public CodeOutputInterface
void writeCodeAnchor(const char *anchor);
void setCurrentDoc(const Definition *,const char *,bool) {}
void addWord(const char *,bool) {}
+ void startCodeFragment(const char *style);
+ void endCodeFragment(const char *);
private:
void _writeCodeLink(const char *className,
@@ -61,10 +56,11 @@ class HtmlCodeGenerator : public CodeOutputInterface
const char *anchor,const char *name,
const char *tooltip);
void docify(const char *str);
- bool m_streamSet;
+ bool m_streamSet = false;
FTextStream m_t;
- int m_col;
+ int m_col = 0;
QCString m_relPath;
+ bool m_lineOpen = false;
};
/** Generator for HTML output */
@@ -113,6 +109,10 @@ class HtmlGenerator : public OutputGenerator
{ m_codeGen.endFontClass(); }
void writeCodeAnchor(const char *anchor)
{ m_codeGen.writeCodeAnchor(anchor); }
+ void startCodeFragment(const char *style)
+ { m_codeGen.startCodeFragment(style); }
+ void endCodeFragment(const char *style)
+ { m_codeGen.endCodeFragment(style); }
// ---------------------------
void setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile);
@@ -208,8 +208,6 @@ class HtmlGenerator : public OutputGenerator
void writeRuler() { t << "<hr/>"; }
void writeAnchor(const char *,const char *name)
{ t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; }
- void startCodeFragment();
- void endCodeFragment();
void startEmphasis() { t << "<em>"; }
void endEmphasis() { t << "</em>"; }
void startBold() { t << "<b>"; }
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 19f01b0..fbb6530 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -175,7 +175,7 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s)
}
-LatexDocVisitor::LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci,
+LatexDocVisitor::LatexDocVisitor(FTextStream &t,LatexCodeGenerator &ci,
const char *langExt,bool insideTabbing)
: DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_insideItem(FALSE), m_hide(FALSE), m_hideCaption(FALSE), m_insideTabbing(insideTabbing),
@@ -351,13 +351,10 @@ void LatexDocVisitor::visit(DocVerbatim *s)
{
case DocVerbatim::Code:
{
- m_t << "\n\\begin{DoxyCode}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,s->context(),s->text(),langExt,
- s->isExample(),s->exampleFile());
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- m_t << "\\end{DoxyCode}\n";
+ m_ci.startCodeFragment("DoxyCode");
+ getCodeParser(lang).parseCode(m_ci,s->context(),s->text(),langExt,
+ s->isExample(),s->exampleFile());
+ m_ci.endCodeFragment("DoxyCode");
}
break;
case DocVerbatim::Verbatim:
@@ -461,44 +458,40 @@ void LatexDocVisitor::visit(DocInclude *inc)
{
case DocInclude::IncWithLines:
{
- m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
- QFileInfo cfi( inc->file() );
- FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
- inc->text(),
- langExt,
- inc->isExample(),
- inc->exampleFile(),
- fd, // fileDef,
- -1, // start line
- -1, // end line
- FALSE, // inline fragment
- 0, // memberDef
- TRUE // show line numbers
- );
- delete fd;
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- m_t << "\\end{DoxyCodeInclude}" << endl;
+ m_ci.startCodeFragment("DoxyCodeInclude");
+ QFileInfo cfi( inc->file() );
+ FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
+ inc->text(),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile(),
+ fd, // fileDef,
+ -1, // start line
+ -1, // end line
+ FALSE, // inline fragment
+ 0, // memberDef
+ TRUE // show line numbers
+ );
+ delete fd;
+ m_ci.endCodeFragment("DoxyCodeInclude");
}
break;
case DocInclude::Include:
- m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
- inc->text(),langExt,inc->isExample(),
- inc->exampleFile(),
- 0, // fileDef
- -1, // startLine
- -1, // endLine
- TRUE, // inlineFragment
- 0, // memberDef
- FALSE
- );
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- m_t << "\\end{DoxyCodeInclude}\n";
+ {
+ m_ci.startCodeFragment("DoxyCodeInclude");
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
+ inc->text(),langExt,inc->isExample(),
+ inc->exampleFile(),
+ 0, // fileDef
+ -1, // startLine
+ -1, // endLine
+ TRUE, // inlineFragment
+ 0, // memberDef
+ FALSE
+ );
+ m_ci.endCodeFragment("DoxyCodeInclude");
+ }
break;
case DocInclude::DontInclude:
case DocInclude::DontIncWithLines:
@@ -518,43 +511,37 @@ void LatexDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::Snippet:
{
- m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
- inc->context(),
- extractBlock(inc->text(),inc->blockId()),
- langExt,
- inc->isExample(),
- inc->exampleFile()
- );
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- m_t << "\\end{DoxyCodeInclude}" << endl;
+ m_ci.startCodeFragment("DoxyCodeInclude");
+ getCodeParser(inc->extension()).parseCode(m_ci,
+ inc->context(),
+ extractBlock(inc->text(),inc->blockId()),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile()
+ );
+ m_ci.endCodeFragment("DoxyCodeInclude");
}
break;
case DocInclude::SnipWithLines:
{
- QFileInfo cfi( inc->file() );
- FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
- inc->context(),
- extractBlock(inc->text(),inc->blockId()),
- langExt,
- inc->isExample(),
- inc->exampleFile(),
- fd,
- lineBlock(inc->text(),inc->blockId()),
- -1, // endLine
- FALSE, // inlineFragment
- 0, // memberDef
- TRUE // show line number
- );
- delete fd;
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- m_t << "\\end{DoxyCodeInclude}" << endl;
+ QFileInfo cfi( inc->file() );
+ FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
+ m_ci.startCodeFragment("DoxyCodeInclude");
+ getCodeParser(inc->extension()).parseCode(m_ci,
+ inc->context(),
+ extractBlock(inc->text(),inc->blockId()),
+ langExt,
+ inc->isExample(),
+ inc->exampleFile(),
+ fd,
+ lineBlock(inc->text(),inc->blockId()),
+ -1, // endLine
+ FALSE, // inlineFragment
+ 0, // memberDef
+ TRUE // show line number
+ );
+ delete fd;
+ m_ci.endCodeFragment("DoxyCodeInclude");
}
break;
case DocInclude::SnippetDoc:
@@ -571,8 +558,7 @@ void LatexDocVisitor::visit(DocIncOperator *op)
// op->type(),op->isFirst(),op->isLast(),op->text().data());
if (op->isFirst())
{
- if (!m_hide) m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n";
- LatexCodeGenerator::setDoxyCodeOpen(TRUE);
+ if (!m_hide) m_ci.startCodeFragment("DoxyCodeInclude");
pushEnabled();
m_hide = TRUE;
}
@@ -591,16 +577,15 @@ void LatexDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),op->text(),langExt,
- op->isExample(),op->exampleFile(),
- fd, // fileDef
- op->line(), // startLine
- -1, // endLine
- FALSE, // inline fragment
- 0, // memberDef
- op->showLineNo() // show line numbers
- );
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),op->text(),langExt,
+ op->isExample(),op->exampleFile(),
+ fd, // fileDef
+ op->line(), // startLine
+ -1, // endLine
+ FALSE, // inline fragment
+ 0, // memberDef
+ op->showLineNo() // show line numbers
+ );
if (fd) delete fd;
}
pushEnabled();
@@ -609,8 +594,7 @@ void LatexDocVisitor::visit(DocIncOperator *op)
if (op->isLast())
{
popEnabled();
- LatexCodeGenerator::setDoxyCodeOpen(FALSE);
- if (!m_hide) m_t << "\n\\end{DoxyCodeInclude}\n";
+ if (!m_hide) m_ci.endCodeFragment("DoxyCodeInclude");
}
else
{
@@ -1504,7 +1488,7 @@ void LatexDocVisitor::visitPre(DocParamSect *s)
if (m_hide) return;
bool hasInOutSpecs = s->hasInOutSpecifier();
bool hasTypeSpecs = s->hasTypeSpecifier();
- incUsedTableLevels();
+ m_ci.incUsedTableLevel();
switch(s->type())
{
case DocParamSect::Param:
@@ -1535,7 +1519,7 @@ void LatexDocVisitor::visitPre(DocParamSect *s)
void LatexDocVisitor::visitPost(DocParamSect *s)
{
if (m_hide) return;
- decUsedTableLevels();
+ m_ci.decUsedTableLevel();
switch(s->type())
{
case DocParamSect::Param:
@@ -1754,7 +1738,13 @@ void LatexDocVisitor::visitPost(DocParBlock *)
void LatexDocVisitor::filter(const char *str)
{
- filterLatexString(m_t,str,m_insideTabbing,m_insidePre,m_insideItem);
+ filterLatexString(m_t,str,
+ m_insideTabbing,
+ m_insidePre,
+ m_insideItem,
+ m_ci.usedTableLevel()>0, // insideTable
+ false // keepSpaces
+ );
}
void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor,bool refToTable)
diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h
index 71fb5be..003d780 100644
--- a/src/latexdocvisitor.h
+++ b/src/latexdocvisitor.h
@@ -1,13 +1,13 @@
/******************************************************************************
*
- *
+ *
*
*
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -25,19 +25,19 @@
#include <qlist.h>
class FTextStream;
-class CodeOutputInterface;
+class LatexCodeGenerator;
/*! @brief Concrete visitor implementation for LaTeX output. */
class LatexDocVisitor : public DocVisitor
{
public:
- LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci,
+ LatexDocVisitor(FTextStream &t,LatexCodeGenerator &ci,
const char *langExt,bool insideTabbing);
-
+
//--------------------------------------
// visitor functions for leaf nodes
//--------------------------------------
-
+
void visit(DocWord *);
void visit(DocLinkedWord *);
void visit(DocWhiteSpace *);
@@ -59,7 +59,7 @@ class LatexDocVisitor : public DocVisitor
//--------------------------------------
// visitor functions for compound nodes
//--------------------------------------
-
+
void visitPre(DocAutoList *);
void visitPost(DocAutoList *);
void visitPre(DocAutoListItem *);
@@ -141,7 +141,7 @@ class LatexDocVisitor : public DocVisitor
struct ActiveRowSpan
{
- ActiveRowSpan(DocHtmlCell *c,int rs,int cs,int col)
+ ActiveRowSpan(DocHtmlCell *c,int rs,int cs,int col)
: cell(c), rowSpan(rs), colSpan(cs), column(col) {}
DocHtmlCell *cell;
int rowSpan;
@@ -152,9 +152,9 @@ class LatexDocVisitor : public DocVisitor
typedef QList<ActiveRowSpan> RowSpanList;
//--------------------------------------
- // helper functions
+ // helper functions
//--------------------------------------
-
+
void filter(const char *str);
void startLink(const QCString &ref,const QCString &file,
const QCString &anchor,bool refToTable=FALSE);
@@ -184,7 +184,7 @@ class LatexDocVisitor : public DocVisitor
//--------------------------------------
FTextStream &m_t;
- CodeOutputInterface &m_ci;
+ LatexCodeGenerator &m_ci;
bool m_insidePre;
bool m_insideItem;
bool m_hide;
@@ -195,7 +195,7 @@ class LatexDocVisitor : public DocVisitor
struct TableState
{
- TableState() : numCols(0), currentColumn(0), inRowSpan(FALSE),
+ TableState() : numCols(0), currentColumn(0), inRowSpan(FALSE),
inColSpan(FALSE), firstRow(FALSE)
{ rowSpans.setAutoDelete(TRUE); }
RowSpanList rowSpans;
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index b70f82a..3343c1a 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -44,18 +44,14 @@
#include "resourcemgr.h"
#include "portable.h"
-static bool DoxyCodeOpen = FALSE;
-static bool DoxyCodeLineOpen = FALSE;
-//-------------------------------
-
LatexCodeGenerator::LatexCodeGenerator(FTextStream &t,const QCString &relPath,const QCString &sourceFileName)
- : m_relPath(relPath), m_sourceFileName(sourceFileName), m_col(0)
+ : m_relPath(relPath), m_sourceFileName(sourceFileName)
{
m_prettyCode=Config_getBool(LATEX_SOURCE_CODE);
setTextStream(t);
}
-LatexCodeGenerator::LatexCodeGenerator() : m_streamSet(FALSE), m_col(0)
+LatexCodeGenerator::LatexCodeGenerator()
{
m_prettyCode=Config_getBool(LATEX_SOURCE_CODE);
}
@@ -85,8 +81,8 @@ void LatexCodeGenerator::codify(const char *str)
//char cs[5];
int spacesToNextTabStop;
int tabSize = Config_getInt(TAB_SIZE);
- static signed char *result = NULL;
- static int lresult = 0;
+ static THREAD_LOCAL signed char *result = NULL;
+ static THREAD_LOCAL int lresult = 0;
int i;
while ((c=*p))
{
@@ -108,7 +104,9 @@ void LatexCodeGenerator::codify(const char *str)
m_col+=spacesToNextTabStop;
p++;
break;
- case '\n': (usedTableLevels()>0 && !DoxyCodeOpen) ? m_t << "\\newline\n" : m_t << '\n'; m_col=0; p++;
+ case '\n': m_t << '\n';
+ m_col=0;
+ p++;
break;
default:
i=0;
@@ -149,14 +147,13 @@ void LatexCodeGenerator::codify(const char *str)
COPYCHAR();
}
result[i]=0; // add terminator
- //if (m_prettyCode)
- //{
- filterLatexString(m_t,(const char *)result,FALSE,TRUE);
- //}
- //else
- //{
- // t << result;
- //}
+ filterLatexString(m_t,(const char *)result,
+ false, // insideTabbing
+ true, // insidePre
+ false, // insideItem
+ m_usedTableLevel>0, // insideTable
+ false // keepSpaces
+ );
break;
}
}
@@ -192,10 +189,10 @@ void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,co
{
bool usePDFLatex = Config_getBool(USE_PDFLATEX);
bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
- if (!DoxyCodeLineOpen)
+ if (!m_doxyCodeLineOpen)
{
m_t << "\\DoxyCodeLine{";
- DoxyCodeLineOpen = TRUE;
+ m_doxyCodeLineOpen = TRUE;
}
if (m_prettyCode)
{
@@ -231,19 +228,19 @@ void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,co
void LatexCodeGenerator::startCodeLine(bool)
{
m_col=0;
- if (!DoxyCodeLineOpen)
+ if (!m_doxyCodeLineOpen)
{
m_t << "\\DoxyCodeLine{";
- DoxyCodeLineOpen = TRUE;
+ m_doxyCodeLineOpen = TRUE;
}
}
void LatexCodeGenerator::endCodeLine()
{
- if (DoxyCodeLineOpen)
+ if (m_doxyCodeLineOpen)
{
m_t << "}";
- DoxyCodeLineOpen = FALSE;
+ m_doxyCodeLineOpen = FALSE;
}
codify("\n");
}
@@ -258,11 +255,20 @@ void LatexCodeGenerator::endFontClass()
m_t << "}";
}
-void LatexCodeGenerator::setDoxyCodeOpen(bool val)
+void LatexCodeGenerator::startCodeFragment(const char *style)
+{
+ m_t << "\n\\begin{" << style << "}{" << m_usedTableLevel << "}\n";
+}
+
+void LatexCodeGenerator::endCodeFragment(const char *style)
{
- DoxyCodeOpen = val;
+ //endCodeLine checks is there is still an open code line, if so closes it.
+ endCodeLine();
+
+ m_t << "\\end{" << style << "}\n";
}
+
//-------------------------------
LatexGenerator::LatexGenerator() : OutputGenerator(Config_getString(LATEX_OUTPUT))
@@ -650,7 +656,13 @@ static void writeDefaultHeaderPart1(FTextStream &t)
{
generatedBy = theTranslator->trGeneratedBy();
}
- filterLatexString(tg, generatedBy, FALSE,FALSE,FALSE);
+ filterLatexString(tg, generatedBy,
+ false, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ false, // insideTable
+ false // keepSpaces
+ );
t << "% Headers & footers\n"
"\\usepackage{fancyhdr}\n"
"\\pagestyle{fancyplain}\n"
@@ -1823,7 +1835,13 @@ void LatexGenerator::endSection(const char *lab,SectionType)
void LatexGenerator::docify(const char *str)
{
- filterLatexString(t,str,m_insideTabbing,FALSE,FALSE);
+ filterLatexString(t,str,
+ m_insideTabbing, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ m_codeGen.usedTableLevel()>0, // insideTable
+ false // keepSpaces
+ );
}
void LatexGenerator::writeChar(char c)
@@ -1960,13 +1978,13 @@ void LatexGenerator::writeNonBreakableSpace(int)
void LatexGenerator::startDescTable(const char *title)
{
- incUsedTableLevels();
+ m_codeGen.incUsedTableLevel();
t << "\\begin{DoxyEnumFields}{" << title << "}" << endl;
}
void LatexGenerator::endDescTable()
{
- decUsedTableLevels();
+ m_codeGen.decUsedTableLevel();
t << "\\end{DoxyEnumFields}" << endl;
}
@@ -2214,7 +2232,7 @@ void LatexGenerator::exceptionEntry(const char* prefix,bool closeBracket)
void LatexGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *)
{
LatexDocVisitor *visitor =
- new LatexDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString(""),m_insideTabbing);
+ new LatexDocVisitor(t,m_codeGen,ctx?ctx->getDefFileExtension():QCString(""),m_insideTabbing);
n->accept(visitor);
delete visitor;
}
@@ -2260,21 +2278,6 @@ void LatexGenerator::endConstraintList()
t << "\\end{Desc}" << endl;
}
-void LatexGenerator::startCodeFragment()
-{
- t << "\n\\begin{DoxyCode}{" << usedTableLevels() << "}\n";
- DoxyCodeOpen = TRUE;
-}
-
-void LatexGenerator::endCodeFragment()
-{
- //endCodeLine checks is there is still an open code line, if so closes it.
- endCodeLine();
-
- t << "\\end{DoxyCode}\n";
- DoxyCodeOpen = FALSE;
-}
-
void LatexGenerator::startInlineHeader()
{
if (Config_getBool(COMPACT_LATEX))
@@ -2306,7 +2309,7 @@ void LatexGenerator::lineBreak(const char *)
void LatexGenerator::startMemberDocSimple(bool isEnum)
{
- incUsedTableLevels();
+ m_codeGen.incUsedTableLevel();
if (isEnum)
{
t << "\\begin{DoxyEnumFields}{";
@@ -2322,7 +2325,7 @@ void LatexGenerator::startMemberDocSimple(bool isEnum)
void LatexGenerator::endMemberDocSimple(bool isEnum)
{
- decUsedTableLevels();
+ m_codeGen.decUsedTableLevel();
if (isEnum)
{
t << "\\end{DoxyEnumFields}" << endl;
diff --git a/src/latexgen.h b/src/latexgen.h
index 12b34d8..4c793fa 100644
--- a/src/latexgen.h
+++ b/src/latexgen.h
@@ -52,7 +52,13 @@ class LatexCodeGenerator : public CodeOutputInterface
void writeCodeAnchor(const char *) {}
void setCurrentDoc(const Definition *,const char *,bool) {}
void addWord(const char *,bool) {}
- static void setDoxyCodeOpen(bool val);
+ void startCodeFragment(const char *style);
+ void endCodeFragment(const char *style);
+
+ // extra methods not part of CodeOutputInterface
+ void incUsedTableLevel() { m_usedTableLevel++; }
+ void decUsedTableLevel() { m_usedTableLevel--; }
+ int usedTableLevel() const { return m_usedTableLevel; }
private:
void _writeCodeLink(const char *className,
@@ -60,12 +66,14 @@ class LatexCodeGenerator : public CodeOutputInterface
const char *anchor,const char *name,
const char *tooltip);
void docify(const char *str);
- bool m_streamSet;
+ bool m_streamSet = false;
FTextStream m_t;
QCString m_relPath;
QCString m_sourceFileName;
- int m_col;
- bool m_prettyCode;
+ int m_col = 0;
+ bool m_prettyCode = false;
+ bool m_doxyCodeLineOpen = false;
+ int m_usedTableLevel = 0;
};
/** Generator for LaTeX output. */
@@ -108,6 +116,10 @@ class LatexGenerator : public OutputGenerator
{ m_codeGen.endFontClass(); }
void writeCodeAnchor(const char *anchor)
{ m_codeGen.writeCodeAnchor(anchor); }
+ void startCodeFragment(const char *style)
+ { m_codeGen.startCodeFragment(style); }
+ void endCodeFragment(const char *style)
+ { m_codeGen.endCodeFragment(style); }
// ---------------------------
@@ -194,8 +206,6 @@ class LatexGenerator : public OutputGenerator
void writeRuler() { t << endl << endl; }
void writeAnchor(const char *fileName,const char *name);
- void startCodeFragment();
- void endCodeFragment();
void startEmphasis() { t << "{\\em "; }
void endEmphasis() { t << "}"; }
void startBold() { t << "{\\bfseries "; }
diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp
index fef857e..875cd14 100644
--- a/src/mandocvisitor.cpp
+++ b/src/mandocvisitor.cpp
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -16,7 +13,7 @@
*
*/
-#include <qfileinfo.h>
+#include <qfileinfo.h>
#include "mandocvisitor.h"
#include "docparser.h"
@@ -33,7 +30,7 @@
#include "emoji.h"
ManDocVisitor::ManDocVisitor(FTextStream &t,CodeOutputInterface &ci,
- const char *langExt)
+ const char *langExt)
: DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(FALSE),
m_indent(0), m_langExt(langExt)
{
@@ -205,8 +202,7 @@ void ManDocVisitor::visit(DocVerbatim *s)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,s->context(),s->text(),
+ getCodeParser(lang).parseCode(m_ci,s->context(),s->text(),
langExt,
s->isExample(),s->exampleFile());
if (!m_firstCol) m_t << endl;
@@ -214,7 +210,7 @@ void ManDocVisitor::visit(DocVerbatim *s)
m_t << ".PP" << endl;
m_firstCol=TRUE;
break;
- case DocVerbatim::Verbatim:
+ case DocVerbatim::Verbatim:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
@@ -224,18 +220,18 @@ void ManDocVisitor::visit(DocVerbatim *s)
m_t << ".PP" << endl;
m_firstCol=TRUE;
break;
- case DocVerbatim::ManOnly:
- m_t << s->text();
+ case DocVerbatim::ManOnly:
+ m_t << s->text();
break;
- case DocVerbatim::HtmlOnly:
- case DocVerbatim::XmlOnly:
- case DocVerbatim::LatexOnly:
+ case DocVerbatim::HtmlOnly:
+ case DocVerbatim::XmlOnly:
+ case DocVerbatim::LatexOnly:
case DocVerbatim::RtfOnly:
case DocVerbatim::DocbookOnly:
- case DocVerbatim::Dot:
- case DocVerbatim::Msc:
- case DocVerbatim::PlantUML:
- /* nothing */
+ case DocVerbatim::Dot:
+ case DocVerbatim::Msc:
+ case DocVerbatim::PlantUML:
+ /* nothing */
break;
}
}
@@ -252,14 +248,13 @@ void ManDocVisitor::visit(DocInclude *inc)
switch(inc->type())
{
case DocInclude::IncWithLines:
- {
+ {
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -278,12 +273,11 @@ void ManDocVisitor::visit(DocInclude *inc)
m_firstCol=TRUE;
}
break;
- case DocInclude::Include:
+ case DocInclude::Include:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -311,7 +305,7 @@ void ManDocVisitor::visit(DocInclude *inc)
case DocInclude::ManInclude:
m_t << inc->text();
break;
- case DocInclude::VerbInclude:
+ case DocInclude::VerbInclude:
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
@@ -325,8 +319,7 @@ void ManDocVisitor::visit(DocInclude *inc)
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
m_t << ".nf" << endl;
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -345,13 +338,12 @@ void ManDocVisitor::visit(DocInclude *inc)
m_t << ".nf" << endl;
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
inc->isExample(),
- inc->exampleFile(),
+ inc->exampleFile(),
fd,
lineBlock(inc->text(),inc->blockId()),
-1, // endLine
@@ -366,8 +358,8 @@ void ManDocVisitor::visit(DocInclude *inc)
m_firstCol=TRUE;
}
break;
- case DocInclude::SnippetDoc:
- case DocInclude::IncludeDoc:
+ case DocInclude::SnippetDoc:
+ case DocInclude::IncludeDoc:
err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s"
"Please create a bug report\n",__FILE__);
break;
@@ -381,7 +373,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
SrcLangExt langExt = getLanguageFromFileName(locLangExt);
//printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n",
// op->type(),op->isFirst(),op->isLast(),op->text().data());
- if (op->isFirst())
+ if (op->isFirst())
{
if (!m_hide)
{
@@ -392,10 +384,10 @@ void ManDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide = TRUE;
}
- if (op->type()!=DocIncOperator::Skip)
+ if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
- if (!m_hide)
+ if (!m_hide)
{
FileDef *fd = 0;
if (!op->includeFileName().isEmpty())
@@ -404,8 +396,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),op->text(),langExt,
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
op->line(), // startLine
@@ -419,7 +410,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide=TRUE;
}
- if (op->isLast())
+ if (op->isLast())
{
popEnabled();
if (!m_hide)
@@ -484,7 +475,7 @@ void ManDocVisitor::visitPre(DocAutoListItem *li)
QCString ws;
ws.fill(' ',m_indent-2);
if (!m_firstCol) m_t << endl;
- m_t << ".IP \"" << ws;
+ m_t << ".IP \"" << ws;
if (((DocAutoList *)li->parent())->isEnumList())
{
m_t << li->itemNumber() << ".\" " << m_indent+2;
@@ -497,14 +488,14 @@ void ManDocVisitor::visitPre(DocAutoListItem *li)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocAutoListItem *)
+void ManDocVisitor::visitPost(DocAutoListItem *)
{
if (m_hide) return;
m_t << endl;
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPre(DocPara *)
+void ManDocVisitor::visitPre(DocPara *)
{
}
@@ -515,7 +506,7 @@ void ManDocVisitor::visitPost(DocPara *p)
!(p->parent() && // and for parameter sections
p->parent()->kind()==DocNode::Kind_ParamSect
)
- )
+ )
{
if (!m_firstCol) m_t << endl;
m_t << ".PP" << endl;
@@ -535,28 +526,28 @@ void ManDocVisitor::visitPre(DocSimpleSect *s)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
m_t << "\\fB";
switch(s->type())
{
- case DocSimpleSect::See:
+ case DocSimpleSect::See:
m_t << theTranslator->trSeeAlso(); break;
- case DocSimpleSect::Return:
+ case DocSimpleSect::Return:
m_t << theTranslator->trReturns(); break;
- case DocSimpleSect::Author:
+ case DocSimpleSect::Author:
m_t << theTranslator->trAuthor(TRUE,TRUE); break;
- case DocSimpleSect::Authors:
+ case DocSimpleSect::Authors:
m_t << theTranslator->trAuthor(TRUE,FALSE); break;
- case DocSimpleSect::Version:
+ case DocSimpleSect::Version:
m_t << theTranslator->trVersion(); break;
- case DocSimpleSect::Since:
+ case DocSimpleSect::Since:
m_t << theTranslator->trSince(); break;
- case DocSimpleSect::Date:
+ case DocSimpleSect::Date:
m_t << theTranslator->trDate(); break;
- case DocSimpleSect::Note:
+ case DocSimpleSect::Note:
m_t << theTranslator->trNote(); break;
case DocSimpleSect::Warning:
m_t << theTranslator->trWarning(); break;
@@ -630,7 +621,7 @@ void ManDocVisitor::visitPre(DocSimpleListItem *)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSimpleListItem *)
+void ManDocVisitor::visitPost(DocSimpleListItem *)
{
if (m_hide) return;
m_t << endl;
@@ -649,7 +640,7 @@ void ManDocVisitor::visitPre(DocSection *s)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSection *)
+void ManDocVisitor::visitPost(DocSection *)
{
}
@@ -661,7 +652,7 @@ void ManDocVisitor::visitPre(DocHtmlList *)
m_t << ".PD 0" << endl;
}
-void ManDocVisitor::visitPost(DocHtmlList *)
+void ManDocVisitor::visitPost(DocHtmlList *)
{
if (m_hide) return;
m_indent-=2;
@@ -675,7 +666,7 @@ void ManDocVisitor::visitPre(DocHtmlListItem *li)
QCString ws;
ws.fill(' ',m_indent-2);
if (!m_firstCol) m_t << endl;
- m_t << ".IP \"" << ws;
+ m_t << ".IP \"" << ws;
if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered)
{
m_t << li->itemNumber() << ".\" " << m_indent+2;
@@ -688,7 +679,7 @@ void ManDocVisitor::visitPre(DocHtmlListItem *li)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocHtmlListItem *)
+void ManDocVisitor::visitPost(DocHtmlListItem *)
{
if (m_hide) return;
m_t << endl;
@@ -703,7 +694,7 @@ void ManDocVisitor::visitPost(DocHtmlListItem *)
// m_insidePre=TRUE;
//}
//
-//void ManDocVisitor::visitPost(DocHtmlPre *)
+//void ManDocVisitor::visitPost(DocHtmlPre *)
//{
// m_insidePre=FALSE;
// if (!m_firstCol) m_t << endl;
@@ -716,7 +707,7 @@ void ManDocVisitor::visitPre(DocHtmlDescList *)
{
}
-void ManDocVisitor::visitPost(DocHtmlDescList *)
+void ManDocVisitor::visitPost(DocHtmlDescList *)
{
if (m_hide) return;
if (!m_firstCol) m_t << endl;
@@ -732,7 +723,7 @@ void ManDocVisitor::visitPre(DocHtmlDescTitle *)
m_firstCol=FALSE;
}
-void ManDocVisitor::visitPost(DocHtmlDescTitle *)
+void ManDocVisitor::visitPost(DocHtmlDescTitle *)
{
if (m_hide) return;
m_t << "\\fP\" 1c" << endl;
@@ -743,7 +734,7 @@ void ManDocVisitor::visitPre(DocHtmlDescData *)
{
}
-void ManDocVisitor::visitPost(DocHtmlDescData *)
+void ManDocVisitor::visitPost(DocHtmlDescData *)
{
}
@@ -751,7 +742,7 @@ void ManDocVisitor::visitPre(DocHtmlTable *)
{
}
-void ManDocVisitor::visitPost(DocHtmlTable *)
+void ManDocVisitor::visitPost(DocHtmlTable *)
{
}
@@ -759,7 +750,7 @@ void ManDocVisitor::visitPre(DocHtmlCaption *)
{
}
-void ManDocVisitor::visitPost(DocHtmlCaption *)
+void ManDocVisitor::visitPost(DocHtmlCaption *)
{
}
@@ -767,7 +758,7 @@ void ManDocVisitor::visitPre(DocHtmlRow *)
{
}
-void ManDocVisitor::visitPost(DocHtmlRow *)
+void ManDocVisitor::visitPost(DocHtmlRow *)
{
}
@@ -775,7 +766,7 @@ void ManDocVisitor::visitPre(DocHtmlCell *)
{
}
-void ManDocVisitor::visitPost(DocHtmlCell *)
+void ManDocVisitor::visitPost(DocHtmlCell *)
{
}
@@ -788,7 +779,7 @@ void ManDocVisitor::visitPre(DocInternal *)
//m_t << ".RS 4" << endl;
}
-void ManDocVisitor::visitPost(DocInternal *)
+void ManDocVisitor::visitPost(DocInternal *)
{
if (m_hide) return;
//if (!m_firstCol) m_t << endl;
@@ -803,7 +794,7 @@ void ManDocVisitor::visitPre(DocHRef *)
m_t << "\\fC";
}
-void ManDocVisitor::visitPost(DocHRef *)
+void ManDocVisitor::visitPost(DocHRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -817,7 +808,7 @@ void ManDocVisitor::visitPre(DocHtmlHeader *header)
m_t << " \"";
}
-void ManDocVisitor::visitPost(DocHtmlHeader *header)
+void ManDocVisitor::visitPost(DocHtmlHeader *header)
{
if (m_hide) return;
m_t << "\"" << endl;
@@ -829,7 +820,7 @@ void ManDocVisitor::visitPre(DocImage *)
{
}
-void ManDocVisitor::visitPost(DocImage *)
+void ManDocVisitor::visitPost(DocImage *)
{
}
@@ -837,14 +828,14 @@ void ManDocVisitor::visitPre(DocDotFile *)
{
}
-void ManDocVisitor::visitPost(DocDotFile *)
+void ManDocVisitor::visitPost(DocDotFile *)
{
}
void ManDocVisitor::visitPre(DocMscFile *)
{
}
-void ManDocVisitor::visitPost(DocMscFile *)
+void ManDocVisitor::visitPost(DocMscFile *)
{
}
@@ -862,7 +853,7 @@ void ManDocVisitor::visitPre(DocLink *)
m_t << "\\fB";
}
-void ManDocVisitor::visitPost(DocLink *)
+void ManDocVisitor::visitPost(DocLink *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -875,7 +866,7 @@ void ManDocVisitor::visitPre(DocRef *ref)
if (!ref->hasLinkText()) filter(ref->targetTitle());
}
-void ManDocVisitor::visitPost(DocRef *)
+void ManDocVisitor::visitPost(DocRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -891,7 +882,7 @@ void ManDocVisitor::visitPre(DocSecRefItem *)
m_firstCol=TRUE;
}
-void ManDocVisitor::visitPost(DocSecRefItem *)
+void ManDocVisitor::visitPost(DocSecRefItem *)
{
if (m_hide) return;
m_t << endl;
@@ -904,7 +895,7 @@ void ManDocVisitor::visitPre(DocSecRefList *)
m_indent+=2;
}
-void ManDocVisitor::visitPost(DocSecRefList *)
+void ManDocVisitor::visitPost(DocSecRefList *)
{
if (m_hide) return;
m_indent-=2;
@@ -916,20 +907,20 @@ void ManDocVisitor::visitPre(DocParamSect *s)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
m_t << "\\fB";
switch(s->type())
{
- case DocParamSect::Param:
+ case DocParamSect::Param:
m_t << theTranslator->trParameters(); break;
- case DocParamSect::RetVal:
+ case DocParamSect::RetVal:
m_t << theTranslator->trReturnValues(); break;
- case DocParamSect::Exception:
+ case DocParamSect::Exception:
m_t << theTranslator->trExceptions(); break;
- case DocParamSect::TemplateParam:
+ case DocParamSect::TemplateParam:
m_t << theTranslator->trTemplateParameters(); break;
default:
ASSERT(0);
@@ -961,11 +952,11 @@ void ManDocVisitor::visitPre(DocParamList *pl)
if (!first) m_t << ","; else first=FALSE;
if (param->kind()==DocNode::Kind_Word)
{
- visit((DocWord*)param);
+ visit((DocWord*)param);
}
else if (param->kind()==DocNode::Kind_LinkedWord)
{
- visit((DocLinkedWord*)param);
+ visit((DocLinkedWord*)param);
}
}
m_t << "\\fP ";
@@ -986,7 +977,7 @@ void ManDocVisitor::visitPre(DocXRefItem *x)
if (m_hide) return;
if (x->title().isEmpty()) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
@@ -1012,7 +1003,7 @@ void ManDocVisitor::visitPre(DocInternalRef *)
m_t << "\\fB";
}
-void ManDocVisitor::visitPost(DocInternalRef *)
+void ManDocVisitor::visitPost(DocInternalRef *)
{
if (m_hide) return;
m_t << "\\fP";
@@ -1030,7 +1021,7 @@ void ManDocVisitor::visitPre(DocHtmlBlockQuote *)
{
if (m_hide) return;
if (!m_firstCol)
- {
+ {
m_t << endl;
m_t << ".PP" << endl;
}
@@ -1064,12 +1055,12 @@ void ManDocVisitor::visitPost(DocParBlock *)
void ManDocVisitor::filter(const char *str)
-{
+{
if (str)
{
const char *p=str;
char c=0;
- while ((c=*p++))
+ while ((c=*p++))
{
switch(c)
{
diff --git a/src/mangen.cpp b/src/mangen.cpp
index 8574018..4b01904 100644
--- a/src/mangen.cpp
+++ b/src/mangen.cpp
@@ -391,7 +391,7 @@ void ManGenerator::endItemListItem()
{
}
-void ManGenerator::startCodeFragment()
+void ManGenerator::startCodeFragment(const char *)
{
newParagraph();
t << ".nf" << endl;
@@ -399,7 +399,7 @@ void ManGenerator::startCodeFragment()
m_paragraph=FALSE;
}
-void ManGenerator::endCodeFragment()
+void ManGenerator::endCodeFragment(const char *)
{
if (!m_firstCol) t << endl;
t << ".fi" << endl;
diff --git a/src/mangen.h b/src/mangen.h
index 9bcdb18..8a8def7 100644
--- a/src/mangen.h
+++ b/src/mangen.h
@@ -123,8 +123,8 @@ class ManGenerator : public OutputGenerator
void writeRuler() {}
void writeAnchor(const char *,const char *) {}
- void startCodeFragment();
- void endCodeFragment();
+ void startCodeFragment(const char *);
+ void endCodeFragment(const char *);
void writeLineNumber(const char *,const char *,const char *,int l) { t << l << " "; m_col=0; }
void startCodeLine(bool) {}
void endCodeLine() { codify("\n"); m_col=0; }
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 3089b8e..e268c48 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -2264,7 +2264,7 @@ void Markdown::writeFencedCodeBlock(const char *data,const char *lng,
}
addStrEscapeUtf8Nbsp(data+blockStart,blockEnd-blockStart);
m_out.addStr("\n");
- m_out.addStr("@endcode\n");
+ m_out.addStr("@endcode");
}
QCString Markdown::processQuotations(const QCString &s,int refIndent)
@@ -2662,6 +2662,7 @@ QCString markdownFileNameToId(const QCString &fileName)
int i = baseFn.findRev('.');
if (i!=-1) baseFn = baseFn.left(i);
QCString baseName = substitute(substitute(substitute(baseFn," ","_"),"/","_"),":","_");
+ //printf("markdownFileNameToId(%s)=md_%s\n",qPrint(fileName),qPrint(baseName));
return "md_"+baseName;
}
@@ -2728,6 +2729,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
}
int lineNr=1;
+ p->commentScanner.enterFile(fileName,lineNr);
Protection prot=Public;
bool needsEntry = FALSE;
int position=0;
@@ -2759,6 +2761,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
{
root->moveToSubEntryAndKeep(current);
}
+ p->commentScanner.leaveFile(fileName,lineNr);
}
void MarkdownOutlineParser::parsePrototype(const char *text)
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 464dbd0..c3c420a 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -330,6 +330,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef
const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
bool onlyText=FALSE) const;
virtual void addToSearchIndex() const;
+ virtual void resolveUnnamedParameters(const MemberDef *md);
private:
void _computeLinkableInProject();
@@ -850,6 +851,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
virtual void warnIfUndocumented() const {}
virtual void warnIfUndocumentedParams() const {}
virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const {}
+ virtual void resolveUnnamedParameters(const MemberDef *md) {}
private:
MemberGroup *m_memberGroup; // group's member definition
};
@@ -3681,12 +3683,12 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
else
ol.parseText(theTranslator->trInitialValue());
ol.endBold();
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
- intf.resetCodeParserState();
- ol.startCodeFragment();
- intf.parseCode(ol,scopeName,m_impl->initializer,lang,FALSE,0,const_cast<FileDef*>(getFileDef()),
+ auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension());
+ intf->resetCodeParserState();
+ ol.startCodeFragment("DoxyCode");
+ intf->parseCode(ol,scopeName,m_impl->initializer,lang,FALSE,0,const_cast<FileDef*>(getFileDef()),
-1,-1,TRUE,this,FALSE,this);
- ol.endCodeFragment();
+ ol.endCodeFragment("DoxyCode");
}
QCString brief = briefDescription();
@@ -4050,6 +4052,18 @@ void MemberDefImpl::warnIfUndocumented() const
warnIfUndocumentedParams();
}
}
+static QCString stripTrailingReturn(const QCString trailRet)
+{
+ QCString ret = trailRet;
+
+ ret = ret.stripWhiteSpace();
+ if (ret.startsWith("->"))
+ {
+ ret = ret.mid(2).stripWhiteSpace();
+ return ret;
+ }
+ return trailRet;
+}
void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const
{
@@ -4058,7 +4072,17 @@ void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturn
bool isPython = getLanguage()==SrcLangExt_Python;
bool isFortran = getLanguage()==SrcLangExt_Fortran;
bool isFortranSubroutine = isFortran && returnType.find("subroutine")!=-1;
+
bool isVoidReturn = (returnType=="void") || (returnType.right(5)==" void");
+ if (!isVoidReturn && returnType == "auto")
+ {
+ const ArgumentList &defArgList=isDocsForDefinition() ? argumentList() : declArgumentList();
+ if (!defArgList.trailingReturnType().isEmpty())
+ {
+ QCString strippedTrailingReturn = stripTrailingReturn(defArgList.trailingReturnType());
+ isVoidReturn = (strippedTrailingReturn=="void") || (strippedTrailingReturn.right(5)==" void");
+ }
+ }
if (!m_impl->hasDocumentedParams && hasParamCommand)
{
@@ -4814,6 +4838,7 @@ ClassDef *MemberDefImpl::accessorClass() const
void MemberDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
}
@@ -5463,6 +5488,54 @@ const ArgumentList &MemberDefImpl::declArgumentList() const
return m_impl->declArgList;
}
+void MemberDefImpl::resolveUnnamedParameters(const MemberDef *md)
+{
+ ArgumentList &decAl = m_impl->declArgList;
+ ArgumentList &defAl = m_impl->defArgList;
+ const ArgumentList &decAlSrc = md->declArgumentList();
+ const ArgumentList &defAlSrc = md->argumentList();
+ auto decSrc = decAlSrc.begin(), defSrc = defAlSrc.begin();
+ for (auto decIt = decAl.begin(), defIt = defAl.begin();
+ decIt != decAl.end() && defIt != defAl.end() && decSrc != decAlSrc.end() && defSrc != defAlSrc.end();
+ ++decIt, ++defIt, ++decSrc, ++defSrc++)
+ {
+ Argument &decA = *decIt;
+ Argument &defA = *defIt;
+ const Argument &decAS = *decSrc;
+ const Argument &defAS = *defSrc;
+ if (decA.name.isEmpty())
+ {
+ if (!defA.name.isEmpty())
+ {
+ decA.name = defA.name;
+ }
+ else if (!decAS.name.isEmpty())
+ {
+ decA.name = decAS.name;
+ }
+ else if (!defAS.name.isEmpty())
+ {
+ decA.name = defAS.name;
+ }
+ }
+ if (defA.name.isEmpty())
+ {
+ if (!decA.name.isEmpty())
+ {
+ defA.name = decA.name;
+ }
+ else if (!decAS.name.isEmpty())
+ {
+ defA.name = decAS.name;
+ }
+ else if (!defAS.name.isEmpty())
+ {
+ defA.name = defAS.name;
+ }
+ }
+ }
+}
+
const ArgumentList &MemberDefImpl::templateArguments() const
{
return m_impl->tArgList;
@@ -5929,6 +6002,17 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA
{
defA.docs = decA.docs;
}
+ if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
+ {
+ if (decA.name.isEmpty() && !defA.name.isEmpty())
+ {
+ decA.name = defA.name;
+ }
+ else if (defA.name.isEmpty() && !decA.name.isEmpty())
+ {
+ defA.name = decA.name;
+ }
+ }
}
}
@@ -5960,6 +6044,11 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef)
// mdec->getFileDef()->name().data(),mdec->documentation().data()
// );
+ if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
+ {
+ mdec->resolveUnnamedParameters(mdef);
+ }
+
// first merge argument documentation
transferArgumentDocumentation(mdecAl,mdefAl);
@@ -6021,7 +6110,6 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef)
mdec->mergeMemberSpecifiers(mdef->getMemberSpecifiers());
mdef->mergeMemberSpecifiers(mdec->getMemberSpecifiers());
-
// copy group info.
if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0)
{
diff --git a/src/memberdef.h b/src/memberdef.h
index f15c31e..cc467ea 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -336,6 +336,7 @@ class MemberDef : virtual public Definition
// argument related members
virtual void moveArgumentList(std::unique_ptr<ArgumentList> al) = 0;
virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) = 0;
+ virtual void resolveUnnamedParameters(const MemberDef *md) = 0;
virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) = 0;
virtual void setTypeConstraints(const ArgumentList &al) = 0;
virtual void setType(const char *t) = 0;
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index 88eea5d..65456ac 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -349,6 +349,7 @@ void NamespaceDefImpl::distributeMemberGroupDocumentation()
void NamespaceDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
diff --git a/src/outputgen.h b/src/outputgen.h
index 4bfed25..ba9f2f4 100644
--- a/src/outputgen.h
+++ b/src/outputgen.h
@@ -127,6 +127,16 @@ class CodeOutputInterface
virtual void setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) = 0;
virtual void addWord(const char *word,bool hiPriority) = 0;
+
+ /*! Starts a source code fragment. The fragment will be
+ * fed to the code parser (see code.h) for syntax highlighting
+ * and cross-referencing. The fragment ends by a call to
+ * endCodeFragment()
+ * @param style The kind of code fragment.
+ */
+ virtual void startCodeFragment(const char *style) = 0;
+ /*! Ends a block of code */
+ virtual void endCodeFragment(const char *style) = 0;
};
/** Base Interface used for generating output outside of the
@@ -240,20 +250,6 @@ class BaseOutputDocInterface : public CodeOutputInterface
/*! Ends a section of text displayed in italic. */
virtual void endEmphasis() = 0;
- /*! Starts a source code fragment. The fragment will be
- * fed to the code parser (see code.h) for syntax highlighting
- * and cross-referencing. The fragment ends by a call to
- * endCodeFragment()
- */
- virtual void startCodeFragment() = 0;
-
- /*! Ends a source code fragment
- */
- virtual void endCodeFragment() = 0;
-
-
-
-
/*! Writes a horizontal ruler to the output */
virtual void writeRuler() = 0;
diff --git a/src/outputlist.h b/src/outputlist.h
index 003e508..2d06598 100644
--- a/src/outputlist.h
+++ b/src/outputlist.h
@@ -229,10 +229,10 @@ class OutputList : public OutputDocInterface
{ forall(&OutputGenerator::writeRuler); }
void writeAnchor(const char *fileName,const char *name)
{ forall(&OutputGenerator::writeAnchor,fileName,name); }
- void startCodeFragment()
- { forall(&OutputGenerator::startCodeFragment); }
- void endCodeFragment()
- { forall(&OutputGenerator::endCodeFragment); }
+ void startCodeFragment(const char *style)
+ { forall(&OutputGenerator::startCodeFragment,style); }
+ void endCodeFragment(const char *style)
+ { forall(&OutputGenerator::endCodeFragment,style); }
void startCodeLine(bool hasLineNumbers)
{ forall(&OutputGenerator::startCodeLine,hasLineNumbers); }
void endCodeLine()
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index 09152de..75e50ed 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -99,6 +99,7 @@ PageDefImpl::~PageDefImpl()
void PageDefImpl::findSectionsInDocumentation()
{
+ docFindSections(briefDescription(),this,docFile());
docFindSections(documentation(),this,docFile());
}
diff --git a/src/parserintf.h b/src/parserintf.h
index 911b707..2fde2f1 100644
--- a/src/parserintf.h
+++ b/src/parserintf.h
@@ -137,6 +137,7 @@ class CodeParserInterface
//-----------------------------------------------------------------------------
using OutlineParserFactory = std::function<std::unique_ptr<OutlineParserInterface>()>;
+using CodeParserFactory = std::function<std::unique_ptr<CodeParserInterface>()>;
/** \brief Manages programming language parsers.
*
@@ -145,38 +146,42 @@ using OutlineParserFactory = std::function<std::unique_ptr<OutlineParserInterfac
*/
class ParserManager
{
- public:
struct ParserPair
{
- ParserPair(OutlineParserFactory opf, std::unique_ptr<CodeParserInterface> cpi)
- : outlineParserFactory(opf), codeParserInterface(std::move(cpi))
+ ParserPair(OutlineParserFactory opf, CodeParserFactory cpf, const QCString pn)
+ : outlineParserFactory(opf), codeParserFactory(cpf), parserName(pn)
{
}
OutlineParserFactory outlineParserFactory;
- std::unique_ptr<CodeParserInterface> codeParserInterface;
+ CodeParserFactory codeParserFactory;
+ QCString parserName;
};
+ public:
+ /** Create the parser manager
+ * @param outlineParserFactory the fallback outline parser factory to use for unknown extensions
+ * @param codeParserFactory the fallback code parser factory to use for unknown extensions
+ */
ParserManager(OutlineParserFactory outlineParserFactory,
- std::unique_ptr<CodeParserInterface> codeParserInterface)
- : m_defaultParsers(outlineParserFactory,std::move(codeParserInterface))
+ CodeParserFactory codeParserFactory)
+ : m_defaultParsers(outlineParserFactory,codeParserFactory, "")
{
}
/** Registers an additional parser.
* @param[in] name A symbolic name of the parser, i.e. "c",
* "python", "fortran", "vhdl", ...
- * @param[in] outlineParser The language parser (scanner) that is to be used for the
- * given name.
- * @param[in] codeParser The code parser that is to be used for the
- * given name.
+ * @param[in] outlineParserFactory A factory method to create a language parser (scanner) that
+ * is to be used for the given name.
+ * @param[in] codeParserFactory A factory method to create a code parser that is to be used
+ * for the given name.
*/
void registerParser(const char *name,OutlineParserFactory outlineParserFactory,
- std::unique_ptr<CodeParserInterface> codeParserInterface)
+ CodeParserFactory codeParserFactory)
{
- m_parsers.emplace(std::string(name),
- ParserPair(outlineParserFactory,std::move(codeParserInterface)));
+ m_parsers.emplace(std::string(name),ParserPair(outlineParserFactory,codeParserFactory,name));
}
/** Registers a file \a extension with a parser with name \a parserName.
@@ -198,7 +203,7 @@ class ParserManager
return TRUE;
}
- /** Gets the interface to the parser associated with given \a extension.
+ /** Gets the interface to the parser associated with a given \a extension.
* If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned.
*/
@@ -207,13 +212,29 @@ class ParserManager
return getParsers(extension).outlineParserFactory();
}
- /** Gets the interface to the parser associated with given \a extension.
+ /** Gets the interface to the parser associated with a given \a extension.
* If there is no parser explicitly registered for the supplied extension,
* the interface to the default parser will be returned.
*/
- CodeParserInterface &getCodeParser(const char *extension)
+ std::unique_ptr<CodeParserInterface> getCodeParser(const char *extension)
+ {
+ auto factory = getCodeParserFactory(extension);
+ return factory();
+ }
+
+ /** Get the factory for create code parser objects with a given \a extension. */
+ CodeParserFactory &getCodeParserFactory(const char *extension)
+ {
+ return getParsers(extension).codeParserFactory;
+ }
+
+ /** Gets the name of the parser associated with given \a extension.
+ * If there is no parser explicitly registered for the supplied extension,
+ * te empty string will be reurned.
+ */
+ QCString getParserName(const char *extension)
{
- return *getParsers(extension).codeParserInterface;
+ return getParsers(extension).parserName;
}
private:
diff --git a/src/pycode.h b/src/pycode.h
index e3a01b4..8bce2a9 100644
--- a/src/pycode.h
+++ b/src/pycode.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -36,6 +34,8 @@ class Definition;
class PythonCodeParser : public CodeParserInterface
{
public:
+ PythonCodeParser();
+ virtual ~PythonCodeParser();
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
@@ -52,6 +52,9 @@ class PythonCodeParser : public CodeParserInterface
bool collectXrefs=TRUE
);
void resetCodeParserState();
+ private:
+ struct Private;
+ std::unique_ptr<Private> p;
};
diff --git a/src/pycode.l b/src/pycode.l
index 8cb85a3..68ec265 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -23,6 +21,8 @@
%option never-interactive
%option prefix="pycodeYY"
+%option reentrant
+%option extra-type="struct pycodeYY_state *"
%option noyy_top_state
%top{
#include <stdint.h>
@@ -30,12 +30,15 @@
%{
+#include <vector>
+#include <unordered_map>
+#include <string>
+#include <stack>
+
#include <stdio.h>
-#include <qvaluestack.h>
#include "pycode.h"
#include "message.h"
-
#include "scanner.h"
#include "entry.h"
#include "doxygen.h"
@@ -59,279 +62,1002 @@
#define USE_STATE2STRING 0
-static ClassSDict g_codeClassSDict(17);
-static QCString g_curClassName;
-static QStrList g_curClassBases;
-
-
-static CodeOutputInterface * g_code;
-static const char * g_inputString; //!< the code fragment as text
-static int g_inputPosition; //!< read offset during parsing
-static const char * g_currentFontClass;
-static bool g_needsTermination;
-static const Definition *g_searchCtx;
-static bool g_collectXRefs;
-static int g_inputLines; //!< number of line in the code fragment
-static int g_yyLineNr; //!< current line number
-static FileDef * g_sourceFileDef;
-static Definition * g_currentDefinition;
-static MemberDef * g_currentMemberDef;
-static bool g_includeCodeFragment;
-static QCString g_realScope;
-//static bool g_insideBody;
-static int g_bodyCurlyCount;
-static bool g_searchingForBody;
-static QCString g_classScope;
-static int g_paramParens;
-//static int g_anchorCount;
-
-static bool g_exampleBlock;
-static QCString g_exampleName;
-
-static QCString g_type;
-static QCString g_name;
-
-static bool g_doubleStringIsDoc;
-static bool g_doubleQuote;
-static bool g_noSuiteFound;
-static int g_stringContext;
-
-static QValueStack<uint> g_indents; //!< Tracks indentation levels for scoping in python
-
-static QCString g_docBlock; //!< contents of all lines of a documentation block
-static bool g_endComment;
-
-static void endFontClass();
-static void adjustScopesAndSuites(unsigned indentLength);
-
-#if USE_STATE2STRING
-static const char *stateToString(int state);
-#endif
-
-
/*! Represents a stack of variable to class mappings as found in the
* code. Each scope is enclosed in pushScope() and popScope() calls.
* Variables are added by calling addVariables() and one can search
* for variable using findVariable().
*/
-class PyVariableContext
+class PyVariableContext
{
public:
- static const ClassDef *dummyContext;
- class Scope : public SDict<ClassDef>
- {
- public:
- Scope() : SDict<ClassDef>(17) {}
- };
-
- PyVariableContext()
- {
- m_scopes.setAutoDelete(TRUE);
- }
+ static const ClassDef *dummyContext;
- virtual ~PyVariableContext()
- {
- }
-
- void pushScope()
+ using Scope = std::unordered_map<std::string,const ClassDef *>;
+
+ void pushScope()
{
- m_scopes.append(new Scope);
+ m_scopes.push_back(Scope());
}
- void popScope()
+ void popScope()
{
- if (m_scopes.count()>0)
+ if (!m_scopes.empty())
{
- m_scopes.remove(m_scopes.count()-1);
+ m_scopes.pop_back();
}
}
- void clear()
+ void clear()
{
m_scopes.clear();
m_globalScope.clear();
}
- void clearExceptGlobal()
+ void clearExceptGlobal()
{
m_scopes.clear();
}
- void addVariable(const QCString &type,const QCString &name);
- ClassDef *findVariable(const QCString &name);
-
+ void addVariable(yyscan_t yyscanner, const QCString &type,const QCString &name);
+ const ClassDef *findVariable(const QCString &name);
+
+ private:
+ Scope m_globalScope;
+ std::vector<Scope> m_scopes;
+};
+
+class PyCallContext
+{
+ public:
+ struct Ctx
+ {
+ Ctx(QCString name_,QCString type_) : name(name_), type(type_) {}
+ QCString name;
+ QCString type;
+ const ClassDef *cd = 0;
+ };
+
+ PyCallContext()
+ {
+ clear();
+ }
+
+ void setClass(const ClassDef *cd)
+ {
+ Ctx &ctx = m_classList.back();
+ ctx.cd=cd;
+ }
+ void pushScope(const QCString &name_,const QCString type_)
+ {
+ m_classList.push_back(Ctx(name_,type_));
+ }
+ void popScope(QCString &name_,QCString &type_)
+ {
+ if (m_classList.size()>1)
+ {
+ const Ctx &ctx = m_classList.back();
+ name_ = ctx.name;
+ type_ = ctx.type;
+ m_classList.pop_back();
+ }
+ }
+ void clear()
+ {
+ m_classList.clear();
+ m_classList.push_back(Ctx("",""));
+ }
+ const ClassDef *getClass() const
+ {
+ return m_classList.back().cd;
+ }
+
private:
- Scope m_globalScope;
- QList<Scope> m_scopes;
+ std::vector<Ctx> m_classList;
};
-void PyVariableContext::addVariable(const QCString &type,const QCString &name)
+
+struct pycodeYY_state
{
+ std::unordered_map< std::string, std::unique_ptr<ClassDef> > codeClassMap;
+ QCString curClassName;
+ QStrList curClassBases;
+
+ CodeOutputInterface * code = 0;
+ const char * inputString = 0; //!< the code fragment as text
+ int inputPosition = 0; //!< read offset during parsing
+ const char * currentFontClass = 0;
+ bool needsTermination = FALSE;
+ const Definition *searchCtx = 0;
+ bool collectXRefs = FALSE;
+ int inputLines = 0; //!< number of line in the code fragment
+ int yyLineNr = 0; //!< current line number
+ FileDef * sourceFileDef = 0;
+ Definition * currentDefinition = 0;
+ MemberDef * currentMemberDef = 0;
+ bool includeCodeFragment = FALSE;
+ QCString realScope;
+ int bodyCurlyCount = 0;
+ bool searchingForBody = FALSE;
+ QCString classScope;
+ int paramParens = 0;
+
+ bool exampleBlock = FALSE;
+ QCString exampleName;
+
+ QCString type;
+ QCString name;
+
+ bool doubleStringIsDoc = FALSE;
+ bool doubleQuote = FALSE;
+ bool noSuiteFound = FALSE;
+ int stringContext = 0;
+
+ std::stack<yy_size_t> indents; //!< Tracks indentation levels for scoping in python
+
+ QCString docBlock; //!< contents of all lines of a documentation block
+ bool endComment = FALSE;
+ PyVariableContext theVarContext;
+ PyCallContext theCallContext;
+};
+
+
+#if USE_STATE2STRING
+static const char *stateToString(int state);
+#endif
+
+const ClassDef *PyVariableContext::dummyContext = (ClassDef*)0x8;
+
+
+static void startCodeLine(yyscan_t yyscanner);
+static int countLines(yyscan_t yyscanner);
+static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor);
+static void addToSearchIndex(yyscan_t yyscanner, const char *text);
+static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d);
+static void codify(yyscan_t yyscanner,const char* text);
+static void endCodeLine(yyscan_t yyscanner);
+static void nextCodeLine(yyscan_t yyscanner);
+static void writeMultiLineCodeLink(yyscan_t yyscanner, CodeOutputInterface &ol, const Definition *d, const char *text);
+static void startFontClass(yyscan_t yyscanner,const char *s);
+static void endFontClass(yyscan_t yyscanner);
+static void codifyLines(yyscan_t yyscanner,const char *text);
+static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, const QCString &m,
+ const char *memberText, CodeOutputInterface &ol, const char *text);
+static bool getLink(yyscan_t yyscanner, const char *className, const char *memberName,
+ CodeOutputInterface &ol, const char *text=0);
+static void generateClassOrGlobalLink(yyscan_t yyscanner, CodeOutputInterface &ol,
+ const char *clName, bool typeOnly=FALSE);
+static void generateFunctionLink(yyscan_t yyscanner, CodeOutputInterface &ol,
+ const char *funcName);
+static bool findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol,
+ Definition *sym, const char *symName);
+static void findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol,
+ const char *symName);
+static void adjustScopesAndSuites(yyscan_t yyscanner,unsigned indentLength);
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
+
+
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+
+%}
+
+
+BB [ \t]+
+B [ \t]*
+NEWLINE \n
+
+DIGIT [0-9]
+LETTER [A-Za-z\x80-\xFF]
+NONEMPTY [A-Za-z0-9_\x80-\xFF]
+EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-]
+NONEMPTYEXP [^ \t\n:]
+PARAMNONEMPTY [^ \t\n():]
+IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")*
+BORDER ([^A-Za-z0-9])
+
+POUNDCOMMENT "##"
+
+TRISINGLEQUOTE "'''"
+TRIDOUBLEQUOTE "\"\"\""
+LONGSTRINGCHAR [^\\"']
+ESCAPESEQ ("\\")(.)
+LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ})
+SMALLQUOTE ("\"\""|"\""|"'"|"''")
+LONGSTRINGBLOCK ({LONGSTRINGITEM}+|{SMALLQUOTE})
+
+SHORTSTRING ("'"{SHORTSTRINGITEM}*"'"|'"'{SHORTSTRINGITEM}*'"')
+SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ})
+SHORTSTRINGCHAR [^\\\n"]
+STRINGLITERAL {STRINGPREFIX}?( {SHORTSTRING} | {LONGSTRING})
+STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR")
+KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"def"|"True"|"False")
+FLOWKW ("or"|"and"|"is"|"not"|"print"|"for"|"in"|"if"|"try"|"except"|"yield"|"raise"|"break"|"continue"|"pass"|"if"|"return"|"while"|"elif"|"else"|"finally")
+QUOTES ("\""[^"]*"\"")
+SINGLEQUOTES ("'"[^']*"'")
+
+LONGINTEGER {INTEGER}("l"|"L")
+INTEGER ({DECIMALINTEGER}|{OCTINTEGER}|{HEXINTEGER})
+DECIMALINTEGER ({NONZERODIGIT}{DIGIT}*|"0")
+OCTINTEGER "0"{OCTDIGIT}+
+HEXINTEGER "0"("x"|"X"){HEXDIGIT}+
+NONZERODIGIT [1-9]
+OCTDIGIT [0-7]
+HEXDIGIT ({DIGIT}|[a-f]|[A-F])
+FLOATNUMBER ({POINTFLOAT}|{EXPONENTFLOAT})
+POINTFLOAT ({INTPART}?{FRACTION}|{INTPART}".")
+EXPONENTFLOAT ({INTPART}|{POINTFLOAT}){EXPONENT}
+INTPART {DIGIT}+
+FRACTION "."{DIGIT}+
+EXPONENT ("e"|"E")("+"|"-")?{DIGIT}+
+IMAGNUMBER ({FLOATNUMBER}|{INTPART})("j"|"J")
+ATOM ({IDENTIFIER}|{LITERAL}|{ENCLOSURE})
+ENCLOSURE ({PARENTH_FORM}|{LIST_DISPLAY}|{DICT_DISPLAY}|{STRING_CONVERSION})
+LITERAL ({STRINGLITERAL}|{INTEGER}|{LONGINTEGER}|{FLOATNUMBER}|{IMAGNUMBER})
+PARENTH_FORM "("{EXPRESSION_LIST}?")"
+TEST ({AND_TEST}("or"{AND_TEST})*|{LAMBDA_FORM})
+TESTLIST {TEST}( ","{TEST})*","?
+LIST_DISPLAY "["{LISTMAKER}?"]"
+LISTMAKER {EXPRESSION}({LIST_FOR}|(","{EXPRESSION})*","?)
+LIST_ITER ({LIST_FOR}|{LIST_IF})
+LIST_FOR "for"{EXPRESSION_LIST}"in"{TESTLIST}{LIST_ITER}?
+LIST_IF "if"{TEST}{LIST_ITER}?
+DICT_DISPLAY "\{"{KEY_DATUM_LIST}?"\}"
+KEY_DATUM_LIST {KEY_DATUM}(","{KEY_DATUM})*","?
+KEY_DATUM {EXPRESSION}":"{EXPRESSION}
+STRING_CONVERSION "`"{EXPRESSION_LIST}"`"
+PRIMARY ({ATOM}|{ATTRIBUTEREF}|{SUBSCRIPTION}|{SLICING}|{CALL})
+ATTRIBUTEREF {PRIMARY}"."{IDENTIFIER}
+SUBSCRIPTION {PRIMARY}"["{EXPRESSION_LIST}"]"
+SLICING ({SIMPLE_SLICING}|{EXTENDED_SLICING})
+SIMPLE_SLICING {PRIMARY}"["{SHORT_SLICE}"]"
+EXTENDED_SLICING {PRIMARY}"["{SLICE_LIST}"]"
+SLICE_LIST {SLICE_ITEM}(","{SLICE_ITEM})*","?
+SLICE_ITEM ({EXPRESSION}|{PROPER_SLICE}|{ELLIPSIS})
+PROPER_SLICE ({SHORT_SLICE}|{LONG_SLICE})
+SHORT_SLICE {LOWER_BOUND}?":"{UPPER_BOUND}?
+LONG_SLICE {SHORT_SLICE}":"{STRIDE}?
+LOWER_BOUND {EXPRESSION}
+UPPER_BOUND {EXPRESSION}
+STRIDE {EXPRESSION}
+ELLIPSIS "..."
+CALL {PRIMARY}"("({ARGUMENT_LIST}","?)?")"
+ARGUMENT_LIST ({POSITIONAL_ARGUMENTS}(","{KEYWORD_ARGUMENTS})?(",""*"{EXPRESSION})?(",""**"{EXPRESSION})?|{KEYWORD_ARGUMENTS}(",""*"{EXPRESSION})?(",""**"{EXPRESSION})?|"*"{EXPRESSION}(",""**"{EXPRESSION})?|"**"{EXPRESSION})
+POSITIONAL_ARGUMENTS {EXPRESSION}(","{EXPRESSION})*
+KEYWORD_ARGUMENTS {KEYWORD_ITEM}(","{KEYWORD_ITEM})*
+KEYWORD_ITEM {IDENTIFIER}"="{EXPRESSION}
+POWER {PRIMARY}("**"{U_EXPR})?
+U_EXPR ({POWER}|"-"{U_EXPR}|"+"{U_EXPR}|"\~"{U_EXPR})
+M_EXPR ({U_EXPR}|{M_EXPR}"*"{U_EXPR}|{M_EXPR}"//"{U_EXPR}|{M_EXPR}"/"{U_EXPR}|{M_EXPR}"\%"{U_EXPR})
+A_EXPR ({M_EXPR}|{A_EXPR}"+"{M_EXPR}|{A_EXPR}"-"{M_EXPR}
+SHIFT_EXPR ({A_EXPR}|{SHIFT_EXPR}("<<"|">>"){A_EXPR})
+AND_EXPR ({SHIFT_EXPR}|{AND_EXPR}"\;SPMamp;"{SHIFT_EXPR}
+XOR_EXPR ({AND_EXPR}|{XOR_EXPR}"\textasciicircum"{AND_EXPR})
+OR_EXPR ({XOR_EXPR}|{OR_EXPR}"|"{ XOR_EXPR})
+
+COMPARISON {OR_EXPR}({COMP_OPERATOR}{OR_EXPR})*
+COMP_OPERATOR ("<"|">"|"=="|">="|"<="|"<>"|"!="|"is""not"?|"not"?"in")
+EXPRESSION ({OR_TEST}|{LAMBDA_FORM})
+OR_TEST ({AND_TEST}|{OR_TEST}"or"{AND_TEST})
+AND_TEST ({NOT_TEST}|{AND_TEST}"and"{NOT_TEST})
+NOT_TEST ({COMPARISON}|"not"{NOT_TEST})
+LAMBDA_FORM "lambda"{PARAMETER_LIST}?":"{EXPRESSION}
+EXPRESSION_LIST {EXPRESSION}(","{EXPRESSION})*","?
+SIMPLE_STMT ({EXPRESSION_STMT}|{ASSERT_STMT}|{ASSIGNMENT_STMT}|{AUGMENTED_ASSIGNMENT_STMT}|{PASS_STMT}|{DEL_STMT}|{PRINT_STMT}|{RETURN_STMT}|{YIELD_STMT}|{RAISE_STMT}|{BREAK_STMT}|{CONTINUE_STMT}|{IMPORT_STMT}|{GLOBAL_STMT}|{EXEC_STMT})
+EXPRESSION_STMT {EXPRESSION_LIST}
+ASSERT_STMT "assert"{EXPRESSION}(","{EXPRESSION})?
+ASSIGNMENT_STMT ({TARGET_LIST}"=")+{EXPRESSION_LIST}
+TARGET_LIST {TARGET}(","{TARGET})*","?
+TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUTEREF}|{SUBSCRIPTION}|{SLICING})
+
+%option noyywrap
+%option stack
+
+%x Body
+
+%x FunctionDec
+%x FunctionParams
+
+%x ClassDec
+%x ClassInheritance
+
+%x Suite
+%x SuiteCaptureIndent
+%x SuiteStart
+%x SuiteMaintain
+%x SuiteContinuing
+
+%x LongString
+
+%x SingleQuoteString
+%x DoubleQuoteString
+%x TripleString
+
+%x DocBlock
+%%
+
+<Body,Suite>{
+ "def"{BB} {
+ startFontClass(yyscanner,"keyword");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( FunctionDec );
+ }
+
+ "class"{BB} {
+ startFontClass(yyscanner,"keyword");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN( ClassDec );
+ }
+ "None" {
+ startFontClass(yyscanner,"keywordtype");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ "self."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER}"(" {
+ codify(yyscanner,"self.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[5]);
+ }
+ "self."{IDENTIFIER}/"(" {
+ codify(yyscanner,"self.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[5]);
+ }
+ "self."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER} {
+ codify(yyscanner,"self.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[5]);
+ }
+ "self."{IDENTIFIER} {
+ codify(yyscanner,"self.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[5]);
+ }
+ "cls."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER}"(" {
+ codify(yyscanner,"cls.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[4]);
+ }
+ "cls."{IDENTIFIER}/"(" {
+ codify(yyscanner,"cls.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[4]);
+ }
+ "cls."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER} {
+ codify(yyscanner,"cls.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[4]);
+ }
+ "cls."{IDENTIFIER} {
+ codify(yyscanner,"cls.");
+ findMemberLink(yyscanner,*yyextra->code,&yytext[4]);
+ }
+}
+
+<ClassDec>{IDENTIFIER} {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ // codify(yyscanner,yytext);
+ yyextra->curClassName = yytext;
+ yyextra->curClassBases.clear();
+ BEGIN( ClassInheritance );
+ }
+
+<ClassInheritance>{
+ ({BB}|[(,)]) {
+ codify(yyscanner,yytext);
+ }
+
+ ({IDENTIFIER}".")*{IDENTIFIER} {
+ // The parser
+ // is assuming
+ // that ALL identifiers
+ // in this state
+ // are base classes;
+ // it doesn't check to see
+ // that the first parenthesis
+ // has been seen.
+
+ // This is bad - it should
+ // probably be more strict
+ // about what to accept.
+
+ yyextra->curClassBases.inSort(yytext);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ // codify(yyscanner,yytext);
+ }
+
+ ":" {
+ codify(yyscanner,yytext);
+
+ // Assume this will
+ // be a one-line suite;
+ // found counter-example
+ // in SuiteStart.
+
+ // Push a class scope
+
+ std::unique_ptr<ClassDef> classDefToAdd { createClassDef("<code>",1,1,yyextra->curClassName,ClassDef::Class,0,0,FALSE) };
+ char *s=yyextra->curClassBases.first();
+ while (s)
+ {
+ const ClassDef *baseDefToAdd = 0;
+ // find class in the local scope
+ auto it = yyextra->codeClassMap.find(s);
+ if (it != yyextra->codeClassMap.end())
+ {
+ baseDefToAdd = it->second.get();
+ }
+ // Try to find class in global scope
+ if (baseDefToAdd==0)
+ {
+ baseDefToAdd=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,s);
+ }
+
+ if (baseDefToAdd && baseDefToAdd!=classDefToAdd.get())
+ {
+ classDefToAdd->insertBaseClass(const_cast<ClassDef*>(baseDefToAdd),s,Public,Normal);
+ }
+
+ s=yyextra->curClassBases.next();
+ }
+ yyextra->codeClassMap.emplace(std::make_pair(yyextra->curClassName.str(),std::move(classDefToAdd)));
+
+ // Reset class-parsing variables.
+ yyextra->curClassName.resize(0);
+ yyextra->curClassBases.clear();
+
+ yyextra->noSuiteFound = TRUE;
+ BEGIN( SuiteStart );
+ }
+}
+
+
+<FunctionDec>{
+ {IDENTIFIER} {
+ generateFunctionLink(yyscanner,*yyextra->code,yytext);
+ }
+
+ {B}"(" {
+ codify(yyscanner,yytext);
+ BEGIN( FunctionParams );
+ }
+}
+
+<FunctionParams>{
+ ({BB}|",") {
+ // Parses delimiters
+ codify(yyscanner,yytext);
+ }
+
+ ({IDENTIFIER}|{PARAMNONEMPTY}+) {
+ codify(yyscanner,yytext);
+ }
+
+ ")" {
+ codify(yyscanner,yytext);
+ }
+
+ "\n" {
+ codifyLines(yyscanner,yytext);
+ }
+
+ ":" {
+ codify(yyscanner,yytext);
+
+ // Assume this will
+ // be a one-line suite;
+ // found counter-example
+ // in SuiteStart.
+ yyextra->noSuiteFound = TRUE;
+ BEGIN( SuiteStart );
+ }
+}
+
+<Body,Suite>{
+
+ {KEYWORD} {
+ // Position-sensitive rules!
+ // Must come AFTER keyword-triggered rules
+ // Must come BEFORE identifier NONEMPTY-like rules
+ // to syntax highlight.
+
+ startFontClass(yyscanner,"keyword");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+ {FLOWKW} {
+ if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
+ {
+ yyextra->currentMemberDef->incrementFlowKeyWordCount();
+ }
+ startFontClass(yyscanner,"keywordflow");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+ ({IDENTIFIER}".")*{IDENTIFIER}/"(" {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ }
+ ({IDENTIFIER}".")+{IDENTIFIER} {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,TRUE);
+ }
+ {IDENTIFIER} { codify(yyscanner,yytext); }
+
+}
+
+
+
+<SuiteStart>{
+
+ {BB} {
+ codify(yyscanner,yytext);
+ }
+ "pass" {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN(Body);
+ }
+ {KEYWORD} {
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+
+ // No indentation necessary
+ yyextra->noSuiteFound = FALSE;
+ }
+
+ {FLOWKW} {
+ if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
+ {
+ yyextra->currentMemberDef->incrementFlowKeyWordCount();
+ }
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+
+ // No indentation necessary
+ yyextra->noSuiteFound = FALSE;
+ }
+ {IDENTIFIER} {
+ codify(yyscanner,yytext);
+ }
+
+
+ {POUNDCOMMENT} {
+ if (YY_START==SingleQuoteString ||
+ YY_START==DoubleQuoteString ||
+ YY_START==TripleString
+ )
+ {
+ REJECT;
+ }
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(DocBlock);
+ yyextra->docBlock=yytext;
+ }
+
+ {NEWLINE} {
+ codifyLines(yyscanner,yytext);
+ if ( yyextra->noSuiteFound )
+ {
+ // printf("New suite to capture! [%d]\n", yyextra->yyLineNr);
+ BEGIN ( SuiteCaptureIndent );
+ }
+ }
+}
+
+<SuiteCaptureIndent>{
+ "\n"|({BB}"\n") {
+ // Blankline - ignore, keep looking for indentation.
+ codifyLines(yyscanner,yytext);
+ }
+
+ {BB} {
+ // This state lasts momentarily,
+ // to check the indentation
+ // level that is about to be
+ // used.
+ codifyLines(yyscanner,yytext);
+ yyextra->indents.push(yyleng);
+ // printf("Captured indent of %d [line %d]\n", yyleng, yyextra->yyLineNr);
+ BEGIN( Suite );
+ }
+}
+
+<SuiteMaintain>{
+
+ {BB}/({NONEMPTY}|{EXPCHAR}) {
+ // This implements poor
+ // indentation-tracking;
+ // should be improved.
+ // (translate tabs to space, etc)
+ codifyLines(yyscanner,yytext);
+ adjustScopesAndSuites(yyscanner,static_cast<int>(yyleng));
+ }
+
+ "\n"|({BB}"\n") {
+ // If this ever succeeds,
+ // it means that this is
+ // a blank line, and
+ // can be ignored.
+ codifyLines(yyscanner,yytext);
+ }
+
+ ""/({NONEMPTY}|{EXPCHAR}) {
+ // Default rule; matches
+ // the empty string, assuming
+ // real text starts here.
+ // Just go straight to Body.
+ adjustScopesAndSuites(yyscanner,0);
+ }
+}
+
+
+<Suite>{NEWLINE} {
+ codifyLines(yyscanner,yytext);
+ BEGIN( SuiteMaintain );
+ }
+<Body>{IDENTIFIER} {
+ codify(yyscanner,yytext);
+ }
+<Body>{NEWLINE} {
+ codifyLines(yyscanner,yytext);
+ }
+
+<SingleQuoteString>{ // Single quoted string like 'That\'s a """nice""" string!'
+ \\{B}\n { // line continuation
+ codifyLines(yyscanner,yytext);
+ }
+ \\. { // escaped char
+ codify(yyscanner,yytext);
+ }
+ {STRINGPREFIX}?{TRIDOUBLEQUOTE} { // triple double quotes
+ codify(yyscanner,yytext);
+ }
+ "'" { // end of the string
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN(yyextra->stringContext);
+ }
+ [^"'\n\\]+ { // normal chars
+ codify(yyscanner,yytext);
+ }
+ . { // normal char
+ codify(yyscanner,yytext);
+ }
+}
+
+<DoubleQuoteString>{ // Double quoted string like "That's \"a '''nice'''\" string!"
+ \\{B}\n { // line continuation
+ codifyLines(yyscanner,yytext);
+ }
+ \\. { // escaped char
+ codify(yyscanner,yytext);
+ }
+ {STRINGPREFIX}?{TRISINGLEQUOTE} { // triple single quotes
+ codify(yyscanner,yytext);
+ }
+ "\"" { // end of the string
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ BEGIN(yyextra->stringContext);
+ }
+ [^"'\n\\]+ { // normal chars
+ codify(yyscanner,yytext);
+ }
+ . { // normal char
+ codify(yyscanner,yytext);
+ }
+}
+
+<TripleString>{
+ {TRIDOUBLEQUOTE} |
+ {TRISINGLEQUOTE} {
+ codify(yyscanner,yytext);
+ if (yyextra->doubleQuote==(yytext[0]=='"'))
+ {
+ endFontClass(yyscanner);
+ BEGIN(yyextra->stringContext);
+ }
+ }
+ {LONGSTRINGBLOCK} {
+ codifyLines(yyscanner,yytext);
+ }
+ \n {
+ codifyLines(yyscanner,yytext);
+ }
+ . {
+ codify(yyscanner,yytext);
+ }
+}
+
+
+<*>{STRINGPREFIX}?{TRISINGLEQUOTE} {
+ if (YY_START==SingleQuoteString) REJECT;
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->stringContext=YY_START;
+ yyextra->doubleQuote=yytext[yyleng-1]=='"';
+ codify(yyscanner,yytext);
+ BEGIN(TripleString);
+ }
+<*>{STRINGPREFIX}?{TRIDOUBLEQUOTE} {
+ if (YY_START==DoubleQuoteString) REJECT;
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->stringContext=YY_START;
+ yyextra->doubleQuote=yytext[yyleng-1]=='"';
+ codify(yyscanner,yytext);
+ BEGIN(TripleString);
+ }
+<*>{STRINGPREFIX}?"'" { // single quoted string
+ if (YY_START==SingleQuoteString ||
+ YY_START==DoubleQuoteString ||
+ YY_START==TripleString)
+ {
+ REJECT;
+ }
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->stringContext=YY_START;
+ codify(yyscanner,yytext);
+ BEGIN(SingleQuoteString);
+ }
+<*>{STRINGPREFIX}?"\"" { // double quoted string
+ if (YY_START==SingleQuoteString ||
+ YY_START==DoubleQuoteString ||
+ YY_START==TripleString)
+ {
+ REJECT;
+ }
+ startFontClass(yyscanner,"stringliteral");
+ yyextra->stringContext=YY_START;
+ codify(yyscanner,yytext);
+ BEGIN(DoubleQuoteString);
+ }
+<DocBlock>.* { // contents of current comment line
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>"\n"{B}("#") { // comment block (next line is also comment line)
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>{NEWLINE} { // comment block ends at the end of this line
+ // remove special comment (default config)
+ if (Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ yyextra->yyLineNr+=((QCString)yyextra->docBlock).contains('\n');
+ yyextra->endComment=TRUE;
+ }
+ else // do not remove comment
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yyextra->docBlock);
+ endFontClass(yyscanner);
+ }
+ unput(*yytext);
+ yy_pop_state(yyscanner);
+ }
+<*>{POUNDCOMMENT}.* {
+ if (YY_START==SingleQuoteString ||
+ YY_START==DoubleQuoteString ||
+ YY_START==TripleString)
+ {
+ REJECT;
+ }
+ yy_push_state(YY_START,yyscanner);
+ BEGIN(DocBlock);
+ yyextra->docBlock=yytext;
+ }
+<*>"#".* { // normal comment
+ if (YY_START==SingleQuoteString ||
+ YY_START==DoubleQuoteString ||
+ YY_START==TripleString)
+ {
+ REJECT;
+ }
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<*>{NEWLINE} {
+ if (yyextra->endComment)
+ {
+ yyextra->endComment=FALSE;
+ }
+ else
+ {
+ codifyLines(yyscanner,yytext);
+ }
+ //printf("[pycode] %d NEWLINE [line %d] no match\n",
+ // YY_START, yyextra->yyLineNr);
+
+ BEGIN(Body);
+ }
+
+<*>[ \t]+ {
+ codify(yyscanner,yytext);
+ BEGIN(Body);
+ }
+<*>. {
+ codify(yyscanner,yytext);
+ // printf("[pycode] '%s' [ state %d ] [line %d] no match\n",
+ // yytext, YY_START, yyextra->yyLineNr);
+
+ BEGIN(Body);
+ }
+
+<*><<EOF>> {
+ if (YY_START==DocBlock && !Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yyextra->docBlock);
+ endFontClass(yyscanner);
+ }
+ yyterminate();
+ }
+%%
+
+/*@ ----------------------------------------------------------------------------
+ */
+
+void PyVariableContext::addVariable(yyscan_t yyscanner, const QCString &type,const QCString &name)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("PyVariableContext::addVariable(%s,%s)\n",type.data(),name.data());
QCString ltype = type.simplifyWhiteSpace();
QCString lname = name.simplifyWhiteSpace();
- Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast();
- const ClassDef *varType;
- if (
- (varType=g_codeClassSDict[ltype]) || // look for class definitions inside the code block
- (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,ltype)) // look for global class definitions
- )
+ Scope *scope = m_scopes.empty() ? &m_globalScope : &m_scopes.back();
+ const ClassDef *varType = 0;
+ auto it = yyextra->codeClassMap.find(ltype.str());
+ if (it!=yyextra->codeClassMap.end())
+ {
+ varType = it->second.get();
+ }
+ if (varType==0)
{
- scope->append(lname,varType); // add it to a list
+ varType = getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,ltype); // look for global class definitions
}
- else
+ if (varType)
{
- if (m_scopes.count()>0) // for local variables add a dummy entry so the name
- // is hidden to avoid FALSE links to global variables with the same name
- // TODO: make this work for namespaces as well!
+ scope->emplace(std::make_pair(lname.str(),varType)); // add it to a list
+ }
+ else
+ {
+ if (!m_scopes.empty()) // for local variable add a dummy entry to avoid linking to a global that is
+ // shadowed.
{
- scope->append(lname,dummyContext);
+ scope->emplace(std::make_pair(lname.str(),dummyContext));
}
}
}
-ClassDef *PyVariableContext::findVariable(const QCString &name)
+const ClassDef *PyVariableContext::findVariable(const QCString &name)
{
if (name.isEmpty()) return 0;
- ClassDef *result = 0;
- QListIterator<Scope> sli(m_scopes);
- Scope *scope;
+ const ClassDef *result = 0;
+
// search from inner to outer scope
- for (sli.toLast();(scope=sli.current());--sli)
+ auto it = std::rbegin(m_scopes);
+ while (it != std::rend(m_scopes))
{
- result = scope->find(name);
- if (result)
+ auto it2 = it->find(name.str());
+ if (it2 != std::end(*it))
{
+ result = it2->second;
return result;
}
+ ++it;
}
// nothing found -> also try the global scope
- result=m_globalScope.find(name);
+ auto it2 = m_globalScope.find(name.str());
+ if (it2 != m_globalScope.end())
+ {
+ result = it2->second;
+ }
return result;
}
-static PyVariableContext g_theVarContext;
-const ClassDef *PyVariableContext::dummyContext = (ClassDef*)0x8;
+//-------------------------------------------------------------------------------
-class PyCallContext
+static yy_size_t yyread(yyscan_t yyscanner, char *buf,yy_size_t max_size)
{
- public:
- struct Ctx
- {
- Ctx() : name(g_name), type(g_type), cd(0) {}
- QCString name;
- QCString type;
- const ClassDef *cd;
- };
-
- PyCallContext()
- {
- m_classList.append(new Ctx);
- m_classList.setAutoDelete(TRUE);
- }
-
- virtual ~PyCallContext() {}
-
- void setClass(const ClassDef *cd)
- {
- Ctx *ctx = m_classList.getLast();
- if (ctx)
- {
- ctx->cd=cd;
- }
- }
- void pushScope()
- {
- m_classList.append(new Ctx);
- }
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yy_size_t inputPosition = yyextra->inputPosition;
+ const char *s = yyextra->inputString + inputPosition;
+ yy_size_t c=0;
+ while( c < max_size && *s )
+ {
+ *buf++ = *s++;
+ c++;
+ }
+ yyextra->inputPosition += c;
+ return c;
+}
- void popScope()
- {
- if (m_classList.count()>1)
- {
- Ctx *ctx = m_classList.getLast();
- if (ctx)
- {
- g_name = ctx->name;
- g_type = ctx->type;
- }
- m_classList.removeLast();
- }
- else
- {
- }
- }
+//-------------------------------------------------------------------------------
- void clear()
- {
- m_classList.clear();
- m_classList.append(new Ctx);
- }
-
- const ClassDef *getClass() const
+/*!
+ Examines current stack of white-space indentations;
+ re-syncs the parser with the correct scope.
+*/
+static void adjustScopesAndSuites(yyscan_t yyscanner,unsigned indentLength)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ // States to pop
+ if (!yyextra->indents.empty() && indentLength < yyextra->indents.top())
+ {
+ while (!yyextra->indents.empty() && indentLength < yyextra->indents.top())
{
- Ctx *ctx = m_classList.getLast();
+ // printf("Exited scope indent of [%d]\n", yyextra->indents.top());
+ yyextra->indents.pop(); // Pop the old suite's indentation
- if (ctx)
- return ctx->cd;
- else
- return 0;
+ yyextra->currentMemberDef=0;
+ if (yyextra->currentDefinition)
+ yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope();
}
+ }
- private:
- QList<Ctx> m_classList;
-};
-
-static PyCallContext g_theCallContext;
+ // Are there any remaining indentation levels for suites?
+ if (!yyextra->indents.empty())
+ {
+ BEGIN( Suite );
+ }
+ else
+ {
+ BEGIN( Body );
+ }
+}
+//-------------------------------------------------------------------------------
/*! counts the number of lines in the input */
-static int countLines()
+static int countLines(yyscan_t yyscanner)
{
- const char *p=g_inputString;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *p=yyextra->inputString;
char c;
int count=1;
- while ((c=*p))
- {
- p++ ;
- if (c=='\n') count++;
+ while ((c=*p))
+ {
+ p++;
+ if (c=='\n') count++;
}
- if (p>g_inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
- count++,
- g_needsTermination=TRUE;
- }
+ count++;
+ yyextra->needsTermination=TRUE;
+ }
return count;
}
-static void setCurrentDoc(const QCString &anchor)
+//-------------------------------------------------------------------------------
+
+static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- if (g_searchCtx)
+ if (yyextra->searchCtx)
{
- Doxygen::searchIndex->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE);
+ yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),FALSE);
}
else
{
- Doxygen::searchIndex->setCurrentDoc(g_sourceFileDef,anchor,TRUE);
+ yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,TRUE);
}
}
}
-static void addToSearchIndex(const char *text)
+//-------------------------------------------------------------------------------
+
+static void addToSearchIndex(yyscan_t yyscanner, const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- Doxygen::searchIndex->addWord(text,FALSE);
+ yyextra->code->addWord(text,FALSE);
}
}
+//-------------------------------------------------------------------------------
-static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition)
+static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
int pos=0;
QCString type = s;
QCString className;
@@ -339,15 +1065,14 @@ static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefin
while (extractClassNameFromType(type,pos,className,templSpec)!=-1)
{
QCString clName=className+templSpec;
-
const ClassDef *cd=0;
- if (!g_classScope.isEmpty())
+ if (!yyextra->classScope.isEmpty())
{
- cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName);
+ cd=getResolvedClass(d,yyextra->sourceFileDef,yyextra->classScope+"::"+clName);
}
if (cd==0)
{
- cd=getResolvedClass(d,g_sourceFileDef,clName);
+ cd=getResolvedClass(d,yyextra->sourceFileDef,clName);
}
if (cd)
{
@@ -358,104 +1083,117 @@ static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefin
return 0;
}
+//-------------------------------------------------------------------------------
-
-/*! start a new line of code, inserting a line number if g_sourceFileDef
+/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
* is TRUE. If a definition starts at the current line, then the line
* number is linked to the documentation of that definition.
*/
-static void startCodeLine()
+static void startCodeLine(yyscan_t yyscanner)
{
- //if (g_currentFontClass) { g_code->endFontClass(); }
- if (g_sourceFileDef)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //if (yyextra->currentFontClass) { yyextra->code->endFontClass(yyscanner); }
+ if (yyextra->sourceFileDef)
{
//QCString lineNumber,lineAnchor;
- //lineNumber.sprintf("%05d",g_yyLineNr);
- //lineAnchor.sprintf("l%05d",g_yyLineNr);
-
- Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr);
- //printf("startCodeLine %d d=%p\n",g_yyLineNr,d);
- //g_code->startLineNumber();
-
- if (!g_includeCodeFragment && d && d->isLinkableInProject())
+ //lineNumber.sprintf("%05d",yyextra->yyLineNr);
+ //lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+
+ Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
+ //printf("startCodeLine %d d=%p\n",yyextra->yyLineNr,d);
+ //yyextra->code->startLineNumber();
+
+ if (!yyextra->includeCodeFragment && d && d->isLinkableInProject())
{
- g_currentDefinition = d;
- g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr);
- //g_insideBody = FALSE;
- g_endComment = FALSE;
- g_searchingForBody = TRUE;
- g_realScope = d->name().copy();
- g_classScope = d->name().copy();
- //printf("Real scope: '%s'\n",g_realScope.data());
- g_bodyCurlyCount = 0;
+ yyextra->currentDefinition = d;
+ yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
+ //yyextra->insideBody = FALSE;
+ yyextra->endComment = FALSE;
+ yyextra->searchingForBody = TRUE;
+ yyextra->realScope = d->name().copy();
+ yyextra->classScope = d->name().copy();
+ //printf("Real scope: '%s'\n",yyextra->realScope.data());
+ yyextra->bodyCurlyCount = 0;
QCString lineAnchor;
- lineAnchor.sprintf("l%05d",g_yyLineNr);
- if (g_currentMemberDef)
+ lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+ if (yyextra->currentMemberDef)
{
- g_code->writeLineNumber(g_currentMemberDef->getReference(),
- g_currentMemberDef->getOutputFileBase(),
- g_currentMemberDef->anchor(),g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
+ yyextra->currentMemberDef->getOutputFileBase(),
+ yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
else
{
- g_code->writeLineNumber(d->getReference(),
- d->getOutputFileBase(),
- 0,g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(d->getReference(),
+ d->getOutputFileBase(),
+ 0,yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
}
else
{
- //g_code->codify(lineNumber);
- g_code->writeLineNumber(0,0,0,g_yyLineNr);
+ //yyextra->code->codify(lineNumber);
+ yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr);
}
- //g_code->endLineNumber();
+ //yyextra->code->endLineNumber();
}
- g_code->startCodeLine(g_sourceFileDef);
- if (g_currentFontClass)
+ yyextra->code->startCodeLine(yyextra->sourceFileDef);
+ if (yyextra->currentFontClass)
{
- g_code->startFontClass(g_currentFontClass);
+ yyextra->code->startFontClass(yyextra->currentFontClass);
}
}
-static void codify(const char* text)
-{
- g_code->codify(text);
+//-------------------------------------------------------------------------------
+
+static void codify(yyscan_t yyscanner,const char* text)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->code->codify(text);
}
-static void endCodeLine()
+//-------------------------------------------------------------------------------
+
+static void endCodeLine(yyscan_t yyscanner)
{
- endFontClass();
- g_code->endCodeLine();
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endFontClass(yyscanner);
+ yyextra->code->endCodeLine();
}
-static void nextCodeLine()
+//-------------------------------------------------------------------------------
+
+static void nextCodeLine(yyscan_t yyscanner)
{
- const char *fc = g_currentFontClass;
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *fc = yyextra->currentFontClass;
+ endCodeLine(yyscanner);
+ if (yyextra->yyLineNr<yyextra->inputLines)
{
- g_currentFontClass = fc;
- startCodeLine();
+ yyextra->currentFontClass = fc;
+ startCodeLine(yyscanner);
}
}
+//-------------------------------------------------------------------------------
/*! writes a link to a fragment \a text that may span multiple lines, inserting
- * line numbers for each line. If \a text contains newlines, the link will be
+ * line numbers for each line. If \a text contains newlines, the link will be
* split into multiple links with the same destination, one for each line.
*/
-static void writeMultiLineCodeLink(CodeOutputInterface &ol,
+static void writeMultiLineCodeLink(yyscan_t yyscanner,
+ CodeOutputInterface &ol,
const Definition *d,
const char *text)
{
- static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
- QCString tooltip;
+ QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
@@ -469,11 +1207,11 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
while ((c=*p++) && c!='\n') { }
if (c=='\n')
{
- g_yyLineNr++;
+ yyextra->yyLineNr++;
*(p-1)='\0';
//printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
- nextCodeLine();
+ nextCodeLine(yyscanner);
}
else
{
@@ -484,141 +1222,149 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
}
}
-static void startFontClass(const char *s)
+//-------------------------------------------------------------------------------
+
+static void startFontClass(yyscan_t yyscanner,const char *s)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
// if font class is already set don't stop and start it.
// strcmp does not like null pointers as input.
- if (!g_currentFontClass || !s || strcmp(g_currentFontClass,s))
+ if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
{
- endFontClass();
- g_code->startFontClass(s);
- g_currentFontClass=s;
+ endFontClass(yyscanner);
+ yyextra->code->startFontClass(s);
+ yyextra->currentFontClass=s;
}
}
-static void endFontClass()
+//-------------------------------------------------------------------------------
+
+static void endFontClass(yyscan_t yyscanner)
{
- if (g_currentFontClass)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->currentFontClass)
{
- g_code->endFontClass();
- g_currentFontClass=0;
+ yyextra->code->endFontClass();
+ yyextra->currentFontClass=0;
}
}
-static void codifyLines(char *text)
+//-------------------------------------------------------------------------------
+
+static void codifyLines(yyscan_t yyscanner,const char *text)
{
- //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text);
- char *p=text,*sp=p;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text);
+ const char *p=text,*sp=p;
char c;
bool done=FALSE;
- const char * tmp_currentFontClass = g_currentFontClass;
while (!done)
{
sp=p;
while ((c=*p++) && c!='\n') { }
if (c=='\n')
{
- g_yyLineNr++;
- *(p-1)='\0';
- g_code->codify(sp);
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
- {
- startCodeLine();
- }
- if (tmp_currentFontClass)
- {
- startFontClass(tmp_currentFontClass);
- }
+ yyextra->yyLineNr++;
+ int l = (int)(p-sp-1);
+ char *tmp = (char*)malloc(l+1);
+ memcpy(tmp,sp,l);
+ tmp[l]='\0';
+ yyextra->code->codify(tmp);
+ free(tmp);
+ nextCodeLine(yyscanner);
}
else
{
- g_code->codify(sp);
+ yyextra->code->codify(sp);
done=TRUE;
}
}
}
-static void codifyLines(const QCString &str)
-{
- char *tmp= (char *)malloc(str.length()+1);
- qstrcpy(tmp, str);
- codifyLines(tmp);
- free(tmp);
-}
+//-------------------------------------------------------------------------------
-static bool getLinkInScope(const QCString &c, // scope
+static bool getLinkInScope(yyscan_t yyscanner,
+ const QCString &c, // scope
const QCString &m, // member
- const char *memberText, // exact text
- CodeOutputInterface &ol,
- const char *text
- )
+ const char *memberText, // exact text
+ CodeOutputInterface &ol,
+ const char *text
+ )
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
const MemberDef *md = 0;
const ClassDef *cd = 0;
const FileDef *fd = 0;
const NamespaceDef *nd = 0;
const GroupDef *gd = 0;
//printf("Trying '%s'::'%s'\n",c.data(),m.data());
- if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,g_sourceFileDef) &&
+ if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef) &&
md->isLinkable())
{
//Definition *d=0;
//if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
const Definition *d = md->getOuterScope()==Doxygen::globalScope ?
- md->getBodyDef() : md->getOuterScope();
+ md->getBodyDef() : md->getOuterScope();
//printf("Found! d=%s\n",d?d->name().data():"<none>");
if (md->getGroupDef()) d = md->getGroupDef();
if (d && d->isLinkable())
{
- g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope()));
- //printf("g_currentDefinition=%p g_currentMemberDef=%p\n",
- // g_currentDefinition,g_currentMemberDef);
+ yyextra->theCallContext.setClass(stripClassName(yyscanner,md->typeString(),md->getOuterScope()));
+ //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p\n",
+ // yyextra->currentDefinition,yyextra->currentMemberDef);
- if (g_currentDefinition && g_currentMemberDef &&
- md!=g_currentMemberDef && g_collectXRefs)
+ if (yyextra->currentDefinition && yyextra->currentMemberDef &&
+ md!=yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md));
+ addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(md));
}
//printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
-
- writeMultiLineCodeLink(ol,md, text ? text : memberText);
- addToSearchIndex(text ? text : memberText);
+
+ writeMultiLineCodeLink(yyscanner,ol,md, text ? text : memberText);
+ addToSearchIndex(yyscanner,text ? text : memberText);
return TRUE;
- }
+ }
}
return FALSE;
}
-static bool getLink(const char *className,
+//-------------------------------------------------------------------------------
+
+static bool getLink(yyscan_t yyscanner,
+ const char *className,
const char *memberName,
- CodeOutputInterface &ol,
- const char *text=0)
+ CodeOutputInterface &ol,
+ const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString m=removeRedundantWhiteSpace(memberName);
QCString c=className;
- if (!getLinkInScope(c,m,memberName,ol,text))
+ if (!getLinkInScope(yyscanner,c,m,memberName,ol,text))
{
- if (!g_curClassName.isEmpty())
+ if (!yyextra->curClassName.isEmpty())
{
if (!c.isEmpty()) c.prepend("::");
- c.prepend(g_curClassName);
- return getLinkInScope(c,m,memberName,ol,text);
+ c.prepend(yyextra->curClassName);
+ return getLinkInScope(yyscanner,c,m,memberName,ol,text);
}
return FALSE;
}
return TRUE;
}
+//-------------------------------------------------------------------------------
/*
For a given string in the source code,
finds its class or global id and links to it.
*/
-static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
- bool typeOnly=FALSE)
+static void generateClassOrGlobalLink(yyscan_t yyscanner,
+ CodeOutputInterface &ol,
+ const char *clName,
+ bool typeOnly)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString className=clName;
// Don't do anything for empty text
@@ -630,16 +1376,16 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
const MemberDef *md=0; /** Member def that we may find */
//bool isLocal=FALSE;
- if ((lcd=g_theVarContext.findVariable(className))==0) // not a local variable
+ if ((lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable
{
- Definition *d = g_currentDefinition;
+ Definition *d = yyextra->currentDefinition;
QCString scope = substitute(className,".","::");
- cd = getResolvedClass(d,g_sourceFileDef,substitute(className,".","::"),&md);
+ cd = getResolvedClass(d,yyextra->sourceFileDef,substitute(className,".","::"),&md);
- DBG_CTX((stderr,"d=%s g_sourceFileDef=%s\n",
+ DBG_CTX((stderr,"d=%s yyextra->sourceFileDef=%s\n",
d?d->displayName().data():"<null>",
- g_currentDefinition?g_currentDefinition->displayName().data():"<null>"));
+ yyextra->currentDefinition?yyextra->currentDefinition->displayName().data():"<null>"));
DBG_CTX((stderr,"is found as a type %s\n",cd?cd->name().data():"<null>"));
if (cd==0 && md==0) // also see if it is variable or enum or enum value
@@ -647,21 +1393,21 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
const NamespaceDef *nd = getResolvedNamespace(scope);
if (nd)
{
- writeMultiLineCodeLink(ol,nd,clName);
- addToSearchIndex(className);
+ writeMultiLineCodeLink(yyscanner,ol,nd,clName);
+ addToSearchIndex(yyscanner,className);
return;
}
- else if (getLink(g_classScope,clName,ol,clName))
+ else if (getLink(yyscanner,yyextra->classScope,clName,ol,clName))
{
- return;
+ return;
}
}
}
else
{
- if (lcd!=PyVariableContext::dummyContext)
+ if (lcd!=PyVariableContext::dummyContext)
{
- g_theCallContext.setClass(lcd);
+ yyextra->theCallContext.setClass(lcd);
}
//isLocal=TRUE;
DBG_CTX((stderr,"is a local variable cd=%p!\n",cd));
@@ -669,17 +1415,17 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
if (cd && cd->isLinkable()) // is it a linkable class
{
- writeMultiLineCodeLink(ol,cd,clName);
- addToSearchIndex(className);
+ writeMultiLineCodeLink(yyscanner,ol,cd,clName);
+ addToSearchIndex(yyscanner,className);
if (md)
{
const Definition *d = md->getOuterScope()==Doxygen::globalScope ?
md->getBodyDef() : md->getOuterScope();
if (md->getGroupDef()) d = md->getGroupDef();
- if (d && d->isLinkable() && md->isLinkable() &&
- g_currentMemberDef && g_collectXRefs)
+ if (d && d->isLinkable() && md->isLinkable() &&
+ yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(g_currentMemberDef,const_cast<MemberDef*>(md));
+ addDocCrossReference(yyextra->currentMemberDef,const_cast<MemberDef*>(md));
}
}
}
@@ -694,55 +1440,57 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",scope.data(),locName.data(),mcd));
if (mcd)
{
- MemberDef *mmd = mcd->getMemberByName(locName);
- if (mmd)
- {
- g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope()));
- writeMultiLineCodeLink(ol,mmd,clName);
- addToSearchIndex(className);
- const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ?
- mmd->getBodyDef() : mmd->getOuterScope();
- if (mmd->getGroupDef()) d = mmd->getGroupDef();
- if (d && d->isLinkable() && mmd->isLinkable() &&
- g_currentMemberDef && g_collectXRefs)
- {
- addDocCrossReference(g_currentMemberDef,mmd);
- }
- return;
- }
+ MemberDef *mmd = mcd->getMemberByName(locName);
+ if (mmd)
+ {
+ yyextra->theCallContext.setClass(stripClassName(yyscanner,mmd->typeString(),mmd->getOuterScope()));
+ writeMultiLineCodeLink(yyscanner,ol,mmd,clName);
+ addToSearchIndex(yyscanner,className);
+ const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ?
+ mmd->getBodyDef() : mmd->getOuterScope();
+ if (mmd->getGroupDef()) d = mmd->getGroupDef();
+ if (d && d->isLinkable() && mmd->isLinkable() &&
+ yyextra->currentMemberDef && yyextra->collectXRefs)
+ {
+ addDocCrossReference(yyextra->currentMemberDef,mmd);
+ }
+ return;
+ }
}
else // check namespace as well
{
const NamespaceDef *mnd = getResolvedNamespace(scope);
if (mnd)
{
- MemberDef *mmd=mnd->getMemberByName(locName);
- if (mmd)
+ MemberDef *mmd=mnd->getMemberByName(locName);
+ if (mmd)
{
- //printf("name=%s scope=%s\n",locName.data(),scope.data());
- g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope()));
- writeMultiLineCodeLink(ol,mmd,clName);
- addToSearchIndex(className);
- const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ?
- mmd->getBodyDef() : mmd->getOuterScope();
- if (mmd->getGroupDef()) d = mmd->getGroupDef();
- if (d && d->isLinkable() && mmd->isLinkable() &&
- g_currentMemberDef && g_collectXRefs)
- {
- addDocCrossReference(g_currentMemberDef,mmd);
- }
- return;
+ //printf("name=%s scope=%s\n",locName.data(),scope.data());
+ yyextra->theCallContext.setClass(stripClassName(yyscanner,mmd->typeString(),mmd->getOuterScope()));
+ writeMultiLineCodeLink(yyscanner,ol,mmd,clName);
+ addToSearchIndex(yyscanner,className);
+ const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ?
+ mmd->getBodyDef() : mmd->getOuterScope();
+ if (mmd->getGroupDef()) d = mmd->getGroupDef();
+ if (d && d->isLinkable() && mmd->isLinkable() &&
+ yyextra->currentMemberDef && yyextra->collectXRefs)
+ {
+ addDocCrossReference(yyextra->currentMemberDef,mmd);
+ }
+ return;
}
}
}
}
-
+
// nothing found, just write out the word
- codifyLines(clName);
- addToSearchIndex(clName);
+ codifyLines(yyscanner,clName);
+ addToSearchIndex(yyscanner,clName);
}
}
+//-------------------------------------------------------------------------------
+
/*
As of June 1, this function seems to work
for file members, but scopes are not
@@ -750,11 +1498,13 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName,
so it doesn't work for classes yet.
*/
-static void generateFunctionLink(CodeOutputInterface &ol,char *funcName)
+static void generateFunctionLink(yyscan_t yyscanner,
+ CodeOutputInterface &ol,
+ const char *funcName)
{
- //CodeClassDef *ccd=0;
- ClassDef *ccd=0;
- QCString locScope=g_classScope.copy();
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const ClassDef *ccd=0;
+ QCString locScope=yyextra->classScope.copy();
QCString locFunc=removeRedundantWhiteSpace(funcName);
DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data()));
int i=locFunc.findRev("::");
@@ -764,915 +1514,222 @@ static void generateFunctionLink(CodeOutputInterface &ol,char *funcName)
locFunc=locFunc.right(locFunc.length()-i-2).stripWhiteSpace();
}
//printf("generateFunctionLink(%s) classScope='%s'\n",locFunc.data(),locScope.data());
- if (!locScope.isEmpty() && (ccd=g_codeClassSDict[locScope]))
+ if (!locScope.isEmpty())
{
- //printf("using classScope %s\n",g_classScope.data());
- if (ccd->baseClasses())
+ auto it = yyextra->codeClassMap.find(locScope.str());
+ if (it!=yyextra->codeClassMap.end())
+ {
+ ccd = it->second.get();
+ }
+ //printf("using classScope %s\n",yyextra->classScope.data());
+ if (ccd && ccd->baseClasses())
{
BaseClassListIterator bcli(*ccd->baseClasses());
for ( ; bcli.current() ; ++bcli)
{
- if (getLink(bcli.current()->classDef->name(),locFunc,ol,funcName))
- {
- return;
- }
+ if (getLink(yyscanner,bcli.current()->classDef->name(),locFunc,ol,funcName))
+ {
+ return;
+ }
}
}
}
- if (!getLink(locScope,locFunc,ol,funcName))
+ if (!getLink(yyscanner,locScope,locFunc,ol,funcName))
{
- generateClassOrGlobalLink(ol,funcName);
+ generateClassOrGlobalLink(yyscanner,ol,funcName);
}
return;
}
-static bool findMemberLink(CodeOutputInterface &ol,Definition *sym,const char *symName)
+//-------------------------------------------------------------------------------
+
+static bool findMemberLink(yyscan_t yyscanner,
+ CodeOutputInterface &ol,
+ Definition *sym,
+ const char *symName)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("sym %s outerScope=%s equal=%d\n",
// sym->name().data(),sym->getOuterScope()->name().data(),
- // sym->getOuterScope()==g_currentDefinition);
+ // sym->getOuterScope()==yyextra->currentDefinition);
if (sym->getOuterScope() &&
sym->getOuterScope()->definitionType()==Definition::TypeClass &&
- g_currentDefinition->definitionType()==Definition::TypeClass)
+ yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
ClassDef *cd = dynamic_cast<ClassDef*>(sym->getOuterScope());
- ClassDef *thisCd = dynamic_cast<ClassDef *>(g_currentDefinition);
+ ClassDef *thisCd = dynamic_cast<ClassDef *>(yyextra->currentDefinition);
if (sym->definitionType()==Definition::TypeMember)
{
- if (g_currentMemberDef && g_collectXRefs)
+ if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(g_currentMemberDef,dynamic_cast<MemberDef*>(sym));
+ addDocCrossReference(yyextra->currentMemberDef,dynamic_cast<MemberDef*>(sym));
}
}
DBG_CTX((stderr,"cd=%s thisCd=%s\n",cd?cd->name().data():"<none>",thisCd?thisCd->name().data():"<none>"));
// TODO: find the nearest base class in case cd is a base class of
- // thisCd
+ // thisCd
if (cd==thisCd || (thisCd && thisCd->isBaseClass(cd,TRUE)))
{
- writeMultiLineCodeLink(ol,sym,symName);
+ writeMultiLineCodeLink(yyscanner,ol,sym,symName);
return TRUE;
}
}
return FALSE;
}
-static void findMemberLink(CodeOutputInterface &ol,char *symName)
+//-------------------------------------------------------------------------------
+
+static void findMemberLink(yyscan_t yyscanner,
+ CodeOutputInterface &ol,
+ const char *symName)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("Member reference: %s scope=%s member=%s\n",
// yytext,
- // g_currentDefinition?g_currentDefinition->name().data():"<none>",
- // g_currentMemberDef?g_currentMemberDef->name().data():"<none>"
+ // yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>",
+ // yyextra->currentMemberDef?yyextra->currentMemberDef->name().data():"<none>"
// );
- if (g_currentDefinition)
+ if (yyextra->currentDefinition)
{
DefinitionIntf *di = Doxygen::symbolMap->find(symName);
if (di)
{
if (di->definitionType()==DefinitionIntf::TypeSymbolList) // multiple symbols
{
- DefinitionListIterator dli(*(DefinitionList*)di);
- Definition *sym;
- for (dli.toFirst();(sym=dli.current());++dli)
- {
- if (findMemberLink(ol,sym,symName)) return;
- }
+ DefinitionListIterator dli(*(DefinitionList*)di);
+ Definition *sym;
+ for (dli.toFirst();(sym=dli.current());++dli)
+ {
+ if (findMemberLink(yyscanner,ol,sym,symName)) return;
+ }
}
else // single symbol
{
- if (findMemberLink(ol,(Definition*)di,symName)) return;
+ if (findMemberLink(yyscanner,ol,(Definition*)di,symName)) return;
}
}
}
//printf("sym %s not found\n",&yytext[5]);
- codify(symName);
+ codify(yyscanner,symName);
}
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
-
-static yy_size_t yyread(char *buf,yy_size_t max_size)
-{
- yy_size_t c=0;
- while( c < max_size && g_inputString[g_inputPosition] )
- {
- *buf = g_inputString[g_inputPosition++] ;
- c++; buf++;
- }
- return c;
-}
-
-%}
-
-
-BB [ \t]+
-B [ \t]*
-NEWLINE \n
-
-DIGIT [0-9]
-LETTER [A-Za-z\x80-\xFF]
-NONEMPTY [A-Za-z0-9_\x80-\xFF]
-EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-]
-NONEMPTYEXP [^ \t\n:]
-PARAMNONEMPTY [^ \t\n():]
-IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")*
-BORDER ([^A-Za-z0-9])
-
-POUNDCOMMENT "##"
-
-TRISINGLEQUOTE "'''"
-TRIDOUBLEQUOTE "\"\"\""
-LONGSTRINGCHAR [^\\"']
-ESCAPESEQ ("\\")(.)
-LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ})
-SMALLQUOTE ("\"\""|"\""|"'"|"''")
-LONGSTRINGBLOCK ({LONGSTRINGITEM}+|{SMALLQUOTE})
-
-SHORTSTRING ("'"{SHORTSTRINGITEM}*"'"|'"'{SHORTSTRINGITEM}*'"')
-SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ})
-SHORTSTRINGCHAR [^\\\n"]
-STRINGLITERAL {STRINGPREFIX}?( {SHORTSTRING} | {LONGSTRING})
-STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR")
-KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"def"|"True"|"False")
-FLOWKW ("or"|"and"|"is"|"not"|"print"|"for"|"in"|"if"|"try"|"except"|"yield"|"raise"|"break"|"continue"|"pass"|"if"|"return"|"while"|"elif"|"else"|"finally")
-QUOTES ("\""[^"]*"\"")
-SINGLEQUOTES ("'"[^']*"'")
-
-LONGINTEGER {INTEGER}("l"|"L")
-INTEGER ({DECIMALINTEGER}|{OCTINTEGER}|{HEXINTEGER})
-DECIMALINTEGER ({NONZERODIGIT}{DIGIT}*|"0")
-OCTINTEGER "0"{OCTDIGIT}+
-HEXINTEGER "0"("x"|"X"){HEXDIGIT}+
-NONZERODIGIT [1-9]
-OCTDIGIT [0-7]
-HEXDIGIT ({DIGIT}|[a-f]|[A-F])
-FLOATNUMBER ({POINTFLOAT}|{EXPONENTFLOAT})
-POINTFLOAT ({INTPART}?{FRACTION}|{INTPART}".")
-EXPONENTFLOAT ({INTPART}|{POINTFLOAT}){EXPONENT}
-INTPART {DIGIT}+
-FRACTION "."{DIGIT}+
-EXPONENT ("e"|"E")("+"|"-")?{DIGIT}+
-IMAGNUMBER ({FLOATNUMBER}|{INTPART})("j"|"J")
-ATOM ({IDENTIFIER}|{LITERAL}|{ENCLOSURE})
-ENCLOSURE ({PARENTH_FORM}|{LIST_DISPLAY}|{DICT_DISPLAY}|{STRING_CONVERSION})
-LITERAL ({STRINGLITERAL}|{INTEGER}|{LONGINTEGER}|{FLOATNUMBER}|{IMAGNUMBER})
-PARENTH_FORM "("{EXPRESSION_LIST}?")"
-TEST ({AND_TEST}("or"{AND_TEST})*|{LAMBDA_FORM})
-TESTLIST {TEST}( ","{TEST})*","?
-LIST_DISPLAY "["{LISTMAKER}?"]"
-LISTMAKER {EXPRESSION}({LIST_FOR}|(","{EXPRESSION})*","?)
-LIST_ITER ({LIST_FOR}|{LIST_IF})
-LIST_FOR "for"{EXPRESSION_LIST}"in"{TESTLIST}{LIST_ITER}?
-LIST_IF "if"{TEST}{LIST_ITER}?
-DICT_DISPLAY "\{"{KEY_DATUM_LIST}?"\}"
-KEY_DATUM_LIST {KEY_DATUM}(","{KEY_DATUM})*","?
-KEY_DATUM {EXPRESSION}":"{EXPRESSION}
-STRING_CONVERSION "`"{EXPRESSION_LIST}"`"
-PRIMARY ({ATOM}|{ATTRIBUTEREF}|{SUBSCRIPTION}|{SLICING}|{CALL})
-ATTRIBUTEREF {PRIMARY}"."{IDENTIFIER}
-SUBSCRIPTION {PRIMARY}"["{EXPRESSION_LIST}"]"
-SLICING ({SIMPLE_SLICING}|{EXTENDED_SLICING})
-SIMPLE_SLICING {PRIMARY}"["{SHORT_SLICE}"]"
-EXTENDED_SLICING {PRIMARY}"["{SLICE_LIST}"]"
-SLICE_LIST {SLICE_ITEM}(","{SLICE_ITEM})*","?
-SLICE_ITEM ({EXPRESSION}|{PROPER_SLICE}|{ELLIPSIS})
-PROPER_SLICE ({SHORT_SLICE}|{LONG_SLICE})
-SHORT_SLICE {LOWER_BOUND}?":"{UPPER_BOUND}?
-LONG_SLICE {SHORT_SLICE}":"{STRIDE}?
-LOWER_BOUND {EXPRESSION}
-UPPER_BOUND {EXPRESSION}
-STRIDE {EXPRESSION}
-ELLIPSIS "..."
-CALL {PRIMARY}"("({ARGUMENT_LIST}","?)?")"
-ARGUMENT_LIST ({POSITIONAL_ARGUMENTS}(","{KEYWORD_ARGUMENTS})?(",""*"{EXPRESSION})?(",""**"{EXPRESSION})?|{KEYWORD_ARGUMENTS}(",""*"{EXPRESSION})?(",""**"{EXPRESSION})?|"*"{EXPRESSION}(",""**"{EXPRESSION})?|"**"{EXPRESSION})
-POSITIONAL_ARGUMENTS {EXPRESSION}(","{EXPRESSION})*
-KEYWORD_ARGUMENTS {KEYWORD_ITEM}(","{KEYWORD_ITEM})*
-KEYWORD_ITEM {IDENTIFIER}"="{EXPRESSION}
-POWER {PRIMARY}("**"{U_EXPR})?
-U_EXPR ({POWER}|"-"{U_EXPR}|"+"{U_EXPR}|"\~"{U_EXPR})
-M_EXPR ({U_EXPR}|{M_EXPR}"*"{U_EXPR}|{M_EXPR}"//"{U_EXPR}|{M_EXPR}"/"{U_EXPR}|{M_EXPR}"\%"{U_EXPR})
-A_EXPR ({M_EXPR}|{A_EXPR}"+"{M_EXPR}|{A_EXPR}"-"{M_EXPR}
-SHIFT_EXPR ({A_EXPR}|{SHIFT_EXPR}("<<"|">>"){A_EXPR})
-AND_EXPR ({SHIFT_EXPR}|{AND_EXPR}"\;SPMamp;"{SHIFT_EXPR}
-XOR_EXPR ({AND_EXPR}|{XOR_EXPR}"\textasciicircum"{AND_EXPR})
-OR_EXPR ({XOR_EXPR}|{OR_EXPR}"|"{ XOR_EXPR})
-
-COMPARISON {OR_EXPR}({COMP_OPERATOR}{OR_EXPR})*
-COMP_OPERATOR ("<"|">"|"=="|">="|"<="|"<>"|"!="|"is""not"?|"not"?"in")
-EXPRESSION ({OR_TEST}|{LAMBDA_FORM})
-OR_TEST ({AND_TEST}|{OR_TEST}"or"{AND_TEST})
-AND_TEST ({NOT_TEST}|{AND_TEST}"and"{NOT_TEST})
-NOT_TEST ({COMPARISON}|"not"{NOT_TEST})
-LAMBDA_FORM "lambda"{PARAMETER_LIST}?":"{EXPRESSION}
-EXPRESSION_LIST {EXPRESSION}(","{EXPRESSION})*","?
-SIMPLE_STMT ({EXPRESSION_STMT}|{ASSERT_STMT}|{ASSIGNMENT_STMT}|{AUGMENTED_ASSIGNMENT_STMT}|{PASS_STMT}|{DEL_STMT}|{PRINT_STMT}|{RETURN_STMT}|{YIELD_STMT}|{RAISE_STMT}|{BREAK_STMT}|{CONTINUE_STMT}|{IMPORT_STMT}|{GLOBAL_STMT}|{EXEC_STMT})
-EXPRESSION_STMT {EXPRESSION_LIST}
-ASSERT_STMT "assert"{EXPRESSION}(","{EXPRESSION})?
-ASSIGNMENT_STMT ({TARGET_LIST}"=")+{EXPRESSION_LIST}
-TARGET_LIST {TARGET}(","{TARGET})*","?
-TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUTEREF}|{SUBSCRIPTION}|{SLICING})
+//-------------------------------------------------------------------------------
-%option noyywrap
-%option stack
-
-%x Body
-
-%x FunctionDec
-%x FunctionParams
-
-%x ClassDec
-%x ClassInheritance
-
-%x Suite
-%x SuiteCaptureIndent
-%x SuiteStart
-%x SuiteMaintain
-%x SuiteContinuing
-
-%x LongString
-
-%x SingleQuoteString
-%x DoubleQuoteString
-%x TripleString
-
-%x DocBlock
-%%
-
-<Body,Suite>{
- "def"{BB} {
- startFontClass("keyword");
- codify(yytext);
- endFontClass();
- BEGIN( FunctionDec );
- }
-
- "class"{BB} {
- startFontClass("keyword");
- codify(yytext);
- endFontClass();
- BEGIN( ClassDec );
- }
- "None" {
- startFontClass("keywordtype");
- codify(yytext);
- endFontClass();
- }
- "self."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER}"(" {
- codify("self.");
- findMemberLink(*g_code,&yytext[5]);
- }
- "self."{IDENTIFIER}/"(" {
- codify("self.");
- findMemberLink(*g_code,&yytext[5]);
- }
- "self."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER} {
- codify("self.");
- findMemberLink(*g_code,&yytext[5]);
- }
- "self."{IDENTIFIER} {
- codify("self.");
- findMemberLink(*g_code,&yytext[5]);
- }
- "cls."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER}"(" {
- codify("cls.");
- findMemberLink(*g_code,&yytext[4]);
- }
- "cls."{IDENTIFIER}/"(" {
- codify("cls.");
- findMemberLink(*g_code,&yytext[4]);
- }
- "cls."{IDENTIFIER}/"."({IDENTIFIER}".")*{IDENTIFIER} {
- codify("cls.");
- findMemberLink(*g_code,&yytext[4]);
- }
- "cls."{IDENTIFIER} {
- codify("cls.");
- findMemberLink(*g_code,&yytext[4]);
- }
-}
-
-<ClassDec>{IDENTIFIER} {
-
- generateClassOrGlobalLink(*g_code,yytext);
- // codify(yytext);
- g_curClassName = yytext;
- g_curClassBases.clear();
- BEGIN( ClassInheritance );
- }
-
-<ClassInheritance>{
- ({BB}|[(,)]) {
- codify(yytext);
- }
-
- ({IDENTIFIER}".")*{IDENTIFIER} {
- // The parser
- // is assuming
- // that ALL identifiers
- // in this state
- // are base classes;
- // it doesn't check to see
- // that the first parenthesis
- // has been seen.
-
- // This is bad - it should
- // probably be more strict
- // about what to accept.
-
- g_curClassBases.inSort(yytext);
- generateClassOrGlobalLink(*g_code,yytext);
- // codify(yytext);
- }
-
- ":" {
- codify(yytext);
-
- // Assume this will
- // be a one-line suite;
- // found counter-example
- // in SuiteStart.
-
- // Push a class scope
-
- ClassDef *classDefToAdd = createClassDef("<code>",1,1,g_curClassName,ClassDef::Class,0,0,FALSE);
- g_codeClassSDict.append(g_curClassName,classDefToAdd);
- char *s=g_curClassBases.first();
- while (s)
- {
- const ClassDef *baseDefToAdd=g_codeClassSDict[s];
-
- // Try to find class in global
- // scope
- if (baseDefToAdd==0)
- {
- baseDefToAdd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s);
- }
-
- if (baseDefToAdd && baseDefToAdd!=classDefToAdd)
- {
- classDefToAdd->insertBaseClass(const_cast<ClassDef*>(baseDefToAdd),s,Public,Normal);
- }
-
- s=g_curClassBases.next();
- }
-
- // Reset class-parsing variables.
- g_curClassName.resize(0);
- g_curClassBases.clear();
-
- g_noSuiteFound = TRUE;
- BEGIN( SuiteStart );
- }
-}
-
-
-<FunctionDec>{
- {IDENTIFIER} {
- generateFunctionLink(*g_code,yytext);
- }
-
- {B}"(" {
- codify(yytext);
- BEGIN( FunctionParams );
- }
-}
-
-<FunctionParams>{
- ({BB}|",") {
- // Parses delimiters
- codify(yytext);
- }
-
- ({IDENTIFIER}|{PARAMNONEMPTY}+) {
- codify(yytext);
- }
-
- ")" {
- codify(yytext);
- }
-
- "\n" {
- codifyLines(yytext);
- }
-
- ":" {
- codify(yytext);
-
- // Assume this will
- // be a one-line suite;
- // found counter-example
- // in SuiteStart.
- g_noSuiteFound = TRUE;
- BEGIN( SuiteStart );
- }
-}
-
-<Body,Suite>{
-
- {KEYWORD} {
- // Position-sensitive rules!
- // Must come AFTER keyword-triggered rules
- // Must come BEFORE identifier NONEMPTY-like rules
- // to syntax highlight.
-
- startFontClass("keyword");
- codify(yytext);
- endFontClass();
- }
-
- {FLOWKW} {
- if (g_currentMemberDef && g_currentMemberDef->isFunction())
- {
- g_currentMemberDef->incrementFlowKeyWordCount();
- }
- startFontClass("keywordflow");
- codify(yytext);
- endFontClass();
- }
- ({IDENTIFIER}".")*{IDENTIFIER}/"(" {
- generateClassOrGlobalLink(*g_code,yytext);
- }
- ({IDENTIFIER}".")+{IDENTIFIER} {
- generateClassOrGlobalLink(*g_code,yytext,TRUE);
- }
- {IDENTIFIER} { codify(yytext); }
-
-}
-
-
-
-<SuiteStart>{
-
- {BB} {
- codify(yytext);
- }
- "pass" {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
- BEGIN(Body);
- }
- {KEYWORD} {
- startFontClass("keyword");
- codifyLines(yytext);
- endFontClass();
-
- // No indentation necessary
- g_noSuiteFound = FALSE;
- }
-
- {FLOWKW} {
- if (g_currentMemberDef && g_currentMemberDef->isFunction())
- {
- g_currentMemberDef->incrementFlowKeyWordCount();
- }
- startFontClass("keywordflow");
- codifyLines(yytext);
- endFontClass();
-
- // No indentation necessary
- g_noSuiteFound = FALSE;
- }
- {IDENTIFIER} {
- codify(yytext);
- }
-
-
- {POUNDCOMMENT} {
- if (YY_START==SingleQuoteString ||
- YY_START==DoubleQuoteString ||
- YY_START==TripleString
- )
- {
- REJECT;
- }
- yy_push_state(YY_START);
- BEGIN(DocBlock);
- g_docBlock=yytext;
- }
-
- {NEWLINE} {
- codifyLines(yytext);
- if ( g_noSuiteFound )
- {
- // printf("New suite to capture! [%d]\n", g_yyLineNr);
- BEGIN ( SuiteCaptureIndent );
- }
- }
-}
-
-<SuiteCaptureIndent>{
- "\n"|({BB}"\n") {
- // Blankline - ignore, keep looking for indentation.
- codifyLines(yytext);
- }
-
- {BB} {
- // This state lasts momentarily,
- // to check the indentation
- // level that is about to be
- // used.
- codifyLines(yytext);
- g_indents.push(static_cast<int>(yyleng));
- // printf("Captured indent of %d [line %d]\n", yyleng, g_yyLineNr);
- BEGIN( Suite );
- }
-}
-
-<SuiteMaintain>{
-
- {BB}/({NONEMPTY}|{EXPCHAR}) {
- // This implements poor
- // indentation-tracking;
- // should be improved.
- // (translate tabs to space, etc)
- codifyLines(yytext);
- adjustScopesAndSuites(static_cast<int>(yyleng));
- }
-
- "\n"|({BB}"\n") {
- // If this ever succeeds,
- // it means that this is
- // a blank line, and
- // can be ignored.
- codifyLines(yytext);
- }
-
- ""/({NONEMPTY}|{EXPCHAR}) {
- // Default rule; matches
- // the empty string, assuming
- // real text starts here.
- // Just go straight to Body.
- adjustScopesAndSuites(0);
- }
-}
-
-
-<Suite>{NEWLINE} {
- codifyLines(yytext);
- BEGIN( SuiteMaintain );
- }
-<Body>{IDENTIFIER} {
- codify(yytext);
- }
-<Body>{NEWLINE} {
- codifyLines(yytext);
- }
-
-<SingleQuoteString>{ // Single quoted string like 'That\'s a """nice""" string!'
- \\{B}\n { // line continuation
- codifyLines(yytext);
- }
- \\. { // escaped char
- codify(yytext);
- }
- {STRINGPREFIX}?{TRIDOUBLEQUOTE} { // triple double quotes
- codify(yytext);
- }
- "'" { // end of the string
- codify(yytext);
- endFontClass();
- BEGIN(g_stringContext);
- }
- [^"'\n\\]+ { // normal chars
- codify(yytext);
- }
- . { // normal char
- codify(yytext);
- }
-}
-
-<DoubleQuoteString>{ // Double quoted string like "That's \"a '''nice'''\" string!"
- \\{B}\n { // line continuation
- codifyLines(yytext);
- }
- \\. { // escaped char
- codify(yytext);
- }
- {STRINGPREFIX}?{TRISINGLEQUOTE} { // triple single quotes
- codify(yytext);
- }
- "\"" { // end of the string
- codify(yytext);
- endFontClass();
- BEGIN(g_stringContext);
- }
- [^"'\n\\]+ { // normal chars
- codify(yytext);
- }
- . { // normal char
- codify(yytext);
- }
-}
+struct PythonCodeParser::Private
+{
+ yyscan_t yyscanner;
+ pycodeYY_state state;
+};
-<TripleString>{
- {TRIDOUBLEQUOTE} |
- {TRISINGLEQUOTE} {
- codify(yytext);
- if (g_doubleQuote==(yytext[0]=='"'))
- {
- endFontClass();
- BEGIN(g_stringContext);
- }
- }
- {LONGSTRINGBLOCK} {
- codifyLines(yytext);
- }
- \n {
- codifyLines(yytext);
- }
- . {
- codify(yytext);
- }
+PythonCodeParser::PythonCodeParser() : p(std::make_unique<Private>())
+{
+ pycodeYYlex_init_extra(&p->state,&p->yyscanner);
+#ifdef FLEX_DEBUG
+ pycodeYYset_debug(1,p->yyscanner);
+#endif
+ resetCodeParserState();
}
- /*
-<*>({NONEMPTY}|{EXPCHAR}|{BB}) { // This should go one character at a time.
- codify(yytext);
- // printf("[pycode] '%s' [ state %d ] [line %d] no match\n",
- // yytext, YY_START, g_yyLineNr);
-
- //endFontClass();
- BEGIN(Body);
- }
- */
-
-<*>{STRINGPREFIX}?{TRISINGLEQUOTE} {
- if (YY_START==SingleQuoteString) REJECT;
- startFontClass("stringliteral");
- g_stringContext=YY_START;
- g_doubleQuote=yytext[yyleng-1]=='"';
- codify(yytext);
- BEGIN(TripleString);
- }
-<*>{STRINGPREFIX}?{TRIDOUBLEQUOTE} {
- if (YY_START==DoubleQuoteString) REJECT;
- startFontClass("stringliteral");
- g_stringContext=YY_START;
- g_doubleQuote=yytext[yyleng-1]=='"';
- codify(yytext);
- BEGIN(TripleString);
- }
-<*>{STRINGPREFIX}?"'" { // single quoted string
- if (YY_START==SingleQuoteString ||
- YY_START==DoubleQuoteString ||
- YY_START==TripleString
- )
- {
- REJECT;
- }
- startFontClass("stringliteral");
- g_stringContext=YY_START;
- codify(yytext);
- BEGIN(SingleQuoteString);
- }
-<*>{STRINGPREFIX}?"\"" { // double quoted string
- if (YY_START==SingleQuoteString ||
- YY_START==DoubleQuoteString ||
- YY_START==TripleString
- )
- {
- REJECT;
- }
- startFontClass("stringliteral");
- g_stringContext=YY_START;
- codify(yytext);
- BEGIN(DoubleQuoteString);
- }
-<DocBlock>.* { // contents of current comment line
- g_docBlock+=yytext;
- }
-<DocBlock>"\n"{B}("#") { // comment block (next line is also comment line)
- g_docBlock+=yytext;
- }
-<DocBlock>{NEWLINE} { // comment block ends at the end of this line
- // remove special comment (default config)
- if (Config_getBool(STRIP_CODE_COMMENTS))
- {
- g_yyLineNr+=((QCString)g_docBlock).contains('\n');
- g_endComment=TRUE;
- }
- else // do not remove comment
- {
- startFontClass("comment");
- codifyLines(g_docBlock);
- endFontClass();
- }
- unput(*yytext);
- yy_pop_state();
- }
-<*>{POUNDCOMMENT}.* {
- if (YY_START==SingleQuoteString ||
- YY_START==DoubleQuoteString ||
- YY_START==TripleString
- )
- {
- REJECT;
- }
- yy_push_state(YY_START);
- BEGIN(DocBlock);
- g_docBlock=yytext;
- }
-<*>"#".* { // normal comment
- if (YY_START==SingleQuoteString ||
- YY_START==DoubleQuoteString ||
- YY_START==TripleString
- )
- {
- REJECT;
- }
- startFontClass("comment");
- codifyLines(yytext);
- endFontClass();
- }
-<*>{NEWLINE} {
- if (g_endComment)
- {
- g_endComment=FALSE;
- }
- else
- {
- codifyLines(yytext);
- }
- //printf("[pycode] %d NEWLINE [line %d] no match\n",
- // YY_START, g_yyLineNr);
-
- //endFontClass();
- BEGIN(Body);
- }
-
-<*>[ \t]+ {
- codify(yytext);
- BEGIN(Body);
- }
-<*>. {
- codify(yytext);
- // printf("[pycode] '%s' [ state %d ] [line %d] no match\n",
- // yytext, YY_START, g_yyLineNr);
-
- //endFontClass();
- BEGIN(Body);
- }
-
-<*><<EOF>> {
- if (YY_START == DocBlock) {
- if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- startFontClass("comment");
- codifyLines(g_docBlock);
- endFontClass();
- }
- }
- yyterminate();
- }
-%%
-
-/*@ ----------------------------------------------------------------------------
- */
-
-void resetPythonCodeParserState()
+PythonCodeParser::~PythonCodeParser()
{
- g_codeClassSDict.setAutoDelete(TRUE);
- g_codeClassSDict.clear();
- g_currentDefinition = 0;
- g_currentMemberDef = 0;
- g_doubleStringIsDoc = FALSE;
- g_paramParens = 0;
- g_indents.clear();
- BEGIN( Body );
+ pycodeYYlex_destroy(p->yyscanner);
}
-/*!
- Examines current stack of white-space indentations;
- re-syncs the parser with the correct scope.
-*/
-static void adjustScopesAndSuites(unsigned indentLength)
+void PythonCodeParser::resetCodeParserState()
{
- // States to pop
- if (!g_indents.isEmpty() && indentLength < g_indents.top())
- {
- while (!g_indents.isEmpty() && indentLength < g_indents.top())
- {
- // printf("Exited scope indent of [%d]\n", g_indents.top());
- g_indents.pop(); // Pop the old suite's indentation
-
- g_currentMemberDef=0;
- if (g_currentDefinition)
- g_currentDefinition=g_currentDefinition->getOuterScope();
- }
- }
-
- // Are there any remaining indentation levels for suites?
- if (!g_indents.isEmpty())
- {
- BEGIN( Suite );
- }
- else
- {
- BEGIN( Body );
- }
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->codeClassMap.clear();
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+ yyextra->doubleStringIsDoc = FALSE;
+ yyextra->paramParens = 0;
+ while (!yyextra->indents.empty()) yyextra->indents.pop();
+ BEGIN( Body );
}
-void parsePythonCode(CodeOutputInterface &od,const char * /*className*/,
- const QCString &s,bool exBlock, const char *exName,
- FileDef *fd,int startLine,int endLine,bool inlineFragment,
- const MemberDef *,bool,const Definition *searchCtx,bool collectXRefs)
+void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
+ const char *scopeName,
+ const QCString &input,
+ SrcLangExt /*lang*/,
+ bool isExampleBlock,
+ const char *exampleName,
+ FileDef *fileDef,
+ int startLine,
+ int endLine,
+ bool inlineFragment,
+ const MemberDef *memberDef,
+ bool showLineNumbers,
+ const Definition *searchCtx,
+ bool collectXRefs
+ )
{
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("***parseCode()\n");
-
- //--------------------------------------
- if (s.isEmpty()) return;
- printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
- g_codeClassSDict.setAutoDelete(TRUE);
- g_code = &od;
- g_inputString = s;
- g_inputPosition = 0;
- g_currentFontClass = 0;
- g_needsTermination = FALSE;
- g_searchCtx=searchCtx;
- g_collectXRefs=collectXRefs;
+
+ if (input.isEmpty()) return;
+ printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
+ yyextra->code = &codeOutIntf;
+ yyextra->inputString = input;
+ yyextra->inputPosition = 0;
+ yyextra->currentFontClass = 0;
+ yyextra->needsTermination = FALSE;
+ yyextra->searchCtx=searchCtx;
+ yyextra->collectXRefs=collectXRefs;
if (startLine!=-1)
- g_yyLineNr = startLine;
+ yyextra->yyLineNr = startLine;
else
- g_yyLineNr = 1;
+ yyextra->yyLineNr = 1;
if (endLine!=-1)
- g_inputLines = endLine+1;
+ yyextra->inputLines = endLine+1;
else
- g_inputLines = g_yyLineNr + countLines() - 1;
-
-
- g_exampleBlock = exBlock;
- g_exampleName = exName;
- g_sourceFileDef = fd;
+ yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
+
+
+ yyextra->exampleBlock = isExampleBlock;
+ yyextra->exampleName = exampleName;
+ yyextra->sourceFileDef = fileDef;
bool cleanupSourceDef = FALSE;
- if (exBlock && fd==0)
+ if (yyextra->exampleBlock && fileDef==0)
{
// create a dummy filedef for the example
- g_sourceFileDef = createFileDef("",(exName?exName:"generated"));
+ yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated"));
cleanupSourceDef = TRUE;
}
- if (g_sourceFileDef)
+ if (yyextra->sourceFileDef)
{
- setCurrentDoc("l00001");
+ setCurrentDoc(yyscanner,"l00001");
}
- g_includeCodeFragment = inlineFragment;
- // Starts line 1 on the output
- startCodeLine();
+ yyextra->includeCodeFragment = inlineFragment;
+ // Starts line 1 on the output
+ startCodeLine(yyscanner);
- pycodeYYrestart( pycodeYYin );
+ pycodeYYrestart(0,yyscanner);
- pycodeYYlex();
+ pycodeYYlex(yyscanner);
- if (!g_indents.isEmpty())
+ if (!yyextra->indents.empty())
{
// printf("Exited pysourceparser in inconsistent state!\n");
}
- if (g_needsTermination)
+ if (yyextra->needsTermination)
{
- endCodeLine();
+ endCodeLine(yyscanner);
}
if (cleanupSourceDef)
{
// delete the temporary file definition used for this example
- delete g_sourceFileDef;
- g_sourceFileDef=0;
+ delete yyextra->sourceFileDef;
+ yyextra->sourceFileDef=0;
}
- printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
- return;
-}
-
-//----------------------------------------------------------------------------
-
-void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
- const char *scopeName,
- const QCString &input,
- SrcLangExt /*lang*/,
- bool isExampleBlock,
- const char *exampleName,
- FileDef *fileDef,
- int startLine,
- int endLine,
- bool inlineFragment,
- const MemberDef *memberDef,
- bool showLineNumbers,
- const Definition *searchCtx,
- bool collectXRefs
- )
-{
- ::parsePythonCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
- fileDef,startLine,endLine,inlineFragment,memberDef,
- showLineNumbers,searchCtx,collectXRefs);
-}
-
-void PythonCodeParser::resetCodeParserState()
-{
- ::resetPythonCodeParserState();
+ printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
}
#if USE_STATE2STRING
diff --git a/src/pyscanner.l b/src/pyscanner.l
index d7996b4..a136b52 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -651,6 +651,7 @@ STARTDOCSYMS "##"
{B}":"{B} { // function without arguments
yyextra->specialBlock = TRUE; // expecting a docstring
yyextra->bodyEntry = yyextra->current;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
BEGIN(FunctionBody);
}
@@ -1322,7 +1323,6 @@ STARTDOCSYMS "##"
\n/{B}"#" { // continuation of the comment on the next line
yyextra->docBlock+='\n';
yyextra->docBrief = FALSE;
- startCommentBlock(yyscanner,FALSE);
incLineNr(yyscanner);
}
[^#\n]+ { // any other stuff
@@ -1426,7 +1426,7 @@ STARTDOCSYMS "##"
}
<*>"'" {
- fprintf(stderr,"Quote: %d\n",YY_START);
+ //fprintf(stderr,"Quote: %d\n",YY_START);
}
<*>. {
@@ -1626,7 +1626,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
}
int position = 0;
- bool needsEntry;
+ bool needsEntry = false;
int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine;
Markdown markdown(yyextra->yyFileName,lineNr);
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
@@ -1711,7 +1711,7 @@ static void initSpecialBlock(yyscan_t yyscanner)
yyextra->docBrief = TRUE;
yyextra->docBlock.resize(0);
yyextra->commentIndent = yyextra->curIndent;
- startCommentBlock(yyscanner,TRUE);
+ startCommentBlock(yyscanner,FALSE);
}
static void searchFoundDef(yyscan_t yyscanner)
@@ -1757,8 +1757,8 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt)
std::shared_ptr<Entry> ce = rt->children()[i];
if (!ce->program.isEmpty())
{
- //printf("-- %s ---------\n%s\n---------------\n",
- // ce->name.data(),ce->program.data());
+ //fprintf(stderr,"parseCompounds: -- %s (line %d) ---------\n%s\n---------------\n",
+ // ce->name.data(), ce->bodyLine, ce->program.data());
// init scanner state
yyextra->inputString = ce->program;
yyextra->inputPosition = 0;
diff --git a/src/reflist.cpp b/src/reflist.cpp
index 0aaa75f..ed26818 100644
--- a/src/reflist.cpp
+++ b/src/reflist.cpp
@@ -60,7 +60,7 @@ void RefList::generatePage()
std::sort(m_entries.begin(),m_entries.end(),
[](std::unique_ptr<RefItem> &left,std::unique_ptr<RefItem> &right)
- { return qstricmp(left->title(),left->title()); });
+ { return qstricmp(left->title(),right->title()) < 0; });
//RefItem *item;
QCString doc;
int cnt = 0;
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index fbe7cc1..2bd2c29 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -306,9 +306,8 @@ void RTFDocVisitor::visit(DocVerbatim *s)
m_t << "{" << endl;
m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,s->context(),s->text(),langExt,
- s->isExample(),s->exampleFile());
+ getCodeParser(lang).parseCode(m_ci,s->context(),s->text(),langExt,
+ s->isExample(),s->exampleFile());
//m_t << "\\par" << endl;
m_t << "}" << endl;
break;
@@ -433,8 +432,7 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << rtf_Style_Reset << getStyle("CodeExample");
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -455,8 +453,7 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << "{" << endl;
m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),langExt,inc->isExample(),
inc->exampleFile(),
0, // fileDef
@@ -492,8 +489,7 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << "{" << endl;
if (!m_lastIsPara) m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -509,8 +505,7 @@ void RTFDocVisitor::visit(DocInclude *inc)
m_t << "{" << endl;
if (!m_lastIsPara) m_t << "\\par" << endl;
m_t << rtf_Style_Reset << getStyle("CodeExample");
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -567,8 +562,7 @@ void RTFDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),op->text(),langExt,
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
op->line(), // startLine
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index dff4cdd..7acd14f 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -48,8 +48,6 @@
#include "filename.h"
#include "namespacedef.h"
-static bool DoxyCodeLineOpen = FALSE;
-
//#define DBG_RTF(x) x;
#define DBG_RTF(x)
@@ -1935,22 +1933,15 @@ void RTFGenerator::writeRTFReference(const char *label)
t << " \\\\*MERGEFORMAT}{\\fldrslt pagenum}}";
}
-void RTFGenerator::startCodeFragment()
+void RTFGenerator::startCodeFragment(const char *)
{
DBG_RTF(t << "{\\comment (startCodeFragment) }" << endl)
t << "{" << endl;
- //newParagraph();
t << rtf_Style_Reset << rtf_Code_DepthStyle();
- //styleStack.push(rtf_Style_CodeExample);
}
-void RTFGenerator::endCodeFragment()
+void RTFGenerator::endCodeFragment(const char *)
{
- //newParagraph();
- //styleStack.pop();
- //printf("RTFGenerator::endCodeFragment() top=%s\n",styleStack.top());
- //t << rtf_Style_Reset << styleStack.top() << endl;
- //endCodeLine checks is there is still an open code line, if so closes it.
endCodeLine();
DBG_RTF(t << "{\\comment (endCodeFragment) }" << endl)
@@ -3043,7 +3034,7 @@ void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const ch
{
bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS);
- DoxyCodeLineOpen = TRUE;
+ m_doxyCodeLineOpen = true;
QCString lineNumber;
lineNumber.sprintf("%05d",l);
if (m_prettyCode)
@@ -3070,13 +3061,13 @@ void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const ch
}
void RTFGenerator::startCodeLine(bool)
{
- DoxyCodeLineOpen = TRUE;
+ m_doxyCodeLineOpen = true;
m_col=0;
}
void RTFGenerator::endCodeLine()
{
- if (DoxyCodeLineOpen) lineBreak();
- DoxyCodeLineOpen = FALSE;
+ if (m_doxyCodeLineOpen) lineBreak();
+ m_doxyCodeLineOpen = false;
}
void RTFGenerator::startLabels()
diff --git a/src/rtfgen.h b/src/rtfgen.h
index ac6f580..8a2c3fe 100644
--- a/src/rtfgen.h
+++ b/src/rtfgen.h
@@ -125,8 +125,8 @@ class RTFGenerator : public OutputGenerator
void writeRuler() { rtfwriteRuler_thin(); }
void writeAnchor(const char *fileName,const char *name);
- void startCodeFragment();
- void endCodeFragment();
+ void startCodeFragment(const char *style);
+ void endCodeFragment(const char *style);
void writeLineNumber(const char *,const char *,const char *,int l);
void startCodeLine(bool);
void endCodeLine();
@@ -293,6 +293,7 @@ class RTFGenerator : public OutputGenerator
bool m_omitParagraph = false; // should a the next paragraph command be ignored?
int m_numCols = 0; // number of columns in a table
QCString m_relPath;
+ bool m_doxyCodeLineOpen = false;
};
#endif
diff --git a/src/scanner.l b/src/scanner.l
index e56f151..92dc03d 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -1,12 +1,12 @@
/*****************************************************************************
*
- *
+ *
*
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -25,7 +25,7 @@
%{
/*
- * includes
+ * includes
*/
#include <algorithm>
@@ -227,15 +227,15 @@ static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
/* ----------------------------------------------------------------- */
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
%}
/* start command character */
-CMD ("\\"|"@")
+CMD ("\\"|"@")
BN [ \t\n\r]
-BL [ \t\r]*"\n"
+BL [ \t\r]*"\n"
B [ \t]
ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*
SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)(((~|!){BN}*)?{ID})
@@ -244,7 +244,7 @@ CSSCOPENAME (({ID}?{BN}*"."{BN}*)*)((~{BN}*)?{ID})
PRE [pP][rR][eE]
CODE [cC][oO][dD][eE]
CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
-PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;]
+PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;]
PHPUSEKW ("public"|"private"|"protected")
IDLATTR ("["[^\]]*"]"){BN}*
TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
@@ -262,138 +262,138 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
%x AlignAs
%x AlignAsEnd
-%x Define
-%x DefineEnd
-%x CompoundName
-%x ClassVar
-%x CSConstraintName
-%x CSConstraintType
-%x CSIndexer
-%x ClassCategory
-%x ClassTemplSpec
+%x Define
+%x DefineEnd
+%x CompoundName
+%x ClassVar
+%x CSConstraintName
+%x CSConstraintType
+%x CSIndexer
+%x ClassCategory
+%x ClassTemplSpec
%x CliPropertyType
%x CliPropertyIndex
%x CliOverride
-%x Bases
-%x BasesProt
-%x NextSemi
-%x BitFields
-%x EnumBaseType
-%x FindMembers
-%x FindMembersPHP
-%x FindMemberName
+%x Bases
+%x BasesProt
+%x NextSemi
+%x BitFields
+%x EnumBaseType
+%x FindMembers
+%x FindMembersPHP
+%x FindMemberName
%x FindFields
%x FindFieldArg
-%x Function
-%x FuncRound
-%x ExcpRound
-%x ExcpList
-%x FuncQual
+%x Function
+%x FuncRound
+%x ExcpRound
+%x ExcpList
+%x FuncQual
%x TrailingReturn
-%x Operator
-%x Array
-%x ReadBody
-%x ReadNSBody
-%x ReadBodyIntf
-%x Using
-%x UsingAlias
-%x UsingAliasEnd
-%x UsingDirective
-%x SkipCurly
-%x SkipCurlyCpp
-%x SkipCurlyEndDoc
+%x Operator
+%x Array
+%x ReadBody
+%x ReadNSBody
+%x ReadBodyIntf
+%x Using
+%x UsingAlias
+%x UsingAliasEnd
+%x UsingDirective
+%x SkipCurly
+%x SkipCurlyCpp
+%x SkipCurlyEndDoc
%x SkipString
%x SkipPHPString
-%x SkipInits
-%x SkipC11Inits
+%x SkipInits
+%x SkipC11Inits
%x SkipC11Attribute
-%x SkipCPP
-%x SkipCPPBlock
-%x SkipComment
-%x SkipCxxComment
+%x SkipCPP
+%x SkipCPPBlock
+%x SkipComment
+%x SkipCxxComment
%x SkipCurlyBlock
%x SkipRoundBlock
-%x Sharp
-%x SkipRound
-%x SkipSquare
-%x SkipRemainder
+%x Sharp
+%x SkipRound
+%x SkipSquare
+%x SkipRemainder
%x StaticAssert
%x DeclType
-%x TypedefName
-%x TryFunctionBlock
-%x TryFunctionBlockEnd
-%x Comment
-%x PackageName
-%x JavaImport
-%x PHPUse
-%x PHPUseAs
-%x CSAccessorDecl
-%x CSGeneric
-%x PreLineCtrl
-%x DefinePHP
-%x DefinePHPEnd
-%x OldStyleArgs
-%x SkipVerbString
+%x TypedefName
+%x TryFunctionBlock
+%x TryFunctionBlockEnd
+%x Comment
+%x PackageName
+%x JavaImport
+%x PHPUse
+%x PHPUseAs
+%x CSAccessorDecl
+%x CSGeneric
+%x PreLineCtrl
+%x DefinePHP
+%x DefinePHPEnd
+%x OldStyleArgs
+%x SkipVerbString
%x ObjCMethod
%x ObjCReturnType
%x ObjCParams
%x ObjCParamType
%x ObjCProtocolList
-%x ObjCPropAttr
-%x ObjCSkipStatement
-%x QtPropType
-%x QtPropName
-%x QtPropAttr
-%x QtPropRead
-%x QtPropWrite
-%x ReadInitializer
-%x UNOIDLAttributeBlock
-%x GetCallType
-%x CppQuote
-%x EndCppQuote
+%x ObjCPropAttr
+%x ObjCSkipStatement
+%x QtPropType
+%x QtPropName
+%x QtPropAttr
+%x QtPropRead
+%x QtPropWrite
+%x ReadInitializer
+%x UNOIDLAttributeBlock
+%x GetCallType
+%x CppQuote
+%x EndCppQuote
%x MemberSpec
%x MemberSpecSkip
-%x EndTemplate
-%x FuncPtr
-%x FuncPtrOperator
-%x EndFuncPtr
-%x ReadFuncArgType
-%x ReadTempArgs
-%x IDLUnionCase
-%x NSAliasName
-%x NSAliasArg
-%x CopyString
-%x CopyPHPString
-%x CopyGString
-%x CopyPHPGString
-%x CopyRound
-%x CopyCurly
-%x GCopyRound
-%x GCopySquare
-%x GCopyCurly
-%x SkipUnionSwitch
-%x Specialization
-%x SpecializationSingleQuote
-%x SpecializationDoubleQuote
-%x FuncPtrInit
-%x FuncFunc
-%x FuncFuncEnd
-%x FuncFuncType
-%x FuncFuncArray
+%x EndTemplate
+%x FuncPtr
+%x FuncPtrOperator
+%x EndFuncPtr
+%x ReadFuncArgType
+%x ReadTempArgs
+%x IDLUnionCase
+%x NSAliasName
+%x NSAliasArg
+%x CopyString
+%x CopyPHPString
+%x CopyGString
+%x CopyPHPGString
+%x CopyRound
+%x CopyCurly
+%x GCopyRound
+%x GCopySquare
+%x GCopyCurly
+%x SkipUnionSwitch
+%x Specialization
+%x SpecializationSingleQuote
+%x SpecializationDoubleQuote
+%x FuncPtrInit
+%x FuncFunc
+%x FuncFuncEnd
+%x FuncFuncType
+%x FuncFuncArray
%x CopyArgString
%x CopyArgPHPString
-%x CopyArgRound
-%x CopyArgSharp
-%x CopyArgComment
-%x CopyArgCommentLine
-%x CopyArgVerbatim
-%x HereDoc
-%x HereDocEnd
-%x CopyHereDoc
-%x CopyHereDocEnd
-%x RawString
-%x RawGString
-%x CSString
+%x CopyArgRound
+%x CopyArgSharp
+%x CopyArgComment
+%x CopyArgCommentLine
+%x CopyArgVerbatim
+%x HereDoc
+%x HereDocEnd
+%x CopyHereDoc
+%x CopyHereDocEnd
+%x RawString
+%x RawGString
+%x CSString
%x IDLAttribute
%x IDLProp
@@ -418,421 +418,421 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
/** comment parsing states */
-%x DocLine
-%x DocBlock
+%x DocLine
+%x DocBlock
%x DocCopyBlock
%%
-<NextSemi>"{" {
- yyextra->curlyCount=0;
- yyextra->needsSemi = TRUE;
- BEGIN(SkipCurlyBlock);
- }
-<NextSemi>"(" {
- yyextra->roundCount=0;
- BEGIN(SkipRoundBlock);
- }
-<SkipRoundBlock>"(" {
- ++yyextra->roundCount;
- }
-<SkipRoundBlock>")" {
- if (yyextra->roundCount )
- --yyextra->roundCount ;
- else
- BEGIN( NextSemi ) ;
- }
-<SkipCurlyBlock>"{" {
- ++yyextra->curlyCount ;
- }
-<SkipCurlyBlock>"}" {
- if( yyextra->curlyCount )
- {
- --yyextra->curlyCount ;
- }
- else if (yyextra->needsSemi)
- {
- BEGIN( NextSemi );
- }
- else
- {
- BEGIN( FindMembers );
- }
- }
-<NextSemi>\' {
- if (yyextra->insidePHP)
- {
- yyextra->lastStringContext=NextSemi;
- BEGIN(SkipPHPString);
- }
- }
-<NextSemi>{CHARLIT} { if (yyextra->insidePHP) REJECT; }
-<NextSemi>\" {
- yyextra->lastStringContext=NextSemi;
- BEGIN(SkipString);
- }
-<NextSemi>[;,] {
- unput(*yytext);
- BEGIN( FindMembers );
- }
-<BitFields>[;,] {
- unput(*yytext);
- BEGIN( FindMembers );
- }
+<NextSemi>"{" {
+ yyextra->curlyCount=0;
+ yyextra->needsSemi = TRUE;
+ BEGIN(SkipCurlyBlock);
+ }
+<NextSemi>"(" {
+ yyextra->roundCount=0;
+ BEGIN(SkipRoundBlock);
+ }
+<SkipRoundBlock>"(" {
+ ++yyextra->roundCount;
+ }
+<SkipRoundBlock>")" {
+ if (yyextra->roundCount )
+ --yyextra->roundCount ;
+ else
+ BEGIN( NextSemi ) ;
+ }
+<SkipCurlyBlock>"{" {
+ ++yyextra->curlyCount ;
+ }
+<SkipCurlyBlock>"}" {
+ if( yyextra->curlyCount )
+ {
+ --yyextra->curlyCount ;
+ }
+ else if (yyextra->needsSemi)
+ {
+ BEGIN( NextSemi );
+ }
+ else
+ {
+ BEGIN( FindMembers );
+ }
+ }
+<NextSemi>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->lastStringContext=NextSemi;
+ BEGIN(SkipPHPString);
+ }
+ }
+<NextSemi>{CHARLIT} { if (yyextra->insidePHP) REJECT; }
+<NextSemi>\" {
+ yyextra->lastStringContext=NextSemi;
+ BEGIN(SkipString);
+ }
+<NextSemi>[;,] {
+ unput(*yytext);
+ BEGIN( FindMembers );
+ }
+<BitFields>[;,] {
+ unput(*yytext);
+ BEGIN( FindMembers );
+ }
<EnumBaseType>[{;,] {
yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- unput(*yytext);
- BEGIN( ClassVar );
+ unput(*yytext);
+ BEGIN( ClassVar );
}
-<FindMembers>"<?php" { // PHP code with unsupported extension?
+<FindMembers>"<?php" { // PHP code with unsupported extension?
yyextra->insidePHP = TRUE;
- }
+ }
<FindMembersPHP>"<?"("php"?) { // PHP code start
BEGIN( FindMembers );
- }
+ }
<FindMembersPHP>"<script"{BN}+"language"{BN}*"="{BN}*['"]?"php"['"]?{BN}*">" { // PHP code start
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
BEGIN( FindMembers );
- }
+ }
<FindMembers>"?>"|"</script>" { // PHP code end
- if (yyextra->insidePHP)
- BEGIN( FindMembersPHP );
- else
- REJECT;
+ if (yyextra->insidePHP)
+ BEGIN( FindMembersPHP );
+ else
+ REJECT;
}
<FindMembersPHP>[^\n<]+ { // Non-PHP code text, ignore
- }
+ }
<FindMembersPHP>\n { // Non-PHP code text, ignore
lineCount(yyscanner);
- }
+ }
<FindMembersPHP>. { // Non-PHP code text, ignore
- }
-<FindMembers>{PHPKW} { if (yyextra->insidePHP)
- BEGIN( NextSemi );
- else
- REJECT;
- }
-<FindMembers>"%{"[^\n]* { // Mozilla XPIDL lang-specific block
- if (!yyextra->insideIDL)
- REJECT;
- }
-<FindMembers>"%}" { // Mozilla XPIDL lang-specific block end
- if (!yyextra->insideIDL)
- REJECT;
- }
-<FindMembers>{B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property
- yyextra->current->mtype = yyextra->mtype = Property;
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
+ }
+<FindMembers>{PHPKW} { if (yyextra->insidePHP)
+ BEGIN( NextSemi );
+ else
+ REJECT;
+ }
+<FindMembers>"%{"[^\n]* { // Mozilla XPIDL lang-specific block
+ if (!yyextra->insideIDL)
+ REJECT;
+ }
+<FindMembers>"%}" { // Mozilla XPIDL lang-specific block end
+ if (!yyextra->insideIDL)
+ REJECT;
+ }
+<FindMembers>{B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property
+ yyextra->current->mtype = yyextra->mtype = Property;
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
<FindMembers>{B}*"k_dcop"{BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = DCOP;
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = Signal;
-
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
+
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
<FindMembers>{B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->mtype = yyextra->mtype = Slot;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner);
- }
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->mtype = yyextra->mtype = Slot;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner);
+ }
<FindMembers>{B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Protected ;
- yyextra->current->mtype = yyextra->mtype = Slot;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner);
- }
+ yyextra->current->protection = yyextra->protection = Protected ;
+ yyextra->current->mtype = yyextra->mtype = Slot;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner);
+ }
<FindMembers>{B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Private ;
- yyextra->current->mtype = yyextra->mtype = Slot;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner);
- }
-<FindMembers>{B}*("public"|"methods"|"__published"){BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
+ yyextra->current->protection = yyextra->protection = Private ;
+ yyextra->current->mtype = yyextra->mtype = Slot;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*("public"|"methods"|"__published"){BN}*":"{BN}* {
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
<FindMembers>{B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package...
- if (yyextra->insideCli)
- {
- yyextra->current->protection = yyextra->protection = Package ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
- else
- {
- REJECT;
- }
- }
-<FindMembers>{B}*"protected"{BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Protected ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
-<FindMembers>{B}*"private"{BN}*":"{BN}* {
- yyextra->current->protection = yyextra->protection = Private ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
-<FindMembers>{B}*"event"{BN}+ {
- if (yyextra->insideCli)
- {
- // C++/CLI event
- lineCount(yyscanner) ;
- yyextra->current->mtype = yyextra->mtype = Event;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->curlyCount=0;
- BEGIN( CliPropertyType );
- }
- else if (yyextra->insideCS)
- {
- lineCount(yyscanner) ;
- yyextra->current->mtype = Event;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- }
- else
- {
- REJECT;
- }
- }
-<FindMembers>{B}*"property"{BN}+ {
- if (yyextra->insideCli)
- {
- // C++/CLI property
- lineCount(yyscanner) ;
- yyextra->current->mtype = yyextra->mtype = Property;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->curlyCount=0;
- BEGIN( CliPropertyType );
- }
- else
- {
- REJECT;
- }
- }
-<CliPropertyType>{ID} {
- addType(yyscanner);
- yyextra->current->name = yytext;
- }
-<CliPropertyType>"[" { // C++/CLI indexed property
- yyextra->current->args = "[";
- BEGIN( CliPropertyIndex );
- }
-<CliPropertyType>"{" {
- yyextra->curlyCount=0;
- //printf("event: '%s' '%s'\n",yyextra->current->type.data(),yyextra->current->name.data());
- BEGIN( CSAccessorDecl );
- }
-<CliPropertyType>";" {
- unput(*yytext);
- BEGIN( FindMembers );
- }
-<CliPropertyType>\n {
+ if (yyextra->insideCli)
+ {
+ yyextra->current->protection = yyextra->protection = Package ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<FindMembers>{B}*"protected"{BN}*":"{BN}* {
+ yyextra->current->protection = yyextra->protection = Protected ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+<FindMembers>{B}*"private"{BN}*":"{BN}* {
+ yyextra->current->protection = yyextra->protection = Private ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+<FindMembers>{B}*"event"{BN}+ {
+ if (yyextra->insideCli)
+ {
+ // C++/CLI event
+ lineCount(yyscanner) ;
+ yyextra->current->mtype = yyextra->mtype = Event;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->curlyCount=0;
+ BEGIN( CliPropertyType );
+ }
+ else if (yyextra->insideCS)
+ {
+ lineCount(yyscanner) ;
+ yyextra->current->mtype = Event;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<FindMembers>{B}*"property"{BN}+ {
+ if (yyextra->insideCli)
+ {
+ // C++/CLI property
+ lineCount(yyscanner) ;
+ yyextra->current->mtype = yyextra->mtype = Property;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->curlyCount=0;
+ BEGIN( CliPropertyType );
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<CliPropertyType>{ID} {
+ addType(yyscanner);
+ yyextra->current->name = yytext;
+ }
+<CliPropertyType>"[" { // C++/CLI indexed property
+ yyextra->current->args = "[";
+ BEGIN( CliPropertyIndex );
+ }
+<CliPropertyType>"{" {
+ yyextra->curlyCount=0;
+ //printf("event: '%s' '%s'\n",yyextra->current->type.data(),yyextra->current->name.data());
+ BEGIN( CSAccessorDecl );
+ }
+<CliPropertyType>";" {
+ unput(*yytext);
+ BEGIN( FindMembers );
+ }
+<CliPropertyType>\n {
lineCount(yyscanner);
- }
-<CliPropertyType>{B}* {
- }
-<CliPropertyType>. {
- addType(yyscanner);
- yyextra->current->type += yytext;
- }
-<CliPropertyIndex>"]" {
+ }
+<CliPropertyType>{B}* {
+ }
+<CliPropertyType>. {
+ addType(yyscanner);
+ yyextra->current->type += yytext;
+ }
+<CliPropertyIndex>"]" {
BEGIN( CliPropertyType );
- yyextra->current->args+=yytext;
- }
-<CliPropertyIndex>. {
- yyextra->current->args+=yytext;
- }
+ yyextra->current->args+=yytext;
+ }
+<CliPropertyIndex>. {
+ yyextra->current->args+=yytext;
+ }
/*
-<FindMembers>{B}*"property"{BN}+ {
+<FindMembers>{B}*"property"{BN}+ {
if (!yyextra->current->type.isEmpty())
- {
- REJECT;
+ {
+ REJECT;
}
- else
- {
+ else
+ {
yyextra->current->mtype = yyextra->mtype = Property;
lineCount(yyscanner);
- }
+ }
}
*/
-<FindMembers>{B}*"@private"{BN}+ {
- yyextra->current->protection = yyextra->protection = Private ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
-<FindMembers>{B}*"@protected"{BN}+ {
- yyextra->current->protection = yyextra->protection = Protected ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
-<FindMembers>{B}*"@public"{BN}+ {
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- lineCount(yyscanner) ;
- }
-<FindMembers>[\-+]{BN}* {
- if (!yyextra->insideObjC)
- {
- REJECT;
- }
- else
- {
- lineCount(yyscanner);
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->section = Entry::FUNCTION_SEC;
- yyextra->current->protection = yyextra->protection = Public ;
- yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
- yyextra->insideObjC = TRUE;
- yyextra->current->virt = Virtual;
- yyextra->current->stat=yytext[0]=='+';
- yyextra->current->mtype = yyextra->mtype = Method;
- yyextra->current->type.resize(0);
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->argList.clear();
- BEGIN( ObjCMethod );
- }
- }
-<ObjCMethod>"(" { // start of method's return type
- BEGIN( ObjCReturnType );
- }
-<ObjCMethod>{ID} { // found method name
- if (yyextra->current->type.isEmpty())
- {
- yyextra->current->type = "id";
- }
- yyextra->current->name = yytext;
+<FindMembers>{B}*"@private"{BN}+ {
+ yyextra->current->protection = yyextra->protection = Private ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+<FindMembers>{B}*"@protected"{BN}+ {
+ yyextra->current->protection = yyextra->protection = Protected ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+<FindMembers>{B}*"@public"{BN}+ {
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ lineCount(yyscanner) ;
+ }
+<FindMembers>[\-+]{BN}* {
+ if (!yyextra->insideObjC)
+ {
+ REJECT;
+ }
+ else
+ {
+ lineCount(yyscanner);
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->section = Entry::FUNCTION_SEC;
+ yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
+ yyextra->insideObjC = TRUE;
+ yyextra->current->virt = Virtual;
+ yyextra->current->stat=yytext[0]=='+';
+ yyextra->current->mtype = yyextra->mtype = Method;
+ yyextra->current->type.resize(0);
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->argList.clear();
+ BEGIN( ObjCMethod );
+ }
+ }
+<ObjCMethod>"(" { // start of method's return type
+ BEGIN( ObjCReturnType );
+ }
+<ObjCMethod>{ID} { // found method name
+ if (yyextra->current->type.isEmpty())
+ {
+ yyextra->current->type = "id";
+ }
+ yyextra->current->name = yytext;
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- }
-<ObjCMethod>":"{B}* { // start of parameter list
- yyextra->current->name += ':';
- Argument a;
- yyextra->current->argList.push_back(a);
- BEGIN( ObjCParams );
- }
-<ObjCReturnType>[^)]* { // TODO: check if nested braches are possible.
- yyextra->current->type = yytext;
- }
-<ObjCReturnType>")" {
- BEGIN( ObjCMethod );
- }
-<ObjCParams>({ID})?{BN}*":" { // Keyword of parameter
- QCString keyw = yytext;
- keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip :
- if (keyw.isEmpty())
- {
- yyextra->current->name += " :";
- }
- else
- {
- yyextra->current->name += keyw+":";
- }
- if (yyextra->current->argList.back().type.isEmpty())
- {
- yyextra->current->argList.back().type="id";
- }
- Argument a;
- a.attrib=(QCString)"["+keyw+"]";
- yyextra->current->argList.push_back(a);
- }
-<ObjCParams>{ID}{BN}* { // name of parameter
- lineCount(yyscanner);
- yyextra->current->argList.back().name=QCString(yytext).stripWhiteSpace();
- }
-<ObjCParams>","{BN}*"..." { // name of parameter
- lineCount(yyscanner);
- // do we want the comma as part of the name?
- //yyextra->current->name += ",";
- Argument a;
- a.attrib="[,]";
- a.type="...";
- yyextra->current->argList.push_back(a);
- }
+ }
+<ObjCMethod>":"{B}* { // start of parameter list
+ yyextra->current->name += ':';
+ Argument a;
+ yyextra->current->argList.push_back(a);
+ BEGIN( ObjCParams );
+ }
+<ObjCReturnType>[^)]* { // TODO: check if nested braches are possible.
+ yyextra->current->type = yytext;
+ }
+<ObjCReturnType>")" {
+ BEGIN( ObjCMethod );
+ }
+<ObjCParams>({ID})?{BN}*":" { // Keyword of parameter
+ QCString keyw = yytext;
+ keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip :
+ if (keyw.isEmpty())
+ {
+ yyextra->current->name += " :";
+ }
+ else
+ {
+ yyextra->current->name += keyw+":";
+ }
+ if (yyextra->current->argList.back().type.isEmpty())
+ {
+ yyextra->current->argList.back().type="id";
+ }
+ Argument a;
+ a.attrib=(QCString)"["+keyw+"]";
+ yyextra->current->argList.push_back(a);
+ }
+<ObjCParams>{ID}{BN}* { // name of parameter
+ lineCount(yyscanner);
+ yyextra->current->argList.back().name=QCString(yytext).stripWhiteSpace();
+ }
+<ObjCParams>","{BN}*"..." { // name of parameter
+ lineCount(yyscanner);
+ // do we want the comma as part of the name?
+ //yyextra->current->name += ",";
+ Argument a;
+ a.attrib="[,]";
+ a.type="...";
+ yyextra->current->argList.push_back(a);
+ }
/*
-<ObjCParams>":" {
- yyextra->current->name += ':';
- }
+<ObjCParams>":" {
+ yyextra->current->name += ':';
+ }
*/
-<ObjCParams>"(" {
- yyextra->roundCount=0;
- yyextra->current->argList.back().type.resize(0);
- BEGIN( ObjCParamType );
- }
+<ObjCParams>"(" {
+ yyextra->roundCount=0;
+ yyextra->current->argList.back().type.resize(0);
+ BEGIN( ObjCParamType );
+ }
<ObjCParamType>"(" {
yyextra->roundCount++;
- yyextra->current->argList.back().type+=yytext;
+ yyextra->current->argList.back().type+=yytext;
}
-<ObjCParamType>")"/{B}* {
+<ObjCParamType>")"/{B}* {
if (yyextra->roundCount<=0)
{
BEGIN( ObjCParams );
@@ -842,221 +842,221 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->argList.back().type+=yytext;
yyextra->roundCount--;
}
- }
-<ObjCParamType>[^()]* {
- yyextra->current->argList.back().type+=QCString(yytext).stripWhiteSpace();
- }
-<ObjCMethod,ObjCParams>";" { // end of method declaration
- if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
- {
- yyextra->current->argList.back().type="id";
- }
+ }
+<ObjCParamType>[^()]* {
+ yyextra->current->argList.back().type+=QCString(yytext).stripWhiteSpace();
+ }
+<ObjCMethod,ObjCParams>";" { // end of method declaration
+ if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
+ {
+ yyextra->current->argList.back().type="id";
+ }
if (yyextra->current->argList.empty()) // method without parameters
{
yyextra->current->argList.setNoParameters(TRUE);
}
- yyextra->current->args = argListToString(yyextra->current->argList);
- //printf("argList=%s\n",yyextra->current->args.data());
- unput(';');
- BEGIN( Function );
+ yyextra->current->args = argListToString(yyextra->current->argList);
+ //printf("argList=%s\n",yyextra->current->args.data());
+ unput(';');
+ BEGIN( Function );
}
-<ObjCMethod,ObjCParams>(";"{BN}+)?"{" { // start of a method body
- lineCount(yyscanner);
+<ObjCMethod,ObjCParams>(";"{BN}+)?"{" { // start of a method body
+ lineCount(yyscanner);
//printf("Type=%s Name=%s args=%s\n",
- // yyextra->current->type.data(),yyextra->current->name.data(),argListToString(yyextra->current->argList).data()
- // );
- if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
- {
- yyextra->current->argList.back().type="id";
- }
+ // yyextra->current->type.data(),yyextra->current->name.data(),argListToString(yyextra->current->argList).data()
+ // );
+ if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
+ {
+ yyextra->current->argList.back().type="id";
+ }
if (yyextra->current->argList.empty()) // method without parameters
{
yyextra->current->argList.setNoParameters(TRUE);
}
- yyextra->current->args = argListToString(yyextra->current->argList);
+ yyextra->current->args = argListToString(yyextra->current->argList);
unput('{');
- BEGIN( Function );
- }
+ BEGIN( Function );
+ }
<FindMembers>{B}*"sequence"{BN}*"<"{BN}* {
- if (yyextra->insideSlice)
- {
+ if (yyextra->insideSlice)
+ {
lineCount(yyscanner);
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->startLine = yyextra->yyLineNr ;
- yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->startLine = yyextra->yyLineNr ;
+ yyextra->current->startColumn = yyextra->yyColNr;
yyextra->current->args.resize(0);
- yyextra->current->section = Entry::TYPEDEF_SEC ;
+ yyextra->current->section = Entry::TYPEDEF_SEC ;
yyextra->isTypedef = TRUE;
- BEGIN( SliceSequence );
- }
- else
- REJECT;
- }
+ BEGIN( SliceSequence );
+ }
+ else
+ REJECT;
+ }
<FindMembers>{B}*"dictionary"{BN}*"<"{BN}* {
- if (yyextra->insideSlice)
- {
+ if (yyextra->insideSlice)
+ {
lineCount(yyscanner);
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->startLine = yyextra->yyLineNr ;
- yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->startLine = yyextra->yyLineNr ;
+ yyextra->current->startColumn = yyextra->yyColNr;
yyextra->current->args.resize(0);
- yyextra->current->section = Entry::TYPEDEF_SEC ;
+ yyextra->current->section = Entry::TYPEDEF_SEC ;
yyextra->isTypedef = TRUE;
- BEGIN( SliceDictionary );
- }
- else
- REJECT;
- }
-<FindMembers>{BN}{1,80} {
- lineCount(yyscanner);
- }
-<FindMembers>"@"({ID}".")*{ID}{BN}*"(" {
- if (yyextra->insideJava) // Java annotation
- {
- lineCount(yyscanner);
- yyextra->lastSkipRoundContext = YY_START;
- yyextra->roundCount=0;
- BEGIN( SkipRound );
- }
- else if (qstrncmp(yytext,"@property",9)==0) // ObjC 2.0 property
- {
- yyextra->current->mtype = yyextra->mtype = Property;
- yyextra->current->spec|=Entry::Readable | Entry::Writable | Entry::Assign;
- yyextra->current->protection = Public ;
- unput('(');
- BEGIN( ObjCPropAttr );
- }
- else
- {
- REJECT;
- }
- }
-<ObjCPropAttr>"getter="{ID} {
+ BEGIN( SliceDictionary );
+ }
+ else
+ REJECT;
+ }
+<FindMembers>{BN}{1,80} {
+ lineCount(yyscanner);
+ }
+<FindMembers>"@"({ID}".")*{ID}{BN}*"(" {
+ if (yyextra->insideJava) // Java annotation
+ {
+ lineCount(yyscanner);
+ yyextra->lastSkipRoundContext = YY_START;
+ yyextra->roundCount=0;
+ BEGIN( SkipRound );
+ }
+ else if (qstrncmp(yytext,"@property",9)==0) // ObjC 2.0 property
+ {
+ yyextra->current->mtype = yyextra->mtype = Property;
+ yyextra->current->spec|=Entry::Readable | Entry::Writable | Entry::Assign;
+ yyextra->current->protection = Public ;
+ unput('(');
+ BEGIN( ObjCPropAttr );
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<ObjCPropAttr>"getter="{ID} {
yyextra->current->read = yytext+7;
- }
-<ObjCPropAttr>"setter="{ID} {
+ }
+<ObjCPropAttr>"setter="{ID} {
yyextra->current->write = yytext+7;
- }
-<ObjCPropAttr>"readonly" {
- yyextra->current->spec&=~Entry::Writable;
- }
-<ObjCPropAttr>"readwrite" { // default
- }
-<ObjCPropAttr>"assign" { // default
- }
+ }
+<ObjCPropAttr>"readonly" {
+ yyextra->current->spec&=~Entry::Writable;
+ }
+<ObjCPropAttr>"readwrite" { // default
+ }
+<ObjCPropAttr>"assign" { // default
+ }
<ObjCPropAttr>"unsafe_unretained" {
- yyextra->current->spec&=~Entry::Assign;
- yyextra->current->spec|=Entry::Unretained;
- }
-<ObjCPropAttr>"retain" {
- yyextra->current->spec&=~Entry::Assign;
- yyextra->current->spec|=Entry::Retain;
- }
-<ObjCPropAttr>"copy" {
- yyextra->current->spec&=~Entry::Assign;
- yyextra->current->spec|=Entry::Copy;
- }
+ yyextra->current->spec&=~Entry::Assign;
+ yyextra->current->spec|=Entry::Unretained;
+ }
+<ObjCPropAttr>"retain" {
+ yyextra->current->spec&=~Entry::Assign;
+ yyextra->current->spec|=Entry::Retain;
+ }
+<ObjCPropAttr>"copy" {
+ yyextra->current->spec&=~Entry::Assign;
+ yyextra->current->spec|=Entry::Copy;
+ }
<ObjCPropAttr>"weak" {
- yyextra->current->spec&=~Entry::Assign;
- yyextra->current->spec|=Entry::Weak;
+ yyextra->current->spec&=~Entry::Assign;
+ yyextra->current->spec|=Entry::Weak;
}
<ObjCPropAttr>"strong" {
- yyextra->current->spec&=~Entry::Assign;
- yyextra->current->spec|=Entry::Strong;
- }
-<ObjCPropAttr>"nonatomic" {
- yyextra->current->spec|=Entry::NonAtomic;
- }
-<ObjCPropAttr>")" {
- BEGIN(FindMembers);
- }
-<FindMembers>"@"{ID} {
- if (yyextra->insideJava) // Java annotation
- {
- // skip annotation
- }
- else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property
- {
- yyextra->current->mtype = yyextra->mtype = Property;
- yyextra->current->spec|=Entry::Writable | Entry::Readable;
- yyextra->current->protection = Public ;
- }
- else if (qstrcmp(yytext,"@synthesize")==0)
- {
- BEGIN( ObjCSkipStatement );
- }
- else if (qstrcmp(yytext,"@dynamic")==0)
- {
- BEGIN( ObjCSkipStatement );
- }
- else
- {
- REJECT;
- }
- }
-<ObjCSkipStatement>";" {
- BEGIN(FindMembers);
- }
-<PackageName>{ID}(("."|"\\"){ID})* {
- yyextra->isTypedef=FALSE;
- //printf("Found namespace %s lang=%d\n",yytext,yyextra->current->lang);
- yyextra->current->name = yytext;
- yyextra->current->name = substitute(yyextra->current->name,".","::");
- yyextra->current->name = substitute(yyextra->current->name,"\\","::");
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "namespace" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner);
- }
-<PackageName>";" {
+ yyextra->current->spec&=~Entry::Assign;
+ yyextra->current->spec|=Entry::Strong;
+ }
+<ObjCPropAttr>"nonatomic" {
+ yyextra->current->spec|=Entry::NonAtomic;
+ }
+<ObjCPropAttr>")" {
+ BEGIN(FindMembers);
+ }
+<FindMembers>"@"{ID} {
+ if (yyextra->insideJava) // Java annotation
+ {
+ // skip annotation
+ }
+ else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property
+ {
+ yyextra->current->mtype = yyextra->mtype = Property;
+ yyextra->current->spec|=Entry::Writable | Entry::Readable;
+ yyextra->current->protection = Public ;
+ }
+ else if (qstrcmp(yytext,"@synthesize")==0)
+ {
+ BEGIN( ObjCSkipStatement );
+ }
+ else if (qstrcmp(yytext,"@dynamic")==0)
+ {
+ BEGIN( ObjCSkipStatement );
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<ObjCSkipStatement>";" {
+ BEGIN(FindMembers);
+ }
+<PackageName>{ID}(("."|"\\"){ID})* {
+ yyextra->isTypedef=FALSE;
+ //printf("Found namespace %s lang=%d\n",yytext,yyextra->current->lang);
+ yyextra->current->name = yytext;
+ yyextra->current->name = substitute(yyextra->current->name,".","::");
+ yyextra->current->name = substitute(yyextra->current->name,"\\","::");
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "namespace" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner);
+ }
+<PackageName>";" {
std::shared_ptr<Entry> tmp = yyextra->current;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
yyextra->current_root = tmp;
- initEntry(yyscanner);
- BEGIN(FindMembers);
- }
-<PackageName>"{" {
- yyextra->curlyCount=0;
- BEGIN( ReadNSBody );
- }
-<FindMembers>{B}*"initonly"{BN}+ {
- yyextra->current->type += " initonly ";
- if (yyextra->insideCli) yyextra->current->spec |= Entry::Initonly;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"static"{BN}+ { yyextra->current->type += " static ";
- yyextra->current->stat = TRUE;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"extern"{BN}+ {
- yyextra->current->stat = FALSE;
- yyextra->current->explicitExternal = TRUE;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"const"{BN}+ { if (yyextra->insideCS)
- {
- yyextra->current->type += " const ";
- if (yyextra->insideCS) yyextra->current->stat = TRUE;
- lineCount(yyscanner);
- }
- else
- {
- REJECT;
- }
- }
-<FindMembers>{B}*"virtual"{BN}+ { yyextra->current->type += " virtual ";
- yyextra->current->virt = Virtual;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"constexpr"{BN}+ {
+ initEntry(yyscanner);
+ BEGIN(FindMembers);
+ }
+<PackageName>"{" {
+ yyextra->curlyCount=0;
+ BEGIN( ReadNSBody );
+ }
+<FindMembers>{B}*"initonly"{BN}+ {
+ yyextra->current->type += " initonly ";
+ if (yyextra->insideCli) yyextra->current->spec |= Entry::Initonly;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"static"{BN}+ { yyextra->current->type += " static ";
+ yyextra->current->stat = TRUE;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"extern"{BN}+ {
+ yyextra->current->stat = FALSE;
+ yyextra->current->explicitExternal = TRUE;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"const"{BN}+ { if (yyextra->insideCS)
+ {
+ yyextra->current->type += " const ";
+ if (yyextra->insideCS) yyextra->current->stat = TRUE;
+ lineCount(yyscanner);
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<FindMembers>{B}*"virtual"{BN}+ { yyextra->current->type += " virtual ";
+ yyextra->current->virt = Virtual;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"constexpr"{BN}+ {
if (yyextra->insideCpp)
{
yyextra->current->type += " constexpr ";
@@ -1067,300 +1067,300 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
REJECT;
}
- }
-<FindMembers>{B}*"published"{BN}+ { // UNO IDL published keyword
- if (yyextra->insideIDL)
- {
- lineCount(yyscanner);
- yyextra->current->spec |= Entry::Published;
- }
- else
- {
- REJECT;
- }
- }
-<FindMembers>{B}*"abstract"{BN}+ {
- if (!yyextra->insidePHP)
- {
- yyextra->current->type += " abstract ";
- if (!yyextra->insideJava)
- {
+ }
+<FindMembers>{B}*"published"{BN}+ { // UNO IDL published keyword
+ if (yyextra->insideIDL)
+ {
+ lineCount(yyscanner);
+ yyextra->current->spec |= Entry::Published;
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<FindMembers>{B}*"abstract"{BN}+ {
+ if (!yyextra->insidePHP)
+ {
+ yyextra->current->type += " abstract ";
+ if (!yyextra->insideJava)
+ {
yyextra->current->virt = Pure;
- }
- else
- {
+ }
+ else
+ {
yyextra->current->spec|=Entry::Abstract;
- }
- }
- else
- {
- yyextra->current->spec|=Entry::Abstract;
- }
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"inline"{BN}+ { yyextra->current->spec|=Entry::Inline;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"mutable"{BN}+ { yyextra->current->spec|=Entry::Mutable;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"explicit"{BN}+ { yyextra->current->spec|=Entry::Explicit;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"local"{BN}+ { yyextra->current->spec|=Entry::Local;
- lineCount(yyscanner);
- }
-<FindMembers>{B}*"@required"{BN}+ { // Objective C 2.0 protocol required section
+ }
+ }
+ else
+ {
+ yyextra->current->spec|=Entry::Abstract;
+ }
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"inline"{BN}+ { yyextra->current->spec|=Entry::Inline;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"mutable"{BN}+ { yyextra->current->spec|=Entry::Mutable;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"explicit"{BN}+ { yyextra->current->spec|=Entry::Explicit;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"local"{BN}+ { yyextra->current->spec|=Entry::Local;
+ lineCount(yyscanner);
+ }
+<FindMembers>{B}*"@required"{BN}+ { // Objective C 2.0 protocol required section
yyextra->current->spec=(yyextra->current->spec & ~Entry::Optional) | Entry::Required;
- lineCount(yyscanner);
+ lineCount(yyscanner);
}
-<FindMembers>{B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section
+<FindMembers>{B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section
yyextra->current->spec=(yyextra->current->spec & ~Entry::Required) | Entry::Optional;
- lineCount(yyscanner);
+ lineCount(yyscanner);
}
/*
-<FindMembers>{B}*"import"{BN}+ { // IDL import keyword
- BEGIN( NextSemi );
- }
+<FindMembers>{B}*"import"{BN}+ { // IDL import keyword
+ BEGIN( NextSemi );
+ }
*/
-<FindMembers>{B}*"typename"{BN}+ { lineCount(yyscanner); }
-<FindMembers>{B}*"namespace"{BN}*/[^a-z_A-Z0-9] {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "namespace" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner);
- if (yyextra->insidePHP)
- {
- BEGIN( PackageName );
- }
- else
- {
- BEGIN( CompoundName );
- }
- }
-<FindMembers>{B}*"module"{BN}+ {
- lineCount(yyscanner);
+<FindMembers>{B}*"typename"{BN}+ { lineCount(yyscanner); }
+<FindMembers>{B}*"namespace"{BN}*/[^a-z_A-Z0-9] {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "namespace" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner);
+ if (yyextra->insidePHP)
+ {
+ BEGIN( PackageName );
+ }
+ else
+ {
+ BEGIN( CompoundName );
+ }
+ }
+<FindMembers>{B}*"module"{BN}+ {
+ lineCount(yyscanner);
if (yyextra->insideIDL || yyextra->insideSlice)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "module" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else if (yyextra->insideD)
- {
- lineCount(yyscanner);
- BEGIN(PackageName);
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{B}*"library"{BN}+ {
- lineCount(yyscanner);
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "module" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else if (yyextra->insideD)
+ {
+ lineCount(yyscanner);
+ BEGIN(PackageName);
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{B}*"library"{BN}+ {
+ lineCount(yyscanner);
+ if (yyextra->insideIDL)
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "library" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{B}*"constants"{BN}+ { // UNO IDL constant group
+ lineCount(yyscanner);
+ if (yyextra->insideIDL)
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::NAMESPACE_SEC;
+ yyextra->current->type = "constants";
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{BN}*("service"){BN}+ { // UNO IDL service
+ lineCount(yyscanner);
+ if (yyextra->insideIDL)
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->current->spec = Entry::Service |
+ // preserve UNO IDL [optional] or published
+ (yyextra->current->spec & (Entry::Optional|Entry::Published));
+ addType(yyscanner);
+ yyextra->current->type += " service " ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else // TODO is addType right? just copy/pasted
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{BN}*("singleton"){BN}+ { // UNO IDL singleton
+ lineCount(yyscanner);
if (yyextra->insideIDL)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "library" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{B}*"constants"{BN}+ { // UNO IDL constant group
- lineCount(yyscanner);
- if (yyextra->insideIDL)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::NAMESPACE_SEC;
- yyextra->current->type = "constants";
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{BN}*("service"){BN}+ { // UNO IDL service
- lineCount(yyscanner);
- if (yyextra->insideIDL)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
- yyextra->current->spec = Entry::Service |
- // preserve UNO IDL [optional] or published
- (yyextra->current->spec & (Entry::Optional|Entry::Published));
- addType(yyscanner);
- yyextra->current->type += " service " ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else // TODO is addType right? just copy/pasted
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{BN}*("singleton"){BN}+ { // UNO IDL singleton
- lineCount(yyscanner);
- if (yyextra->insideIDL)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
- yyextra->current->spec = Entry::Singleton |
- (yyextra->current->spec & Entry::Published); // preserve
- addType(yyscanner);
- yyextra->current->type += " singleton " ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else // TODO is addType right? just copy/pasted
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface
- lineCount(yyscanner);
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->current->spec = Entry::Singleton |
+ (yyextra->current->spec & Entry::Published); // preserve
+ addType(yyscanner);
+ yyextra->current->type += " singleton " ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else // TODO is addType right? just copy/pasted
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface
+ lineCount(yyscanner);
if (yyextra->insideIDL || yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideSlice)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
- yyextra->current->spec = Entry::Interface |
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->current->spec = Entry::Interface |
// preserve UNO IDL [optional], published, Slice local
(yyextra->current->spec & (Entry::Optional|Entry::Published|Entry::Local));
- addType(yyscanner);
- yyextra->current->type += " interface" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = QCString(yytext).stripWhiteSpace();
- }
- }
-<FindMembers>{B}*"@implementation"{BN}+ { // Objective-C class implementation
- lineCount(yyscanner);
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::OBJCIMPL_SEC;
- yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
- yyextra->insideObjC = TRUE;
- yyextra->current->protection = yyextra->protection = Public ;
- addType(yyscanner);
- yyextra->current->type += " implementation" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
-<FindMembers>{B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute
- lineCount(yyscanner);
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ addType(yyscanner);
+ yyextra->current->type += " interface" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = QCString(yytext).stripWhiteSpace();
+ }
+ }
+<FindMembers>{B}*"@implementation"{BN}+ { // Objective-C class implementation
+ lineCount(yyscanner);
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::OBJCIMPL_SEC;
+ yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
+ yyextra->insideObjC = TRUE;
+ yyextra->current->protection = yyextra->protection = Public ;
+ addType(yyscanner);
+ yyextra->current->type += " implementation" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+<FindMembers>{B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute
+ lineCount(yyscanner);
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Interface;
- if (!yyextra->insideJava)
- {
- yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
- yyextra->insideObjC = TRUE;
- }
- yyextra->current->protection = yyextra->protection = Public ;
- addType(yyscanner);
- yyextra->current->type += " interface" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
-<FindMembers>{B}*"@protocol"{BN}+ { // Objective-C protocol definition
- lineCount(yyscanner);
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ if (!yyextra->insideJava)
+ {
+ yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
+ yyextra->insideObjC = TRUE;
+ }
+ yyextra->current->protection = yyextra->protection = Public ;
+ addType(yyscanner);
+ yyextra->current->type += " interface" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+<FindMembers>{B}*"@protocol"{BN}+ { // Objective-C protocol definition
+ lineCount(yyscanner);
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Protocol;
- yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
- yyextra->insideObjC = TRUE;
- yyextra->current->protection = yyextra->protection = Public ;
- addType(yyscanner);
- yyextra->current->type += " protocol" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( CompoundName );
- }
-<FindMembers>{B}*"exception"{BN}+ { // Corba IDL/Slice exception
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
+ yyextra->insideObjC = TRUE;
+ yyextra->current->protection = yyextra->protection = Public ;
+ addType(yyscanner);
+ yyextra->current->type += " protocol" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( CompoundName );
+ }
+<FindMembers>{B}*"exception"{BN}+ { // Corba IDL/Slice exception
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
// preserve UNO IDL, Slice local
- yyextra->current->spec = Entry::Exception |
- (yyextra->current->spec & Entry::Published) |
- (yyextra->current->spec & Entry::Local);
- addType(yyscanner);
- yyextra->current->type += " exception" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner);
- BEGIN( CompoundName );
- }
+ yyextra->current->spec = Entry::Exception |
+ (yyextra->current->spec & Entry::Published) |
+ (yyextra->current->spec & Entry::Local);
+ addType(yyscanner);
+ yyextra->current->type += " exception" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner);
+ BEGIN( CompoundName );
+ }
<FindMembers>"@class" | // for Objective C class declarations
<FindMembers>{B}*{TYPEDEFPREFIX}"class{" |
-<FindMembers>{B}*{TYPEDEFPREFIX}"class"{BN}+ {
+<FindMembers>{B}*{TYPEDEFPREFIX}"class"{BN}+ {
QCString decl = yytext;
- yyextra->isTypedef=decl.find("typedef")!=-1;
+ yyextra->isTypedef=decl.find("typedef")!=-1;
bool isConst=decl.find("const")!=-1;
bool isVolatile=decl.find("volatile")!=-1;
- yyextra->current->section = Entry::CLASS_SEC;
- addType(yyscanner);
+ yyextra->current->section = Entry::CLASS_SEC;
+ addType(yyscanner);
uint64 spec = yyextra->current->spec;
- if (yyextra->insidePHP && yyextra->current->spec&Entry::Abstract)
- {
- // convert Abstract to AbstractClass
- yyextra->current->spec=(yyextra->current->spec&~Entry::Abstract)|Entry::AbstractClass;
- }
+ if (yyextra->insidePHP && yyextra->current->spec&Entry::Abstract)
+ {
+ // convert Abstract to AbstractClass
+ yyextra->current->spec=(yyextra->current->spec&~Entry::Abstract)|Entry::AbstractClass;
+ }
if (yyextra->insideSlice && spec&Entry::Local)
{
yyextra->current->spec|=Entry::Local;
@@ -1373,107 +1373,107 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
yyextra->current->type += " volatile";
}
- yyextra->current->type += " class" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- if (yytext[0]=='@')
- {
- yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
- yyextra->insideObjC = TRUE;
- }
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ yyextra->current->type += " class" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ if (yytext[0]=='@')
+ {
+ yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
+ yyextra->insideObjC = TRUE;
+ }
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"value class{" | // C++/CLI extension
<FindMembers>{B}*"value class"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Value;
- addType(yyscanner);
- yyextra->current->type += " value class" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ addType(yyscanner);
+ yyextra->current->type += " value class" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"ref class{" | // C++/CLI extension
<FindMembers>{B}*"ref class"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Ref;
- addType(yyscanner);
- yyextra->current->type += " ref class" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ addType(yyscanner);
+ yyextra->current->type += " ref class" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"interface class{" | // C++/CLI extension
<FindMembers>{B}*"interface class"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Interface;
- addType(yyscanner);
- yyextra->current->type += " interface class" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
-<FindMembers>{B}*"coclass"{BN}+ {
- if (yyextra->insideIDL)
- {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
- addType(yyscanner);
- yyextra->current->type += " coclass" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- BEGIN( CompoundName ) ;
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = yytext;
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- lineCount(yyscanner);
- }
- }
-<FindMembers>{B}*{TYPEDEFPREFIX}"struct{" |
-<FindMembers>{B}*{TYPEDEFPREFIX}"struct"/{BN}+ {
+ addType(yyscanner);
+ yyextra->current->type += " interface class" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
+<FindMembers>{B}*"coclass"{BN}+ {
+ if (yyextra->insideIDL)
+ {
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
+ addType(yyscanner);
+ yyextra->current->type += " coclass" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ BEGIN( CompoundName ) ;
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = yytext;
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ lineCount(yyscanner);
+ }
+ }
+<FindMembers>{B}*{TYPEDEFPREFIX}"struct{" |
+<FindMembers>{B}*{TYPEDEFPREFIX}"struct"/{BN}+ {
QCString decl = yytext;
- yyextra->isTypedef=decl.find("typedef")!=-1;
+ yyextra->isTypedef=decl.find("typedef")!=-1;
bool isConst=decl.find("const")!=-1;
bool isVolatile=decl.find("volatile")!=-1;
- yyextra->current->section = Entry::CLASS_SEC ;
+ yyextra->current->section = Entry::CLASS_SEC ;
// preserve UNO IDL & Inline attributes, Slice local
- yyextra->current->spec = Entry::Struct |
- (yyextra->current->spec & Entry::Published) |
+ yyextra->current->spec = Entry::Struct |
+ (yyextra->current->spec & Entry::Published) |
(yyextra->current->spec & Entry::Inline) |
- (yyextra->current->spec & Entry::Local);
- // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
- //yyextra->current->objc = yyextra->insideObjC = FALSE;
- addType(yyscanner);
+ (yyextra->current->spec & Entry::Local);
+ // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
+ //yyextra->current->objc = yyextra->insideObjC = FALSE;
+ addType(yyscanner);
if (isConst)
{
yyextra->current->type += " const";
@@ -1482,75 +1482,75 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
yyextra->current->type += " volatile";
}
- yyextra->current->type += " struct" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ yyextra->current->type += " struct" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"value struct{" | // C++/CLI extension
<FindMembers>{B}*"value struct"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Struct | Entry::Value;
- addType(yyscanner);
- yyextra->current->type += " value struct" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ addType(yyscanner);
+ yyextra->current->type += " value struct" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"ref struct{" | // C++/CLI extension
<FindMembers>{B}*"ref struct"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Struct | Entry::Ref;
- addType(yyscanner);
- yyextra->current->type += " ref struct" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ addType(yyscanner);
+ yyextra->current->type += " ref struct" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*"interface struct{" | // C++/CLI extension
<FindMembers>{B}*"interface struct"{BN}+ {
- yyextra->isTypedef=FALSE;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->isTypedef=FALSE;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Struct | Entry::Interface;
- addType(yyscanner);
- yyextra->current->type += " interface struct";
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ addType(yyscanner);
+ yyextra->current->type += " interface struct";
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*{TYPEDEFPREFIX}"union{" |
-<FindMembers>{B}*{TYPEDEFPREFIX}"union"{BN}+ {
+<FindMembers>{B}*{TYPEDEFPREFIX}"union"{BN}+ {
QCString decl=yytext;
- yyextra->isTypedef=decl.find("typedef")!=-1;
+ yyextra->isTypedef=decl.find("typedef")!=-1;
bool isConst=decl.find("const")!=-1;
bool isVolatile=decl.find("volatile")!=-1;
- yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->current->section = Entry::CLASS_SEC;
yyextra->current->spec = Entry::Union;
- // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
- //yyextra->current->objc = yyextra->insideObjC = FALSE;
- addType(yyscanner);
+ // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
+ //yyextra->current->objc = yyextra->insideObjC = FALSE;
+ addType(yyscanner);
if (isConst)
{
yyextra->current->type += " const";
@@ -1559,239 +1559,239 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
yyextra->current->type += " volatile";
}
- yyextra->current->type += " union" ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ yyextra->current->type += " union" ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" |
<FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum
QCString text=yytext;
- yyextra->isTypedef = text.find("typedef")!=-1;
+ yyextra->isTypedef = text.find("typedef")!=-1;
bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || yyextra->insideCS;
- if (yyextra->insideJava)
- {
- yyextra->current->section = Entry::CLASS_SEC;
- yyextra->current->spec = Entry::Enum;
- }
- else
- {
- yyextra->current->section = Entry::ENUM_SEC ;
- }
- addType(yyscanner);
- yyextra->current->type += " enum";
+ if (yyextra->insideJava)
+ {
+ yyextra->current->section = Entry::CLASS_SEC;
+ yyextra->current->spec = Entry::Enum;
+ }
+ else
+ {
+ yyextra->current->section = Entry::ENUM_SEC ;
+ }
+ addType(yyscanner);
+ yyextra->current->type += " enum";
if (isStrongEnum)
{
yyextra->current->spec |= Entry::Strong;
}
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner) ;
- if (yytext[yyleng-1]=='{') unput('{');
- BEGIN( CompoundName ) ;
- }
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner) ;
+ if (yytext[yyleng-1]=='{') unput('{');
+ BEGIN( CompoundName ) ;
+ }
<Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"(" { // A::operator()<int>(int arg)
- lineCount(yyscanner);
- yyextra->current->name += "()";
- BEGIN( FindMembers );
- }
-<Operator>"("{BN}*")"{BN}*/"(" {
- lineCount(yyscanner);
- yyextra->current->name += yytext ;
- yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
- BEGIN( FindMembers ) ;
- }
-<Operator>";" { // can occur when importing members
- unput(';');
- BEGIN( FindMembers ) ;
- }
-<Operator>[^(] {
- lineCount(yyscanner);
- yyextra->current->name += *yytext ;
- }
-<Operator>"<>" { /* skip guided templ specifiers */ }
-<Operator>"(" {
- yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
- unput(*yytext);
- BEGIN( FindMembers ) ;
- }
-<FindMembers>("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension
- lineCount(yyscanner);
- ArgumentList al;
- //yyextra->current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template;
- yyextra->current->tArgLists.push_back(al);
- yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
- yyextra->templateStr="<";
- yyextra->fullArgString = yyextra->templateStr;
- yyextra->copyArgString = &yyextra->templateStr;
- yyextra->currentArgumentContext = FindMembers;
- BEGIN( ReadTempArgs );
- }
+ lineCount(yyscanner);
+ yyextra->current->name += "()";
+ BEGIN( FindMembers );
+ }
+<Operator>"("{BN}*")"{BN}*/"(" {
+ lineCount(yyscanner);
+ yyextra->current->name += yytext ;
+ yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
+ BEGIN( FindMembers ) ;
+ }
+<Operator>";" { // can occur when importing members
+ unput(';');
+ BEGIN( FindMembers ) ;
+ }
+<Operator>[^(] {
+ lineCount(yyscanner);
+ yyextra->current->name += *yytext ;
+ }
+<Operator>"<>" { /* skip guided templ specifiers */ }
+<Operator>"(" {
+ yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
+ unput(*yytext);
+ BEGIN( FindMembers ) ;
+ }
+<FindMembers>("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension
+ lineCount(yyscanner);
+ ArgumentList al;
+ //yyextra->current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template;
+ yyextra->current->tArgLists.push_back(al);
+ yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
+ yyextra->templateStr="<";
+ yyextra->fullArgString = yyextra->templateStr;
+ yyextra->copyArgString = &yyextra->templateStr;
+ yyextra->currentArgumentContext = FindMembers;
+ BEGIN( ReadTempArgs );
+ }
<FindMembers>"namespace"{BN}+/{ID}{BN}*"=" { // namespace alias
- lineCount(yyscanner);
- BEGIN( NSAliasName );
- }
-<NSAliasName>{ID} {
- yyextra->aliasName = yytext;
- BEGIN( NSAliasArg );
- }
-<NSAliasArg>({ID}"::")*{ID} {
- //printf("Inserting namespace alias %s::%s->%s\n",yyextra->current_root->name.data(),yyextra->aliasName.data(),yytext);
+ lineCount(yyscanner);
+ BEGIN( NSAliasName );
+ }
+<NSAliasName>{ID} {
+ yyextra->aliasName = yytext;
+ BEGIN( NSAliasArg );
+ }
+<NSAliasArg>({ID}"::")*{ID} {
+ //printf("Inserting namespace alias %s::%s->%s\n",yyextra->current_root->name.data(),yyextra->aliasName.data(),yytext);
// TODO: namespace aliases are now treated as global entities
// while they should be aware of the scope they are in
Doxygen::namespaceAliasMap.insert({yyextra->aliasName.data(),std::string(yytext)});
- }
-<NSAliasArg>";" {
- BEGIN( FindMembers );
- }
+ }
+<NSAliasArg>";" {
+ BEGIN( FindMembers );
+ }
<PHPUse>({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" {
- lineCount(yyscanner);
- yyextra->aliasName=yytext;
- BEGIN(PHPUseAs);
- }
-<PHPUse>({ID}{BN}*"\\"{BN}*)*{ID} {
- lineCount(yyscanner);
- yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::"));
- //printf("PHP: adding use relation: %s\n",yyextra->current->name.data());
- yyextra->current->fileName = yyextra->yyFileName;
+ lineCount(yyscanner);
+ yyextra->aliasName=yytext;
+ BEGIN(PHPUseAs);
+ }
+<PHPUse>({ID}{BN}*"\\"{BN}*)*{ID} {
+ lineCount(yyscanner);
+ yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::"));
+ //printf("PHP: adding use relation: %s\n",yyextra->current->name.data());
+ yyextra->current->fileName = yyextra->yyFileName;
// add a using declaration
- yyextra->current->section=Entry::USINGDECL_SEC;
- yyextra->current_root->copyToSubEntry(yyextra->current);
+ yyextra->current->section=Entry::USINGDECL_SEC;
+ yyextra->current_root->copyToSubEntry(yyextra->current);
// also add it as a using directive
- yyextra->current->section=Entry::USINGDIR_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- yyextra->aliasName.resize(0);
- }
-<PHPUseAs>{BN}+"as"{BN}+ {
- lineCount(yyscanner);
- }
+ yyextra->current->section=Entry::USINGDIR_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ yyextra->aliasName.resize(0);
+ }
+<PHPUseAs>{BN}+"as"{BN}+ {
+ lineCount(yyscanner);
+ }
<PHPUseAs>{PHPUSEKW} {
}
-<PHPUseAs>{ID} {
- //printf("PHP: adding use as relation: %s->%s\n",yytext,yyextra->aliasName.data());
+<PHPUseAs>{ID} {
+ //printf("PHP: adding use as relation: %s->%s\n",yytext,yyextra->aliasName.data());
if (!yyextra->aliasName.isEmpty())
{
Doxygen::namespaceAliasMap.insert({yytext,
- std::string(removeRedundantWhiteSpace(
- substitute(yyextra->aliasName,"\\","::")).data())});
- }
- yyextra->aliasName.resize(0);
- }
-<PHPUse,PHPUseAs>[,;] {
- if (*yytext==',')
- {
- BEGIN(PHPUse);
- }
- else
- {
- BEGIN(FindMembers);
- }
- }
-<JavaImport>({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive
- lineCount(yyscanner);
- QCString scope=yytext;
- yyextra->current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::"));
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->section=Entry::USINGDIR_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN(Using);
- }
-<JavaImport>({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration
+ std::string(removeRedundantWhiteSpace(
+ substitute(yyextra->aliasName,"\\","::")).data())});
+ }
+ yyextra->aliasName.resize(0);
+ }
+<PHPUse,PHPUseAs>[,;] {
+ if (*yytext==',')
+ {
+ BEGIN(PHPUse);
+ }
+ else
+ {
+ BEGIN(FindMembers);
+ }
+ }
+<JavaImport>({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive
lineCount(yyscanner);
- QCString scope=yytext;
- yyextra->current->name=removeRedundantWhiteSpace(substitute(scope,".","::"));
- yyextra->current->fileName = yyextra->yyFileName;
- if (yyextra->insideD)
- {
- yyextra->current->section=Entry::USINGDIR_SEC;
- }
- else
- {
- //printf("import name = %s -> %s\n",yytext,yyextra->current->name.data());
- yyextra->current->section=Entry::USINGDECL_SEC;
- }
+ QCString scope=yytext;
+ yyextra->current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::"));
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->section=Entry::USINGDIR_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN(Using);
+ }
+<JavaImport>({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration
+ lineCount(yyscanner);
+ QCString scope=yytext;
+ yyextra->current->name=removeRedundantWhiteSpace(substitute(scope,".","::"));
+ yyextra->current->fileName = yyextra->yyFileName;
+ if (yyextra->insideD)
+ {
+ yyextra->current->section=Entry::USINGDIR_SEC;
+ }
+ else
+ {
+ //printf("import name = %s -> %s\n",yytext,yyextra->current->name.data());
+ yyextra->current->section=Entry::USINGDECL_SEC;
+ }
yyextra->previous = yyextra->current;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN(Using);
- }
-<FindMembers>"using"{BN}+ {
- yyextra->current->startLine=yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- lineCount(yyscanner);
- BEGIN(Using);
- }
-<Using>"namespace"{BN}+ { lineCount(yyscanner); BEGIN(UsingDirective); }
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN(Using);
+ }
+<FindMembers>"using"{BN}+ {
+ yyextra->current->startLine=yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ lineCount(yyscanner);
+ BEGIN(Using);
+ }
+<Using>"namespace"{BN}+ { lineCount(yyscanner); BEGIN(UsingDirective); }
<Using>({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}) {
lineCount(yyscanner);
- yyextra->current->name=yytext;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->section=Entry::USINGDECL_SEC;
+ yyextra->current->name=yytext;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->section=Entry::USINGDECL_SEC;
yyextra->current->startLine = yyextra->yyLineNr;
yyextra->previous = yyextra->current;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- if (yyextra->insideCS) /* Hack: in C# a using declaration and
- directive have the same syntax, so we
- also add it as a using directive here
- */
- {
- yyextra->current->name=yytext;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->section=Entry::USINGDIR_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- }
- BEGIN(Using);
- }
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ if (yyextra->insideCS) /* Hack: in C# a using declaration and
+ directive have the same syntax, so we
+ also add it as a using directive here
+ */
+ {
+ yyextra->current->name=yytext;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->section=Entry::USINGDIR_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ }
+ BEGIN(Using);
+ }
<Using>"=" { // C++11 style template alias?
BEGIN(UsingAlias);
}
-<UsingAlias>";" {
+<UsingAlias>";" {
yyextra->previous->section=Entry::VARIABLE_SEC;
yyextra->previous->type = "typedef "+yyextra->previous->args;
- yyextra->previous->type=yyextra->previous->type.simplifyWhiteSpace();
+ yyextra->previous->type=yyextra->previous->type.simplifyWhiteSpace();
yyextra->previous->args.resize(0);
- yyextra->previous->name=yyextra->previous->name.stripWhiteSpace();
- yyextra->previous->bodyLine = yyextra->yyLineNr;
- yyextra->previous->bodyColumn = yyextra->yyColNr;
+ yyextra->previous->name=yyextra->previous->name.stripWhiteSpace();
+ yyextra->previous->bodyLine = yyextra->yyLineNr;
+ yyextra->previous->bodyColumn = yyextra->yyColNr;
yyextra->previous->spec |= Entry::Alias;
- BEGIN(FindMembers);
+ BEGIN(FindMembers);
}
<UsingAlias>";"{BN}*("/**"|"//!"|"/*!"|"///")"<" {
- yyextra->docBlockContext = UsingAliasEnd;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ yyextra->docBlockContext = UsingAliasEnd;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- lineCount(yyscanner);
-
- yyextra->docBlockTerm = ';';
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
+ lineCount(yyscanner);
+
+ yyextra->docBlockTerm = ';';
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
<UsingAlias>">>" {
yyextra->previous->args+="> >"; // see bug769552
}
@@ -1810,300 +1810,300 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
unput(';');
BEGIN(UsingAlias);
}
-<UsingDirective>{SCOPENAME} { yyextra->current->name=removeRedundantWhiteSpace(yytext);
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->section=Entry::USINGDIR_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN(Using);
- }
-<Using>";" { BEGIN(FindMembers); }
-<FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl
- QCString n=yytext;
- addType(yyscanner);
- yyextra->current->name=n.left(n.length()-2);
- }
-<FindMembers>{SCOPENAME}{BN}*/"<" { // Note: this could be a return type!
+<UsingDirective>{SCOPENAME} { yyextra->current->name=removeRedundantWhiteSpace(yytext);
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->section=Entry::USINGDIR_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN(Using);
+ }
+<Using>";" { BEGIN(FindMembers); }
+<FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl
+ QCString n=yytext;
+ addType(yyscanner);
+ yyextra->current->name=n.left(n.length()-2);
+ }
+<FindMembers>{SCOPENAME}{BN}*/"<" { // Note: this could be a return type!
yyextra->roundCount=0;
- yyextra->sharpCount=0;
- lineCount(yyscanner);
- addType(yyscanner);
- yyextra->current->name=yytext;
- yyextra->current->name=yyextra->current->name.stripWhiteSpace();
- //yyextra->current->scopeSpec.resize(0);
- // yyextra->currentTemplateSpec = &yyextra->current->scopeSpec;
- if (nameIsOperator(yyextra->current->name))
- BEGIN( Operator );
- else
- BEGIN( EndTemplate );
- }
-<FindMemberName>{SCOPENAME}{BN}*/"<" {
- yyextra->sharpCount=0;
- yyextra->roundCount=0;
- lineCount(yyscanner);
- yyextra->current->name+=((QCString)yytext).stripWhiteSpace();
- //yyextra->current->memberSpec.resize(0);
- // yyextra->currentTemplateSpec = &yyextra->current->memberSpec;
- if (nameIsOperator(yyextra->current->name))
- BEGIN( Operator );
- else
- BEGIN( EndTemplate );
- }
-<EndTemplate>"<<<" {
- if (!yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
+ yyextra->sharpCount=0;
+ lineCount(yyscanner);
+ addType(yyscanner);
+ yyextra->current->name=yytext;
+ yyextra->current->name=yyextra->current->name.stripWhiteSpace();
+ //yyextra->current->scopeSpec.resize(0);
+ // yyextra->currentTemplateSpec = &yyextra->current->scopeSpec;
+ if (nameIsOperator(yyextra->current->name))
+ BEGIN( Operator );
+ else
+ BEGIN( EndTemplate );
+ }
+<FindMemberName>{SCOPENAME}{BN}*/"<" {
+ yyextra->sharpCount=0;
+ yyextra->roundCount=0;
+ lineCount(yyscanner);
+ yyextra->current->name+=((QCString)yytext).stripWhiteSpace();
+ //yyextra->current->memberSpec.resize(0);
+ // yyextra->currentTemplateSpec = &yyextra->current->memberSpec;
+ if (nameIsOperator(yyextra->current->name))
+ BEGIN( Operator );
+ else
+ BEGIN( EndTemplate );
+ }
+<EndTemplate>"<<<" {
+ if (!yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
yyextra->lastHereDocContext = YY_START;
- BEGIN(HereDoc);
- }
- }
-<ClassTemplSpec,EndTemplate>"<<" {
- yyextra->current->name+=yytext;
- // *yyextra->currentTemplateSpec+=yytext;
- }
-<EndTemplate>"<" {
+ BEGIN(HereDoc);
+ }
+ }
+<ClassTemplSpec,EndTemplate>"<<" {
+ yyextra->current->name+=yytext;
+ // *yyextra->currentTemplateSpec+=yytext;
+ }
+<EndTemplate>"<" {
if (yyextra->roundCount==0)
{
- // *yyextra->currentTemplateSpec+='<';
- yyextra->sharpCount++;
- }
- yyextra->current->name+=yytext;
- }
-<ClassTemplSpec,EndTemplate>">>" {
- if (yyextra->insideJava || yyextra->insideCS || yyextra->insideCli || yyextra->roundCount==0)
- {
- unput('>');
- unput(' ');
- unput('>');
- }
- else
- {
- yyextra->current->name+=yytext;
- }
- // *yyextra->currentTemplateSpec+=yytext;
- }
-<EndTemplate>">" {
- yyextra->current->name+='>';
- // *yyextra->currentTemplateSpec+='>';
- if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
- {
- //printf("Found %s\n",yyextra->current->name.data());
- BEGIN(FindMembers);
- }
- }
-<EndTemplate>">"{BN}*"(" {
- lineCount(yyscanner);
- yyextra->current->name+='>';
- // *yyextra->currentTemplateSpec+='>';
- if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
- {
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->args = "(";
- yyextra->currentArgumentContext = FuncQual;
- yyextra->fullArgString = yyextra->current->args.copy();
- yyextra->copyArgString = &yyextra->current->args;
- //printf("Found %s\n",yyextra->current->name.data());
- BEGIN( ReadFuncArgType ) ;
- }
- }
+ // *yyextra->currentTemplateSpec+='<';
+ yyextra->sharpCount++;
+ }
+ yyextra->current->name+=yytext;
+ }
+<ClassTemplSpec,EndTemplate>">>" {
+ if (yyextra->insideJava || yyextra->insideCS || yyextra->insideCli || yyextra->roundCount==0)
+ {
+ unput('>');
+ unput(' ');
+ unput('>');
+ }
+ else
+ {
+ yyextra->current->name+=yytext;
+ }
+ // *yyextra->currentTemplateSpec+=yytext;
+ }
+<EndTemplate>">" {
+ yyextra->current->name+='>';
+ // *yyextra->currentTemplateSpec+='>';
+ if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
+ {
+ //printf("Found %s\n",yyextra->current->name.data());
+ BEGIN(FindMembers);
+ }
+ }
+<EndTemplate>">"{BN}*"(" {
+ lineCount(yyscanner);
+ yyextra->current->name+='>';
+ // *yyextra->currentTemplateSpec+='>';
+ if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
+ {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->args = "(";
+ yyextra->currentArgumentContext = FuncQual;
+ yyextra->fullArgString = yyextra->current->args.copy();
+ yyextra->copyArgString = &yyextra->current->args;
+ //printf("Found %s\n",yyextra->current->name.data());
+ BEGIN( ReadFuncArgType ) ;
+ }
+ }
<EndTemplate>">"{BN}*/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance
- lineCount(yyscanner);
- yyextra->current->name+='>';
+ lineCount(yyscanner);
+ yyextra->current->name+='>';
if (yyextra->roundCount==0)
{
- BEGIN(FindMembers);
- }
- }
-<EndTemplate>">"{BN}*/"::" {
- lineCount(yyscanner);
- yyextra->current->name+='>';
- // *yyextra->currentTemplateSpec+='>';
- if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
- {
- BEGIN(FindMemberName);
- }
- }
+ BEGIN(FindMembers);
+ }
+ }
+<EndTemplate>">"{BN}*/"::" {
+ lineCount(yyscanner);
+ yyextra->current->name+='>';
+ // *yyextra->currentTemplateSpec+='>';
+ if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
+ {
+ BEGIN(FindMemberName);
+ }
+ }
<ClassTemplSpec,EndTemplate>"(" { yyextra->current->name+=*yytext;
- yyextra->roundCount++;
+ yyextra->roundCount++;
}
<ClassTemplSpec,EndTemplate>")" { yyextra->current->name+=*yytext;
- if (yyextra->roundCount>0) yyextra->roundCount--;
- }
-<EndTemplate>. {
- yyextra->current->name+=*yytext;
- // *yyextra->currentTemplateSpec+=*yytext;
- }
-<FindMembers>"define"{BN}*"("{BN}*["'] {
- if (yyextra->insidePHP)
- {
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( DefinePHP );
- }
- else
- REJECT;
- }
+ if (yyextra->roundCount>0) yyextra->roundCount--;
+ }
+<EndTemplate>. {
+ yyextra->current->name+=*yytext;
+ // *yyextra->currentTemplateSpec+=*yytext;
+ }
+<FindMembers>"define"{BN}*"("{BN}*["'] {
+ if (yyextra->insidePHP)
+ {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( DefinePHP );
+ }
+ else
+ REJECT;
+ }
<CopyHereDoc>{ID} { // PHP heredoc
- yyextra->delimiter = yytext;
+ yyextra->delimiter = yytext;
*yyextra->pCopyHereDocGString += yytext;
- BEGIN(CopyHereDocEnd);
+ BEGIN(CopyHereDocEnd);
}
-<CopyHereDoc>"'"{ID}/"'" { // PHP nowdoc
- yyextra->delimiter = &yytext[1];
+<CopyHereDoc>"'"{ID}/"'" { // PHP nowdoc
+ yyextra->delimiter = &yytext[1];
*yyextra->pCopyHereDocGString += yytext;
- BEGIN(CopyHereDocEnd);
- }
-<HereDoc>{ID} { // PHP heredoc
- yyextra->delimiter = yytext;
- BEGIN(HereDocEnd);
- }
-<HereDoc>"'"{ID}/"'" { // PHP nowdoc
- yyextra->delimiter = &yytext[1];
- BEGIN(HereDocEnd);
- }
-<HereDocEnd>^{ID} { // id at start of the line could mark the end of the block
- if (yyextra->delimiter==yytext) // it is the end marker
- {
- BEGIN(yyextra->lastHereDocContext);
- }
- }
-<HereDocEnd>. { }
-<CopyHereDocEnd>^{ID} { // id at start of the line could mark the end of the block
+ BEGIN(CopyHereDocEnd);
+ }
+<HereDoc>{ID} { // PHP heredoc
+ yyextra->delimiter = yytext;
+ BEGIN(HereDocEnd);
+ }
+<HereDoc>"'"{ID}/"'" { // PHP nowdoc
+ yyextra->delimiter = &yytext[1];
+ BEGIN(HereDocEnd);
+ }
+<HereDocEnd>^{ID} { // id at start of the line could mark the end of the block
+ if (yyextra->delimiter==yytext) // it is the end marker
+ {
+ BEGIN(yyextra->lastHereDocContext);
+ }
+ }
+<HereDocEnd>. { }
+<CopyHereDocEnd>^{ID} { // id at start of the line could mark the end of the block
*yyextra->pCopyHereDocGString += yytext;
- if (yyextra->delimiter==yytext) // it is the end marker
- {
- BEGIN(yyextra->lastHereDocContext);
- }
- }
-<CopyHereDocEnd>\n {
+ if (yyextra->delimiter==yytext) // it is the end marker
+ {
+ BEGIN(yyextra->lastHereDocContext);
+ }
+ }
+<CopyHereDocEnd>\n {
lineCount(yyscanner);
*yyextra->pCopyHereDocGString += yytext;
}
-<CopyHereDocEnd>{ID} {
+<CopyHereDocEnd>{ID} {
*yyextra->pCopyHereDocGString += yytext;
}
-<CopyHereDocEnd>. {
+<CopyHereDocEnd>. {
*yyextra->pCopyHereDocGString += yytext;
}
-<FindMembers>"Q_OBJECT" { // Qt object macro
- }
-<FindMembers>"Q_PROPERTY" { // Qt property declaration
- yyextra->current->protection = Public ; // see bug734245 & bug735462
- yyextra->current->mtype = yyextra->mtype = Property;
- yyextra->current->type.resize(0);
- BEGIN(QtPropType);
- }
-<QtPropType>"(" { // start of property arguments
- }
-<QtPropAttr>")" { // end of property arguments
- unput(';');
- BEGIN(FindMembers);
- }
-<QtPropType>{B}+ {
- yyextra->current->name+=yytext;
- }
-<QtPropType>"*" {
- yyextra->current->type+= yyextra->current->name;
- yyextra->current->type+= yytext;
- yyextra->current->name="";
- }
-<QtPropType>({TSCOPE}"::")*{TSCOPE} {
- yyextra->current->type+= yyextra->current->name;
- yyextra->current->name=yytext;
- }
-<QtPropType,QtPropAttr>{B}+"READ"{B}+ {
- yyextra->current->spec |= Entry::Readable;
- BEGIN(QtPropRead);
- }
-<QtPropType,QtPropAttr>{B}+"WRITE"{B}+ {
- yyextra->current->spec |= Entry::Writable;
- BEGIN(QtPropWrite);
- }
-<QtPropType,QtPropAttr>{B}+"MEMBER"{B}+{ID} | // member property => not supported yet
-<QtPropType,QtPropAttr>{B}+"RESET"{B}+{ID} | // reset method => not supported yet
-<QtPropType,QtPropAttr>{B}+"SCRIPTABLE"{B}+{ID} | // scriptable property => not supported yet
-<QtPropType,QtPropAttr>{B}+"DESIGNABLE"{B}+{ID} | // designable property => not supported yet
-<QtPropType,QtPropAttr>{B}+"NOTIFY"{B}+{ID} | // notify property => not supported yet
-<QtPropType,QtPropAttr>{B}+"REVISION"{B}+{ID} | // revision property => not supported yet
-<QtPropType,QtPropAttr>{B}+"STORED"{B}+{ID} | // stored property => not supported yet
-<QtPropType,QtPropAttr>{B}+"USER"{B}+{ID} | // user property => not supported yet
-<QtPropType,QtPropAttr>{B}+"CONSTANT"{B} | // constant property => not supported yet
-<QtPropType,QtPropAttr>{B}+"FINAL"{B} { // final property => not supported yet
- BEGIN(QtPropAttr);
- }
-<QtPropRead>{ID} {
- yyextra->current->read = yytext;
- BEGIN(QtPropAttr);
- }
-<QtPropWrite>{ID} {
- yyextra->current->write = yytext;
- BEGIN(QtPropAttr);
- }
+<FindMembers>"Q_OBJECT" { // Qt object macro
+ }
+<FindMembers>"Q_PROPERTY" { // Qt property declaration
+ yyextra->current->protection = Public ; // see bug734245 & bug735462
+ yyextra->current->mtype = yyextra->mtype = Property;
+ yyextra->current->type.resize(0);
+ BEGIN(QtPropType);
+ }
+<QtPropType>"(" { // start of property arguments
+ }
+<QtPropAttr>")" { // end of property arguments
+ unput(';');
+ BEGIN(FindMembers);
+ }
+<QtPropType>{B}+ {
+ yyextra->current->name+=yytext;
+ }
+<QtPropType>"*" {
+ yyextra->current->type+= yyextra->current->name;
+ yyextra->current->type+= yytext;
+ yyextra->current->name="";
+ }
+<QtPropType>({TSCOPE}"::")*{TSCOPE} {
+ yyextra->current->type+= yyextra->current->name;
+ yyextra->current->name=yytext;
+ }
+<QtPropType,QtPropAttr>{B}+"READ"{B}+ {
+ yyextra->current->spec |= Entry::Readable;
+ BEGIN(QtPropRead);
+ }
+<QtPropType,QtPropAttr>{B}+"WRITE"{B}+ {
+ yyextra->current->spec |= Entry::Writable;
+ BEGIN(QtPropWrite);
+ }
+<QtPropType,QtPropAttr>{B}+"MEMBER"{B}+{ID} | // member property => not supported yet
+<QtPropType,QtPropAttr>{B}+"RESET"{B}+{ID} | // reset method => not supported yet
+<QtPropType,QtPropAttr>{B}+"SCRIPTABLE"{B}+{ID} | // scriptable property => not supported yet
+<QtPropType,QtPropAttr>{B}+"DESIGNABLE"{B}+{ID} | // designable property => not supported yet
+<QtPropType,QtPropAttr>{B}+"NOTIFY"{B}+{ID} | // notify property => not supported yet
+<QtPropType,QtPropAttr>{B}+"REVISION"{B}+{ID} | // revision property => not supported yet
+<QtPropType,QtPropAttr>{B}+"STORED"{B}+{ID} | // stored property => not supported yet
+<QtPropType,QtPropAttr>{B}+"USER"{B}+{ID} | // user property => not supported yet
+<QtPropType,QtPropAttr>{B}+"CONSTANT"{B} | // constant property => not supported yet
+<QtPropType,QtPropAttr>{B}+"FINAL"{B} { // final property => not supported yet
+ BEGIN(QtPropAttr);
+ }
+<QtPropRead>{ID} {
+ yyextra->current->read = yytext;
+ BEGIN(QtPropAttr);
+ }
+<QtPropWrite>{ID} {
+ yyextra->current->write = yytext;
+ BEGIN(QtPropAttr);
+ }
<FindMembers>"friend"{BN}+("class"|"union"|"struct"){BN}+ {
- yyextra->current->name=yytext;
- BEGIN(FindMembers);
- }
-<FindMembers,FindMemberName>{SCOPENAME} {
+ yyextra->current->name=yytext;
+ BEGIN(FindMembers);
+ }
+<FindMembers,FindMemberName>{SCOPENAME} {
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- yyextra->yyBegColNr=yyextra->yyColNr;
- yyextra->yyBegLineNr=yyextra->yyLineNr;
- lineCount(yyscanner);
+ yyextra->yyBegColNr=yyextra->yyColNr;
+ yyextra->yyBegLineNr=yyextra->yyLineNr;
+ lineCount(yyscanner);
if (yyextra->insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0)
- {
- BEGIN(CppQuote);
- }
- else if ((yyextra->insideIDL || yyextra->insideJava || yyextra->insideD) && yyleng==6 && qstrcmp(yytext,"import")==0)
- {
- if (yyextra->insideIDL)
- BEGIN(NextSemi);
- else // yyextra->insideJava or yyextra->insideD
- BEGIN(JavaImport);
- }
- else if (yyextra->insidePHP && qstrcmp(yytext,"use")==0)
- {
- BEGIN(PHPUse);
- }
- else if (yyextra->insideJava && qstrcmp(yytext,"package")==0)
- {
- lineCount(yyscanner);
- BEGIN(PackageName);
- }
- else if (yyextra->insideIDL && qstrcmp(yytext,"case")==0)
- {
- BEGIN(IDLUnionCase);
- }
- else if (yyextra->insideTryBlock && qstrcmp(yytext,"catch")==0)
- {
- yyextra->insideTryBlock=FALSE;
- BEGIN(TryFunctionBlock);
- }
+ {
+ BEGIN(CppQuote);
+ }
+ else if ((yyextra->insideIDL || yyextra->insideJava || yyextra->insideD) && yyleng==6 && qstrcmp(yytext,"import")==0)
+ {
+ if (yyextra->insideIDL)
+ BEGIN(NextSemi);
+ else // yyextra->insideJava or yyextra->insideD
+ BEGIN(JavaImport);
+ }
+ else if (yyextra->insidePHP && qstrcmp(yytext,"use")==0)
+ {
+ BEGIN(PHPUse);
+ }
+ else if (yyextra->insideJava && qstrcmp(yytext,"package")==0)
+ {
+ lineCount(yyscanner);
+ BEGIN(PackageName);
+ }
+ else if (yyextra->insideIDL && qstrcmp(yytext,"case")==0)
+ {
+ BEGIN(IDLUnionCase);
+ }
+ else if (yyextra->insideTryBlock && qstrcmp(yytext,"catch")==0)
+ {
+ yyextra->insideTryBlock=FALSE;
+ BEGIN(TryFunctionBlock);
+ }
else if (yyextra->insideCpp && qstrcmp(yytext,"alignas")==0)
{
yyextra->lastAlignAsContext = YY_START;
BEGIN(AlignAs);
}
- else if (yyextra->insideJS && qstrcmp(yytext,"var")==0)
- { // javascript variable
- yyextra->current->type="var";
- }
- else if (yyextra->insideJS && qstrcmp(yytext,"function")==0)
- { // javascript function
- yyextra->current->type="function";
- }
- else if (yyextra->insideCS && qstrcmp(yytext,"this")==0)
- {
- // C# indexer
- addType(yyscanner);
- yyextra->current->name="this";
- BEGIN(CSIndexer);
- }
+ else if (yyextra->insideJS && qstrcmp(yytext,"var")==0)
+ { // javascript variable
+ yyextra->current->type="var";
+ }
+ else if (yyextra->insideJS && qstrcmp(yytext,"function")==0)
+ { // javascript function
+ yyextra->current->type="function";
+ }
+ else if (yyextra->insideCS && qstrcmp(yytext,"this")==0)
+ {
+ // C# indexer
+ addType(yyscanner);
+ yyextra->current->name="this";
+ BEGIN(CSIndexer);
+ }
else if (yyextra->insideCpp && qstrcmp(yytext,"static_assert")==0)
{
// C++11 static_assert
@@ -2112,7 +2112,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
else if (yyextra->insideCpp && qstrcmp(yytext,"decltype")==0)
{
// C++11 decltype(x)
- yyextra->current->type+=yytext;
+ yyextra->current->type+=yytext;
BEGIN(DeclType);
}
else if (yyextra->insideSlice && qstrcmp(yytext,"optional")==0)
@@ -2128,88 +2128,88 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->lastModifierContext = YY_START;
BEGIN(SliceOptional);
}
- else
- {
- if (YY_START==FindMembers)
- {
- addType(yyscanner);
- }
- bool javaLike = yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS;
- if (javaLike && qstrcmp(yytext,"public")==0)
- {
- yyextra->current->protection = Public;
- }
- else if (javaLike && qstrcmp(yytext,"protected")==0)
- {
- yyextra->current->protection = Protected;
- }
- else if ((yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS) && qstrcmp(yytext,"internal")==0)
- {
- yyextra->current->protection = Package;
- }
- else if (javaLike && qstrcmp(yytext,"private")==0)
- {
- yyextra->current->protection = Private;
- }
- else if (javaLike && qstrcmp(yytext,"static")==0)
- {
- if (YY_START==FindMembers)
- yyextra->current->name = yytext;
- else
- yyextra->current->name += yytext;
- yyextra->current->stat = TRUE;
- }
- else
- {
- if (YY_START==FindMembers)
- yyextra->current->name = yytext;
- else
- yyextra->current->name += yytext;
- if (yyextra->current->name.left(7)=="static ")
- {
- yyextra->current->stat = TRUE;
- yyextra->current->name= yyextra->current->name.mid(7);
- }
- else if (yyextra->current->name.left(7)=="inline ")
- {
- if (yyextra->current->type.isEmpty())
- {
- yyextra->current->type="inline";
- }
- else
- {
- yyextra->current->type+="inline ";
- }
- yyextra->current->name= yyextra->current->name.mid(7);
- }
- else if (yyextra->current->name.left(6)=="const ")
- {
- if (yyextra->current->type.isEmpty())
- {
- yyextra->current->type="const";
- }
- else
- {
- yyextra->current->type+="const ";
- }
- yyextra->current->name=yyextra->current->name.mid(6);
- }
- }
- QCString tmp=yytext;
- if (nameIsOperator(tmp))
+ else
+ {
+ if (YY_START==FindMembers)
+ {
+ addType(yyscanner);
+ }
+ bool javaLike = yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS;
+ if (javaLike && qstrcmp(yytext,"public")==0)
+ {
+ yyextra->current->protection = Public;
+ }
+ else if (javaLike && qstrcmp(yytext,"protected")==0)
+ {
+ yyextra->current->protection = Protected;
+ }
+ else if ((yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS) && qstrcmp(yytext,"internal")==0)
+ {
+ yyextra->current->protection = Package;
+ }
+ else if (javaLike && qstrcmp(yytext,"private")==0)
+ {
+ yyextra->current->protection = Private;
+ }
+ else if (javaLike && qstrcmp(yytext,"static")==0)
{
- BEGIN( Operator );
+ if (YY_START==FindMembers)
+ yyextra->current->name = yytext;
+ else
+ yyextra->current->name += yytext;
+ yyextra->current->stat = TRUE;
}
- else
+ else
+ {
+ if (YY_START==FindMembers)
+ yyextra->current->name = yytext;
+ else
+ yyextra->current->name += yytext;
+ if (yyextra->current->name.left(7)=="static ")
+ {
+ yyextra->current->stat = TRUE;
+ yyextra->current->name= yyextra->current->name.mid(7);
+ }
+ else if (yyextra->current->name.left(7)=="inline ")
+ {
+ if (yyextra->current->type.isEmpty())
+ {
+ yyextra->current->type="inline";
+ }
+ else
+ {
+ yyextra->current->type+="inline ";
+ }
+ yyextra->current->name= yyextra->current->name.mid(7);
+ }
+ else if (yyextra->current->name.left(6)=="const ")
+ {
+ if (yyextra->current->type.isEmpty())
+ {
+ yyextra->current->type="const";
+ }
+ else
+ {
+ yyextra->current->type+="const ";
+ }
+ yyextra->current->name=yyextra->current->name.mid(6);
+ }
+ }
+ QCString tmp=yytext;
+ if (nameIsOperator(tmp))
+ {
+ BEGIN( Operator );
+ }
+ else
{
- yyextra->externC=FALSE; // see bug759247
- BEGIN(FindMembers);
+ yyextra->externC=FALSE; // see bug759247
+ BEGIN(FindMembers);
}
- }
- }
+ }
+ }
<StaticAssert>"(" {
- yyextra->lastSkipRoundContext = FindMembers;
- yyextra->roundCount=0;
+ yyextra->lastSkipRoundContext = FindMembers;
+ yyextra->roundCount=0;
BEGIN(SkipRound);
}
<StaticAssert>{BN}+ { lineCount(yyscanner); }
@@ -2218,10 +2218,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN(FindMembers);
}
<DeclType>"(" {
- yyextra->current->type+=yytext;
- yyextra->lastRoundContext=FindMembers;
- yyextra->pCopyRoundString=&yyextra->current->type;
- yyextra->roundCount=0;
+ yyextra->current->type+=yytext;
+ yyextra->lastRoundContext=FindMembers;
+ yyextra->pCopyRoundString=&yyextra->current->type;
+ yyextra->roundCount=0;
BEGIN(CopyRound);
}
<DeclType>{BN}+ { lineCount(yyscanner); }
@@ -2229,433 +2229,433 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
unput(*yytext);
BEGIN(FindMembers);
}
-<CSIndexer>"["[^\n\]]*"]" {
- yyextra->current->name+=removeRedundantWhiteSpace(yytext);
- BEGIN(FindMembers);
- }
-<FindMembers>[0-9]{ID} { // some number where we did not expect one
- }
-<FindMembers>"." {
- if (yyextra->insideJava || yyextra->insideCS || yyextra->insideD)
- {
- yyextra->current->name+=".";
- }
- }
-<FindMembers>"::" {
- yyextra->current->name+=yytext;
- }
-<CppQuote>"("{B}*"\"" {
- yyextra->insideCppQuote=TRUE;
- BEGIN(FindMembers);
- }
+<CSIndexer>"["[^\n\]]*"]" {
+ yyextra->current->name+=removeRedundantWhiteSpace(yytext);
+ BEGIN(FindMembers);
+ }
+<FindMembers>[0-9]{ID} { // some number where we did not expect one
+ }
+<FindMembers>"." {
+ if (yyextra->insideJava || yyextra->insideCS || yyextra->insideD)
+ {
+ yyextra->current->name+=".";
+ }
+ }
+<FindMembers>"::" {
+ yyextra->current->name+=yytext;
+ }
+<CppQuote>"("{B}*"\"" {
+ yyextra->insideCppQuote=TRUE;
+ BEGIN(FindMembers);
+ }
<IDLUnionCase>"::"
-<IDLUnionCase>":" { BEGIN(FindMembers); }
-<IDLUnionCase>\n { lineCount(yyscanner); }
+<IDLUnionCase>":" { BEGIN(FindMembers); }
+<IDLUnionCase>\n { lineCount(yyscanner); }
<IDLUnionCase>.
-<TryFunctionBlock>\n { lineCount(yyscanner); }
-<TryFunctionBlock>"{" {
- yyextra->curlyCount=0;
- yyextra->lastCurlyContext = TryFunctionBlockEnd ;
- BEGIN( SkipCurly );
- }
+<TryFunctionBlock>\n { lineCount(yyscanner); }
+<TryFunctionBlock>"{" {
+ yyextra->curlyCount=0;
+ yyextra->lastCurlyContext = TryFunctionBlockEnd ;
+ BEGIN( SkipCurly );
+ }
<TryFunctionBlock>.
-<TryFunctionBlockEnd>{BN}*"catch" { lineCount(yyscanner); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193
- }
-<TryFunctionBlockEnd>\n { unput(*yytext); // rule added to fix bug id 601138
- BEGIN( FindMembers );
- }
-<TryFunctionBlockEnd>. { unput(*yytext);
- BEGIN( FindMembers );
- }
-<EndCppQuote>")" {
- yyextra->insideCppQuote=FALSE;
- BEGIN(FindMembers);
- }
-<FindMembers,FindFields>{B}*"#" { if (yyextra->insidePHP)
- REJECT;
- yyextra->lastCPPContext = YY_START;
- BEGIN( SkipCPP ) ;
- }
-<FindMembers,FindFields>{B}*"#"{B}*("cmake")?"define" {
- if (yyextra->insidePHP)
- REJECT;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
+<TryFunctionBlockEnd>{BN}*"catch" { lineCount(yyscanner); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193
+ }
+<TryFunctionBlockEnd>\n { unput(*yytext); // rule added to fix bug id 601138
+ BEGIN( FindMembers );
+ }
+<TryFunctionBlockEnd>. { unput(*yytext);
+ BEGIN( FindMembers );
+ }
+<EndCppQuote>")" {
+ yyextra->insideCppQuote=FALSE;
+ BEGIN(FindMembers);
+ }
+<FindMembers,FindFields>{B}*"#" { if (yyextra->insidePHP)
+ REJECT;
+ yyextra->lastCPPContext = YY_START;
+ BEGIN( SkipCPP ) ;
+ }
+<FindMembers,FindFields>{B}*"#"{B}*("cmake")?"define" {
+ if (yyextra->insidePHP)
+ REJECT;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
yyextra->lastDefineContext = YY_START;
- BEGIN( Define );
- }
-<FindMembers,ReadBody,ReadNSBody,ReadBodyIntf,SkipCurly,SkipCurlyCpp>{B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */
+ BEGIN( Define );
+ }
+<FindMembers,ReadBody,ReadNSBody,ReadBodyIntf,SkipCurly,SkipCurlyCpp>{B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */
yyextra->yyLineNr = atoi(&yytext[1]);
- //printf("setting line number to %d\n",yyextra->yyLineNr);
- yyextra->lastPreLineCtrlContext = YY_START;
- if (YY_START==ReadBody ||
- YY_START==ReadNSBody ||
- YY_START==ReadBodyIntf)
- {
- yyextra->current->program+=yytext;
- }
- BEGIN( PreLineCtrl );
- }
-<PreLineCtrl>"\""[^\n\"]*"\"" {
- yyextra->yyFileName = stripQuotes(yytext);
- if (yyextra->lastPreLineCtrlContext==ReadBody ||
- yyextra->lastPreLineCtrlContext==ReadNSBody ||
- yyextra->lastPreLineCtrlContext==ReadBodyIntf)
- {
- yyextra->current->program+=yytext;
- }
- }
-<PreLineCtrl>. {
- if (yyextra->lastPreLineCtrlContext==ReadBody ||
- yyextra->lastPreLineCtrlContext==ReadNSBody ||
- yyextra->lastPreLineCtrlContext==ReadBodyIntf)
- {
- yyextra->current->program+=yytext;
- }
- }
-<PreLineCtrl>\n {
- if (yyextra->lastPreLineCtrlContext==ReadBody ||
- yyextra->lastPreLineCtrlContext==ReadNSBody ||
- yyextra->lastPreLineCtrlContext==ReadBodyIntf)
- {
- yyextra->current->program+=yytext;
- }
+ //printf("setting line number to %d\n",yyextra->yyLineNr);
+ yyextra->lastPreLineCtrlContext = YY_START;
+ if (YY_START==ReadBody ||
+ YY_START==ReadNSBody ||
+ YY_START==ReadBodyIntf)
+ {
+ yyextra->current->program+=yytext;
+ }
+ BEGIN( PreLineCtrl );
+ }
+<PreLineCtrl>"\""[^\n\"]*"\"" {
+ yyextra->yyFileName = stripQuotes(yytext);
+ if (yyextra->lastPreLineCtrlContext==ReadBody ||
+ yyextra->lastPreLineCtrlContext==ReadNSBody ||
+ yyextra->lastPreLineCtrlContext==ReadBodyIntf)
+ {
+ yyextra->current->program+=yytext;
+ }
+ }
+<PreLineCtrl>. {
+ if (yyextra->lastPreLineCtrlContext==ReadBody ||
+ yyextra->lastPreLineCtrlContext==ReadNSBody ||
+ yyextra->lastPreLineCtrlContext==ReadBodyIntf)
+ {
+ yyextra->current->program+=yytext;
+ }
+ }
+<PreLineCtrl>\n {
+ if (yyextra->lastPreLineCtrlContext==ReadBody ||
+ yyextra->lastPreLineCtrlContext==ReadNSBody ||
+ yyextra->lastPreLineCtrlContext==ReadBodyIntf)
+ {
+ yyextra->current->program+=yytext;
+ }
lineCount(yyscanner);
- BEGIN( yyextra->lastPreLineCtrlContext );
- }
+ BEGIN( yyextra->lastPreLineCtrlContext );
+ }
<SkipCPP>.
-<SkipCPP>\\[\r]*"\n"[\r]* { lineCount(yyscanner); }
-<SkipCPP>[\r]*\n[\r]* { lineCount(yyscanner);
- BEGIN( yyextra->lastCPPContext) ;
- }
-<Define>{ID}{B}*"(" {
- yyextra->current->name = yytext;
- yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
- yyextra->current->args = "(";
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->currentArgumentContext = DefineEnd;
- yyextra->fullArgString=yyextra->current->args.copy();
- yyextra->copyArgString=&yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- }
+<SkipCPP>\\[\r]*"\n"[\r]* { lineCount(yyscanner); }
+<SkipCPP>[\r]*\n[\r]* { lineCount(yyscanner);
+ BEGIN( yyextra->lastCPPContext) ;
+ }
+<Define>{ID}{B}*"(" {
+ yyextra->current->name = yytext;
+ yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
+ yyextra->current->args = "(";
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->currentArgumentContext = DefineEnd;
+ yyextra->fullArgString=yyextra->current->args.copy();
+ yyextra->copyArgString=&yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ }
/*
-<DefineArg>")" {
- //printf("Define with args\n");
- yyextra->current->args += ')';
- BEGIN( DefineEnd );
- }
-<DefineArg>. {
- yyextra->current->args += *yytext;
- }
+<DefineArg>")" {
+ //printf("Define with args\n");
+ yyextra->current->args += ')';
+ BEGIN( DefineEnd );
+ }
+<DefineArg>. {
+ yyextra->current->args += *yytext;
+ }
*/
-<Define>{ID} {
- //printf("Define '%s' without args\n",yytext);
+<Define>{ID} {
+ //printf("Define '%s' without args\n",yytext);
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->name = yytext;
- BEGIN(DefineEnd);
- }
-<DefineEnd>\n {
- //printf("End define: doc=%s docFile=%s docLine=%d\n",yyextra->current->doc.data(),yyextra->current->docFile.data(),yyextra->current->docLine);
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->type.resize(0);
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::DEFINE_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->name = yytext;
+ BEGIN(DefineEnd);
+ }
+<DefineEnd>\n {
+ //printf("End define: doc=%s docFile=%s docLine=%d\n",yyextra->current->doc.data(),yyextra->current->docFile.data(),yyextra->current->docLine);
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->type.resize(0);
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::DEFINE_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
lineCount(yyscanner);
- initEntry(yyscanner);
- BEGIN(yyextra->lastDefineContext);
- }
-<DefinePHPEnd>";" {
- //printf("End define\n");
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->type.resize(0);
+ initEntry(yyscanner);
+ BEGIN(yyextra->lastDefineContext);
+ }
+<DefinePHPEnd>";" {
+ //printf("End define\n");
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->type.resize(0);
yyextra->current->type = "const";
QCString init = yyextra->current->initializer.data();
- init = init.simplifyWhiteSpace();
- init = init.left(init.length()-1);
+ init = init.simplifyWhiteSpace();
+ init = init.left(init.length()-1);
yyextra->current->initializer = init;
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::VARIABLE_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN(FindMembers);
- }
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN(FindMembers);
+ }
<DefinePHPEnd>.
-<DefineEnd>\\[\r]?\n {
+<DefineEnd>\\[\r]?\n {
lineCount(yyscanner);
- }
-<DefineEnd>\" {
- if (yyextra->insideIDL && yyextra->insideCppQuote)
- {
- BEGIN(EndCppQuote);
- }
- else
- {
- yyextra->lastStringContext=DefineEnd;
- BEGIN(SkipString);
- }
- }
-<DefineEnd>.
-<DefinePHP>{ID}["']{BN}*","{BN}* {
- yyextra->current->name = yytext;
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
- yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1);
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->lastRoundContext = DefinePHPEnd;
- yyextra->pCopyRoundGString = &yyextra->current->initializer;
- yyextra->roundCount = 0;
- BEGIN( GCopyRound );
- }
-
-<FindMembers>[\^%] { // ^ and % are C++/CLI extensions
- if (yyextra->insideCli)
- {
- addType(yyscanner);
- yyextra->current->name = yytext ;
- }
- else
- {
- REJECT;
- }
- }
-<FindMembers>[*&]+ {
- yyextra->current->name += yytext ;
- addType(yyscanner);
- }
+ }
+<DefineEnd>\" {
+ if (yyextra->insideIDL && yyextra->insideCppQuote)
+ {
+ BEGIN(EndCppQuote);
+ }
+ else
+ {
+ yyextra->lastStringContext=DefineEnd;
+ BEGIN(SkipString);
+ }
+ }
+<DefineEnd>.
+<DefinePHP>{ID}["']{BN}*","{BN}* {
+ yyextra->current->name = yytext;
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
+ yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1);
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->lastRoundContext = DefinePHPEnd;
+ yyextra->pCopyRoundGString = &yyextra->current->initializer;
+ yyextra->roundCount = 0;
+ BEGIN( GCopyRound );
+ }
+
+<FindMembers>[\^%] { // ^ and % are C++/CLI extensions
+ if (yyextra->insideCli)
+ {
+ addType(yyscanner);
+ yyextra->current->name = yytext ;
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<FindMembers>[*&]+ {
+ yyextra->current->name += yytext ;
+ addType(yyscanner);
+ }
<FindMembers,MemberSpec,Function,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs,DefinePHPEnd>";"{BN}*("/**"|"//!"|"/*!"|"///")"<" {
- if (yyextra->current->bodyLine==-1)
- {
- yyextra->current->bodyLine=yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- }
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ if (yyextra->current->bodyLine==-1)
+ {
+ yyextra->current->bodyLine=yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ }
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
//printf("indent=%d\n",computeIndent(yytext+1,yyextra->column));
- lineCount(yyscanner);
+ lineCount(yyscanner);
- yyextra->docBlockTerm = ';';
+ yyextra->docBlockTerm = ';';
if (YY_START==EnumBaseType && yyextra->current->section==Entry::ENUM_SEC)
{
yyextra->current->bitfields = ":"+yyextra->current->args;
yyextra->current->args.resize(0);
yyextra->current->section=Entry::VARIABLE_SEC;
}
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
<MemberSpec,FindFields,FindMembers,NextSemi,EnumBaseType,BitFields,ReadInitializer,OldStyleArgs>","{BN}*("/**"|"//!"|"/*!"|"///")"<" {
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- lineCount(yyscanner);
+ lineCount(yyscanner);
- yyextra->docBlockTerm = ',';
+ yyextra->docBlockTerm = ',';
if (YY_START==EnumBaseType && yyextra->current->section==Entry::ENUM_SEC)
{
yyextra->current->bitfields = ":"+yyextra->current->args;
yyextra->current->args.resize(0);
yyextra->current->section=Entry::VARIABLE_SEC;
}
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
<DefineEnd,FindFields,FindFieldArg,ReadInitializer,OldStyleArgs>{BN}*("/**"|"//!"|"/*!"|"///")"<" {
- if (yyextra->current->bodyLine==-1)
- {
- yyextra->current->bodyLine=yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- }
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ if (yyextra->current->bodyLine==-1)
+ {
+ yyextra->current->bodyLine=yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ }
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- lineCount(yyscanner);
-
- yyextra->docBlockTerm = 0;
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
-
-<FindMembers,FindFields>("//"([!/]){B}*{CMD}"{")|("/*"([!*]){B}*{CMD}"{") {
- //handleGroupStartCommand(yyextra->current->name);
+ lineCount(yyscanner);
+
+ yyextra->docBlockTerm = 0;
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
+
+<FindMembers,FindFields>("//"([!/]){B}*{CMD}"{")|("/*"([!*]){B}*{CMD}"{") {
+ //handleGroupStartCommand(yyextra->current->name);
if (yyextra->previous && yyextra->previous->section==Entry::GROUPDOC_SEC)
- {
- // link open command to the group defined in the yyextra->previous entry
- yyextra->commentScanner.open(yyextra->previous.get(),yyextra->yyFileName,yyextra->yyLineNr);
- }
- else
- {
- // link open command to the yyextra->current entry
- yyextra->commentScanner.open(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr);
- }
- //yyextra->current = tmp;
- initEntry(yyscanner);
- if (yytext[1]=='/')
- {
- if (yytext[2]=='!' || yytext[2]=='/')
- {
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = FALSE;
- yyextra->docBlock.resize(0);
- yyextra->docBlockTerm = 0;
- startCommentBlock(yyscanner,TRUE);
- BEGIN(DocLine);
- }
- else
- {
- yyextra->lastCContext=YY_START;
- BEGIN(SkipCxxComment);
- }
- }
- else
- {
- if (yytext[2]=='!' || yytext[2]=='*')
- {
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlock.resize(0);
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
- yyextra->docBlockTerm = 0;
- startCommentBlock(yyscanner,FALSE);
- BEGIN(DocBlock);
- }
- else
- {
- yyextra->lastCContext=YY_START;
- BEGIN(SkipComment);
- }
- }
- }
-<FindMembers,FindFields,ReadInitializer>"//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" {
+ {
+ // link open command to the group defined in the yyextra->previous entry
+ yyextra->commentScanner.open(yyextra->previous.get(),yyextra->yyFileName,yyextra->yyLineNr);
+ }
+ else
+ {
+ // link open command to the yyextra->current entry
+ yyextra->commentScanner.open(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr);
+ }
+ //yyextra->current = tmp;
+ initEntry(yyscanner);
+ if (yytext[1]=='/')
+ {
+ if (yytext[2]=='!' || yytext[2]=='/')
+ {
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = FALSE;
+ yyextra->docBlock.resize(0);
+ yyextra->docBlockTerm = 0;
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN(DocLine);
+ }
+ else
+ {
+ yyextra->lastCContext=YY_START;
+ BEGIN(SkipCxxComment);
+ }
+ }
+ else
+ {
+ if (yytext[2]=='!' || yytext[2]=='*')
+ {
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlock.resize(0);
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ yyextra->docBlockTerm = 0;
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN(DocBlock);
+ }
+ else
+ {
+ yyextra->lastCContext=YY_START;
+ BEGIN(SkipComment);
+ }
+ }
+ }
+<FindMembers,FindFields,ReadInitializer>"//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" {
bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && yyextra->lastInitializerContext==FindFields); // see bug746226
- yyextra->commentScanner.close(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr,insideEnum);
- lineCount(yyscanner);
- }
-<FindMembers>"=" { // in PHP code this could also be due to "<?="
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->commentScanner.close(yyextra->current.get(),yyextra->yyFileName,yyextra->yyLineNr,insideEnum);
+ lineCount(yyscanner);
+ }
+<FindMembers>"=" { // in PHP code this could also be due to "<?="
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
yyextra->current->initializer = yytext;
- yyextra->lastInitializerContext = YY_START;
- yyextra->initBracketCount=0;
- BEGIN(ReadInitializer);
- }
-<UNOIDLAttributeBlock>{BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" {
- lineCount(yyscanner);
- yyextra->current->exception += " ";
- yyextra->current->exception += removeRedundantWhiteSpace(yytext);
- }
-<UNOIDLAttributeBlock>"}" {
- yyextra->current->exception += " }";
- BEGIN(FindMembers);
- }
+ yyextra->lastInitializerContext = YY_START;
+ yyextra->initBracketCount=0;
+ BEGIN(ReadInitializer);
+ }
+<UNOIDLAttributeBlock>{BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" {
+ lineCount(yyscanner);
+ yyextra->current->exception += " ";
+ yyextra->current->exception += removeRedundantWhiteSpace(yytext);
+ }
+<UNOIDLAttributeBlock>"}" {
+ yyextra->current->exception += " }";
+ BEGIN(FindMembers);
+ }
/* Read initializer rules */
-<ReadInitializer>"(" {
- yyextra->lastRoundContext=YY_START;
- yyextra->pCopyRoundGString=&yyextra->current->initializer;
- yyextra->roundCount=0;
- yyextra->current->initializer+=*yytext;
- BEGIN(GCopyRound);
- }
+<ReadInitializer>"(" {
+ yyextra->lastRoundContext=YY_START;
+ yyextra->pCopyRoundGString=&yyextra->current->initializer;
+ yyextra->roundCount=0;
+ yyextra->current->initializer+=*yytext;
+ BEGIN(GCopyRound);
+ }
<ReadInitializer>"[" {
if (!yyextra->insidePHP) REJECT;
yyextra->lastSquareContext=YY_START;
yyextra->pCopySquareGString=&yyextra->current->initializer;
yyextra->squareCount=0;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer+=*yytext;
BEGIN(GCopySquare);
}
-<ReadInitializer>"{" {
- yyextra->lastCurlyContext=YY_START;
- yyextra->pCopyCurlyGString=&yyextra->current->initializer;
- yyextra->curlyCount=0;
- yyextra->current->initializer+=*yytext;
- BEGIN(GCopyCurly);
- }
-<ReadInitializer>[;,] {
- //printf(">> initializer '%s' <<\n",yyextra->current->initializer.data());
+<ReadInitializer>"{" {
+ yyextra->lastCurlyContext=YY_START;
+ yyextra->pCopyCurlyGString=&yyextra->current->initializer;
+ yyextra->curlyCount=0;
+ yyextra->current->initializer+=*yytext;
+ BEGIN(GCopyCurly);
+ }
+<ReadInitializer>[;,] {
+ //printf(">> initializer '%s' <<\n",yyextra->current->initializer.data());
if (*yytext==';' && (yyextra->current_root->spec&Entry::Enum))
- {
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::VARIABLE_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN(FindMembers);
- }
- else if (*yytext==';' || (yyextra->lastInitializerContext==FindFields && yyextra->initBracketCount==0)) // yyextra->initBracketCount==0 was added for bug 665778
- {
- unput(*yytext);
- BEGIN(yyextra->lastInitializerContext);
- }
- else if (*yytext==',' && yyextra->initBracketCount==0) // for "int a=0,b=0"
- {
- unput(*yytext);
- BEGIN(yyextra->lastInitializerContext);
- }
- else
- {
- yyextra->current->initializer+=*yytext;
- }
- }
+ {
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN(FindMembers);
+ }
+ else if (*yytext==';' || (yyextra->lastInitializerContext==FindFields && yyextra->initBracketCount==0)) // yyextra->initBracketCount==0 was added for bug 665778
+ {
+ unput(*yytext);
+ BEGIN(yyextra->lastInitializerContext);
+ }
+ else if (*yytext==',' && yyextra->initBracketCount==0) // for "int a=0,b=0"
+ {
+ unput(*yytext);
+ BEGIN(yyextra->lastInitializerContext);
+ }
+ else
+ {
+ yyextra->current->initializer+=*yytext;
+ }
+ }
<ReadInitializer>{RAWBEGIN} { // C++11 raw string
if (!yyextra->insideCpp)
- {
+ {
REJECT;
}
else
@@ -2692,7 +2692,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
<RawString>{RAWEND} {
*yyextra->pCopyRawString+=yytext;
- yyextra->fullArgString+=yytext;
+ yyextra->fullArgString+=yytext;
QCString delimiter = yytext+1;
delimiter=delimiter.left(delimiter.length()-1);
if (delimiter==yyextra->delimiter)
@@ -2702,265 +2702,265 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
<RawString>[^)]+ {
*yyextra->pCopyRawString+=yytext;
- yyextra->fullArgString+=yytext;
+ yyextra->fullArgString+=yytext;
}
<RawString>. {
*yyextra->pCopyRawString+=yytext;
- yyextra->fullArgString+=yytext;
+ yyextra->fullArgString+=yytext;
}
<RawString>\n {
*yyextra->pCopyRawString+=yytext;
- yyextra->fullArgString+=yytext;
+ yyextra->fullArgString+=yytext;
lineCount(yyscanner);
}
-<ReadInitializer>\" {
- if (yyextra->insideIDL && yyextra->insideCppQuote)
- {
- BEGIN(EndCppQuote);
- }
- else
- {
+<ReadInitializer>\" {
+ if (yyextra->insideIDL && yyextra->insideCppQuote)
+ {
+ BEGIN(EndCppQuote);
+ }
+ else
+ {
yyextra->lastStringContext=YY_START;
- yyextra->current->initializer+=yytext;
- yyextra->pCopyQuotedGString=&yyextra->current->initializer;
- BEGIN(CopyGString);
- }
- }
-<ReadInitializer>"->" {
- yyextra->current->initializer+=yytext;
- }
-<ReadInitializer>"<<" {
- yyextra->current->initializer+=yytext;
- }
-<ReadInitializer>">>" {
- yyextra->current->initializer+=yytext;
- }
-<ReadInitializer>[<\[{(] {
- yyextra->initBracketCount++;
- yyextra->current->initializer+=*yytext;
- }
-<ReadInitializer>[>\]})] {
- yyextra->initBracketCount--;
- yyextra->current->initializer+=*yytext;
- }
-<ReadInitializer>\' {
- if (yyextra->insidePHP)
- {
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer+=yytext;
+ yyextra->pCopyQuotedGString=&yyextra->current->initializer;
+ BEGIN(CopyGString);
+ }
+ }
+<ReadInitializer>"->" {
+ yyextra->current->initializer+=yytext;
+ }
+<ReadInitializer>"<<" {
+ yyextra->current->initializer+=yytext;
+ }
+<ReadInitializer>">>" {
+ yyextra->current->initializer+=yytext;
+ }
+<ReadInitializer>[<\[{(] {
+ yyextra->initBracketCount++;
+ yyextra->current->initializer+=*yytext;
+ }
+<ReadInitializer>[>\]})] {
+ yyextra->initBracketCount--;
+ yyextra->current->initializer+=*yytext;
+ }
+<ReadInitializer>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->current->initializer+=yytext;
yyextra->pCopyQuotedGString = &yyextra->current->initializer;
yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPGString);
- }
- else
- {
- yyextra->current->initializer+=yytext;
- }
- }
-<ReadInitializer>{CHARLIT} {
- if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- yyextra->current->initializer+=yytext;
- }
- }
-<ReadInitializer>\n {
- yyextra->current->initializer+=*yytext;
+ BEGIN(CopyPHPGString);
+ }
+ else
+ {
+ yyextra->current->initializer+=yytext;
+ }
+ }
+<ReadInitializer>{CHARLIT} {
+ if (yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ yyextra->current->initializer+=yytext;
+ }
+ }
+<ReadInitializer>\n {
+ yyextra->current->initializer+=*yytext;
lineCount(yyscanner);
- }
-<ReadInitializer>"@\"" {
- //printf("yyextra->insideCS=%d\n",yyextra->insideCS);
- yyextra->current->initializer+=yytext;
- if (!yyextra->insideCS && !yyextra->insideObjC)
- {
- REJECT;
- }
- else
- {
- // C#/ObjC verbatim string
- yyextra->lastSkipVerbStringContext=YY_START;
- yyextra->pSkipVerbString=&yyextra->current->initializer;
- BEGIN(SkipVerbString);
- }
- }
-<SkipVerbString>[^\n"]+ {
- *yyextra->pSkipVerbString+=yytext;
- }
-<SkipVerbString>"\"\"" { // quote escape
- *yyextra->pSkipVerbString+=yytext;
- }
-<SkipVerbString>"\"" {
- *yyextra->pSkipVerbString+=*yytext;
- BEGIN(yyextra->lastSkipVerbStringContext);
- }
-<SkipVerbString>\n {
- *yyextra->pSkipVerbString+=*yytext;
+ }
+<ReadInitializer>"@\"" {
+ //printf("yyextra->insideCS=%d\n",yyextra->insideCS);
+ yyextra->current->initializer+=yytext;
+ if (!yyextra->insideCS && !yyextra->insideObjC)
+ {
+ REJECT;
+ }
+ else
+ {
+ // C#/ObjC verbatim string
+ yyextra->lastSkipVerbStringContext=YY_START;
+ yyextra->pSkipVerbString=&yyextra->current->initializer;
+ BEGIN(SkipVerbString);
+ }
+ }
+<SkipVerbString>[^\n"]+ {
+ *yyextra->pSkipVerbString+=yytext;
+ }
+<SkipVerbString>"\"\"" { // quote escape
+ *yyextra->pSkipVerbString+=yytext;
+ }
+<SkipVerbString>"\"" {
+ *yyextra->pSkipVerbString+=*yytext;
+ BEGIN(yyextra->lastSkipVerbStringContext);
+ }
+<SkipVerbString>\n {
+ *yyextra->pSkipVerbString+=*yytext;
lineCount(yyscanner);
- }
-<SkipVerbString>. {
- *yyextra->pSkipVerbString+=*yytext;
- }
-<ReadInitializer>"?>" {
- if (yyextra->insidePHP)
- BEGIN( FindMembersPHP );
- else
- yyextra->current->initializer+=yytext;
- }
-<ReadInitializer>. {
- yyextra->current->initializer+=*yytext;
- }
+ }
+<SkipVerbString>. {
+ *yyextra->pSkipVerbString+=*yytext;
+ }
+<ReadInitializer>"?>" {
+ if (yyextra->insidePHP)
+ BEGIN( FindMembersPHP );
+ else
+ yyextra->current->initializer+=yytext;
+ }
+<ReadInitializer>. {
+ yyextra->current->initializer+=*yytext;
+ }
/* generic quoted string copy rules */
-<CopyString,CopyPHPString>\\. {
- *yyextra->pCopyQuotedString+=yytext;
- }
-<CopyString>\" {
- *yyextra->pCopyQuotedString+=*yytext;
- BEGIN( yyextra->lastStringContext );
- }
-<CopyPHPString>\' {
- *yyextra->pCopyQuotedString+=*yytext;
- BEGIN( yyextra->lastStringContext );
- }
+<CopyString,CopyPHPString>\\. {
+ *yyextra->pCopyQuotedString+=yytext;
+ }
+<CopyString>\" {
+ *yyextra->pCopyQuotedString+=*yytext;
+ BEGIN( yyextra->lastStringContext );
+ }
+<CopyPHPString>\' {
+ *yyextra->pCopyQuotedString+=*yytext;
+ BEGIN( yyextra->lastStringContext );
+ }
<CopyString,CopyPHPString>"/*"|"*/"|"//" {
- *yyextra->pCopyQuotedString+=yytext;
- }
-<CopyString,CopyPHPString>\n {
- *yyextra->pCopyQuotedString+=*yytext;
+ *yyextra->pCopyQuotedString+=yytext;
+ }
+<CopyString,CopyPHPString>\n {
+ *yyextra->pCopyQuotedString+=*yytext;
lineCount(yyscanner);
- }
-<CopyString,CopyPHPString>. {
- *yyextra->pCopyQuotedString+=*yytext;
- }
+ }
+<CopyString,CopyPHPString>. {
+ *yyextra->pCopyQuotedString+=*yytext;
+ }
/* generic quoted growable string copy rules */
-<CopyGString,CopyPHPGString>\\. {
- *yyextra->pCopyQuotedGString+=yytext;
- }
-<CopyGString>\" {
- *yyextra->pCopyQuotedGString+=*yytext;
- BEGIN( yyextra->lastStringContext );
- }
-<CopyPHPGString>\' {
- *yyextra->pCopyQuotedGString+=*yytext;
- BEGIN( yyextra->lastStringContext );
- }
-<CopyGString,CopyPHPGString>"<?php" { // we had an odd number of quotes.
- *yyextra->pCopyQuotedGString += yytext;
- BEGIN( yyextra->lastStringContext );
- }
+<CopyGString,CopyPHPGString>\\. {
+ *yyextra->pCopyQuotedGString+=yytext;
+ }
+<CopyGString>\" {
+ *yyextra->pCopyQuotedGString+=*yytext;
+ BEGIN( yyextra->lastStringContext );
+ }
+<CopyPHPGString>\' {
+ *yyextra->pCopyQuotedGString+=*yytext;
+ BEGIN( yyextra->lastStringContext );
+ }
+<CopyGString,CopyPHPGString>"<?php" { // we had an odd number of quotes.
+ *yyextra->pCopyQuotedGString += yytext;
+ BEGIN( yyextra->lastStringContext );
+ }
<CopyGString,CopyPHPGString>"/*"|"*/"|"//" {
- *yyextra->pCopyQuotedGString+=yytext;
- }
-<CopyGString,CopyPHPGString>\n {
- *yyextra->pCopyQuotedGString+=*yytext;
+ *yyextra->pCopyQuotedGString+=yytext;
+ }
+<CopyGString,CopyPHPGString>\n {
+ *yyextra->pCopyQuotedGString+=*yytext;
lineCount(yyscanner);
- }
-<CopyGString,CopyPHPGString>. {
- *yyextra->pCopyQuotedGString+=*yytext;
- }
+ }
+<CopyGString,CopyPHPGString>. {
+ *yyextra->pCopyQuotedGString+=*yytext;
+ }
/* generic round bracket list copy rules */
-<CopyRound>\" {
- *yyextra->pCopyRoundString+=*yytext;
- yyextra->pCopyQuotedString=yyextra->pCopyRoundString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyString);
- }
-<CopyRound>"(" {
- *yyextra->pCopyRoundString+=*yytext;
- yyextra->roundCount++;
- }
-<CopyRound>")" {
- *yyextra->pCopyRoundString+=*yytext;
- if (--yyextra->roundCount<0)
- BEGIN(yyextra->lastRoundContext);
- }
-<CopyRound>\n {
+<CopyRound>\" {
+ *yyextra->pCopyRoundString+=*yytext;
+ yyextra->pCopyQuotedString=yyextra->pCopyRoundString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyString);
+ }
+<CopyRound>"(" {
+ *yyextra->pCopyRoundString+=*yytext;
+ yyextra->roundCount++;
+ }
+<CopyRound>")" {
+ *yyextra->pCopyRoundString+=*yytext;
+ if (--yyextra->roundCount<0)
+ BEGIN(yyextra->lastRoundContext);
+ }
+<CopyRound>\n {
lineCount(yyscanner);
- *yyextra->pCopyRoundString+=*yytext;
- }
-<CopyRound>\' {
- if (yyextra->insidePHP)
- {
- yyextra->current->initializer+=yytext;
+ *yyextra->pCopyRoundString+=*yytext;
+ }
+<CopyRound>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->current->initializer+=yytext;
yyextra->pCopyQuotedString = yyextra->pCopyRoundString;
yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPString);
- }
- else
- {
- *yyextra->pCopyRoundString+=yytext;
- }
- }
-<CopyRound>{CHARLIT} {
+ BEGIN(CopyPHPString);
+ }
+ else
+ {
+ *yyextra->pCopyRoundString+=yytext;
+ }
+ }
+<CopyRound>{CHARLIT} {
if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- *yyextra->pCopyRoundString+=yytext;
- }
- }
-<CopyRound>[^"'()\n,]+ {
- *yyextra->pCopyRoundString+=yytext;
- }
-<CopyRound>. {
- *yyextra->pCopyRoundString+=*yytext;
- }
+ {
+ REJECT;
+ }
+ else
+ {
+ *yyextra->pCopyRoundString+=yytext;
+ }
+ }
+<CopyRound>[^"'()\n,]+ {
+ *yyextra->pCopyRoundString+=yytext;
+ }
+<CopyRound>. {
+ *yyextra->pCopyRoundString+=*yytext;
+ }
/* generic round bracket list copy rules for growable strings */
-<GCopyRound>\" {
- *yyextra->pCopyRoundGString+=*yytext;
- yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyGString);
- }
-<GCopyRound>"(" {
- *yyextra->pCopyRoundGString+=*yytext;
- yyextra->roundCount++;
- }
-<GCopyRound>")" {
- *yyextra->pCopyRoundGString+=*yytext;
- if (--yyextra->roundCount<0)
- BEGIN(yyextra->lastRoundContext);
- }
-<GCopyRound>\n {
+<GCopyRound>\" {
+ *yyextra->pCopyRoundGString+=*yytext;
+ yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyGString);
+ }
+<GCopyRound>"(" {
+ *yyextra->pCopyRoundGString+=*yytext;
+ yyextra->roundCount++;
+ }
+<GCopyRound>")" {
+ *yyextra->pCopyRoundGString+=*yytext;
+ if (--yyextra->roundCount<0)
+ BEGIN(yyextra->lastRoundContext);
+ }
+<GCopyRound>\n {
lineCount(yyscanner);
- *yyextra->pCopyRoundGString+=*yytext;
- }
-<GCopyRound>\' {
- if (yyextra->insidePHP)
- {
- yyextra->current->initializer+=yytext;
+ *yyextra->pCopyRoundGString+=*yytext;
+ }
+<GCopyRound>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->current->initializer+=yytext;
yyextra->pCopyQuotedGString = yyextra->pCopyRoundGString;
yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPGString);
- }
- else
- {
- *yyextra->pCopyRoundGString+=yytext;
- }
- }
-<GCopyRound>{CHARLIT} {
+ BEGIN(CopyPHPGString);
+ }
+ else
+ {
+ *yyextra->pCopyRoundGString+=yytext;
+ }
+ }
+<GCopyRound>{CHARLIT} {
if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- *yyextra->pCopyRoundGString+=yytext;
- }
- }
-<GCopyRound>[^"'()\n\/,]+ {
- *yyextra->pCopyRoundGString+=yytext;
- }
-<GCopyRound>. {
- *yyextra->pCopyRoundGString+=*yytext;
- }
+ {
+ REJECT;
+ }
+ else
+ {
+ *yyextra->pCopyRoundGString+=yytext;
+ }
+ }
+<GCopyRound>[^"'()\n\/,]+ {
+ *yyextra->pCopyRoundGString+=yytext;
+ }
+<GCopyRound>. {
+ *yyextra->pCopyRoundGString+=*yytext;
+ }
/* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */
<GCopySquare>\" {
@@ -2985,7 +2985,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
<GCopySquare>\' {
if (yyextra->insidePHP)
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer+=yytext;
yyextra->pCopyQuotedGString = yyextra->pCopySquareGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPGString);
@@ -2995,14 +2995,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*yyextra->pCopySquareGString+=yytext;
}
}
-<GCopySquare>{CHARLIT} {
+<GCopySquare>{CHARLIT} {
if (yyextra->insidePHP)
{
REJECT;
}
else
{
- *yyextra->pCopySquareGString+=yytext;
+ *yyextra->pCopySquareGString+=yytext;
}
}
<GCopySquare>[^"\[\]\n\/,]+ {
@@ -3013,230 +3013,230 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
/* generic curly bracket list copy rules */
-<CopyCurly>\" {
- *yyextra->pCopyCurlyString+=*yytext;
- yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyString);
- }
-<CopyCurly>\' {
- *yyextra->pCopyCurlyString+=*yytext;
- if (yyextra->insidePHP)
- {
- yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPString);
- }
- }
-<CopyCurly>"{" {
- *yyextra->pCopyCurlyString+=*yytext;
- yyextra->curlyCount++;
- }
-<CopyCurly>"}" {
- *yyextra->pCopyCurlyString+=*yytext;
- if (--yyextra->curlyCount<0)
- BEGIN(yyextra->lastCurlyContext);
- }
-<CopyCurly>{CHARLIT} { if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- *yyextra->pCopyCurlyString+=yytext;
- }
- }
-<CopyCurly>[^"'{}\/\n,]+ {
- *yyextra->pCopyCurlyString+=yytext;
- }
-<CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; }
-<CopyCurly>\n {
+<CopyCurly>\" {
+ *yyextra->pCopyCurlyString+=*yytext;
+ yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyString);
+ }
+<CopyCurly>\' {
+ *yyextra->pCopyCurlyString+=*yytext;
+ if (yyextra->insidePHP)
+ {
+ yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyPHPString);
+ }
+ }
+<CopyCurly>"{" {
+ *yyextra->pCopyCurlyString+=*yytext;
+ yyextra->curlyCount++;
+ }
+<CopyCurly>"}" {
+ *yyextra->pCopyCurlyString+=*yytext;
+ if (--yyextra->curlyCount<0)
+ BEGIN(yyextra->lastCurlyContext);
+ }
+<CopyCurly>{CHARLIT} { if (yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ *yyextra->pCopyCurlyString+=yytext;
+ }
+ }
+<CopyCurly>[^"'{}\/\n,]+ {
+ *yyextra->pCopyCurlyString+=yytext;
+ }
+<CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; }
+<CopyCurly>\n {
lineCount(yyscanner);
- *yyextra->pCopyCurlyString+=*yytext;
- }
-<CopyCurly>. {
- *yyextra->pCopyCurlyString+=*yytext;
- }
+ *yyextra->pCopyCurlyString+=*yytext;
+ }
+<CopyCurly>. {
+ *yyextra->pCopyCurlyString+=*yytext;
+ }
/* generic curly bracket list copy rules for growable strings */
<GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"1"{B}*\n? { // start of included file marker
}
<GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"2"{B}*\n? { // end of included file marker
- QCString line = QCString(yytext);
- int s = line.find(' ');
- int e = line.find('"',s);
- yyextra->yyLineNr = line.mid(s,e-s).toInt();
- if (yytext[yyleng-1]=='\n')
- {
+ QCString line = QCString(yytext);
+ int s = line.find(' ');
+ int e = line.find('"',s);
+ yyextra->yyLineNr = line.mid(s,e-s).toInt();
+ if (yytext[yyleng-1]=='\n')
+ {
lineCount(yyscanner);
yyextra->column=0;
- }
- }
-<GCopyCurly>\" {
- *yyextra->pCopyCurlyGString+=*yytext;
- yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyGString);
- }
-<GCopyCurly>\' {
- *yyextra->pCopyCurlyGString+=*yytext;
- if (yyextra->insidePHP)
- {
- yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
- yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPGString);
- }
- }
-<GCopyCurly>"{" {
- *yyextra->pCopyCurlyGString+=*yytext;
- yyextra->curlyCount++;
- }
-<GCopyCurly>"}" {
- *yyextra->pCopyCurlyGString+=*yytext;
- if (--yyextra->curlyCount<0)
- BEGIN(yyextra->lastCurlyContext);
- }
-<GCopyCurly>{CHARLIT} { if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- *yyextra->pCopyCurlyGString+=yytext;
- }
- }
-<GCopyCurly>[^"'{}\/\n,]+ {
- *yyextra->pCopyCurlyGString+=yytext;
- }
-<GCopyCurly>[,]+ {
- *yyextra->pCopyCurlyGString+=yytext;
- }
-<GCopyCurly>"/" { *yyextra->pCopyCurlyGString+=yytext; }
-<GCopyCurly>\n {
+ }
+ }
+<GCopyCurly>\" {
+ *yyextra->pCopyCurlyGString+=*yytext;
+ yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyGString);
+ }
+<GCopyCurly>\' {
+ *yyextra->pCopyCurlyGString+=*yytext;
+ if (yyextra->insidePHP)
+ {
+ yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
+ yyextra->lastStringContext=YY_START;
+ BEGIN(CopyPHPGString);
+ }
+ }
+<GCopyCurly>"{" {
+ *yyextra->pCopyCurlyGString+=*yytext;
+ yyextra->curlyCount++;
+ }
+<GCopyCurly>"}" {
+ *yyextra->pCopyCurlyGString+=*yytext;
+ if (--yyextra->curlyCount<0)
+ BEGIN(yyextra->lastCurlyContext);
+ }
+<GCopyCurly>{CHARLIT} { if (yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ *yyextra->pCopyCurlyGString+=yytext;
+ }
+ }
+<GCopyCurly>[^"'{}\/\n,]+ {
+ *yyextra->pCopyCurlyGString+=yytext;
+ }
+<GCopyCurly>[,]+ {
+ *yyextra->pCopyCurlyGString+=yytext;
+ }
+<GCopyCurly>"/" { *yyextra->pCopyCurlyGString+=yytext; }
+<GCopyCurly>\n {
lineCount(yyscanner);
- *yyextra->pCopyCurlyGString+=*yytext;
- }
-<GCopyCurly>. {
- *yyextra->pCopyCurlyGString+=*yytext;
- }
+ *yyextra->pCopyCurlyGString+=*yytext;
+ }
+<GCopyCurly>. {
+ *yyextra->pCopyCurlyGString+=*yytext;
+ }
/* ---------------------- */
-<FindMembers>":" {
- if (yyextra->current->type.isEmpty() &&
+<FindMembers>":" {
+ if (yyextra->current->type.isEmpty() &&
yyextra->current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}'
- {
+ {
yyextra->current->section=Entry::ENUM_SEC;
- yyextra->current->name.resize(0);
+ yyextra->current->name.resize(0);
yyextra->current->args.resize(0);
- BEGIN(EnumBaseType);
- }
- else
+ BEGIN(EnumBaseType);
+ }
+ else
{
if (yyextra->current->type.isEmpty()) // anonymous padding field, e.g. "int :7;"
- {
- addType(yyscanner);
- yyextra->current->name.sprintf("__pad%d__",yyextra->padCount++);
- }
- BEGIN(BitFields);
- yyextra->current->bitfields+=":";
- }
- }
-<BitFields>. {
- yyextra->current->bitfields+=*yytext;
- }
-<EnumBaseType>. {
- yyextra->current->args+=*yytext;
- }
-<EnumBaseType>\n {
+ {
+ addType(yyscanner);
+ yyextra->current->name.sprintf("__pad%d__",yyextra->padCount++);
+ }
+ BEGIN(BitFields);
+ yyextra->current->bitfields+=":";
+ }
+ }
+<BitFields>. {
+ yyextra->current->bitfields+=*yytext;
+ }
+<EnumBaseType>. {
+ yyextra->current->args+=*yytext;
+ }
+<EnumBaseType>\n {
lineCount(yyscanner);
- yyextra->current->args+=' ';
- }
-<FindMembers>[;,] {
- QCString oldType = yyextra->current->type;
- if (yyextra->current->bodyLine==-1)
- {
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- }
+ yyextra->current->args+=' ';
+ }
+<FindMembers>[;,] {
+ QCString oldType = yyextra->current->type;
+ if (yyextra->current->bodyLine==-1)
+ {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ }
if ( yyextra->insidePHP && yyextra->current->type.left(3) == "var" )
{
yyextra->current->type = yyextra->current->type.mid(3);
}
- if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
- {
- yyextra->current->type.prepend("typedef ");
- }
- bool stat = yyextra->current->stat;
- if (!yyextra->current->name.isEmpty() && yyextra->current->section!=Entry::ENUM_SEC)
- {
- yyextra->current->type=yyextra->current->type.simplifyWhiteSpace();
- yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
- yyextra->current->name=yyextra->current->name.stripWhiteSpace();
- if (yyextra->current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;"
- {
- yyextra->current->spec = 0;
- }
- yyextra->current->section = Entry::VARIABLE_SEC ;
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyBegLineNr;
- yyextra->current->startColumn = yyextra->yyBegColNr;
- yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
+ if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
+ {
+ yyextra->current->type.prepend("typedef ");
+ }
+ bool stat = yyextra->current->stat;
+ if (!yyextra->current->name.isEmpty() && yyextra->current->section!=Entry::ENUM_SEC)
+ {
+ yyextra->current->type=yyextra->current->type.simplifyWhiteSpace();
+ yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
+ yyextra->current->name=yyextra->current->name.stripWhiteSpace();
+ if (yyextra->current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;"
+ {
+ yyextra->current->spec = 0;
+ }
+ yyextra->current->section = Entry::VARIABLE_SEC ;
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyBegLineNr;
+ yyextra->current->startColumn = yyextra->yyBegColNr;
+ yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
initEntry(yyscanner);
- }
- if ( *yytext == ',')
- {
- yyextra->current->stat = stat; // the static attribute holds for all variables
- yyextra->current->name.resize(0);
- yyextra->current->args.resize(0);
- yyextra->current->brief.resize(0);
- yyextra->current->doc.resize(0);
- yyextra->current->initializer.resize(0);
- yyextra->current->bitfields.resize(0);
- int i=oldType.length();
- while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--;
- yyextra->current->type = oldType.left(i);
- }
- else
- {
+ }
+ if ( *yytext == ',')
+ {
+ yyextra->current->stat = stat; // the static attribute holds for all variables
+ yyextra->current->name.resize(0);
+ yyextra->current->args.resize(0);
+ yyextra->current->brief.resize(0);
+ yyextra->current->doc.resize(0);
+ yyextra->current->initializer.resize(0);
+ yyextra->current->bitfields.resize(0);
+ int i=oldType.length();
+ while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--;
+ yyextra->current->type = oldType.left(i);
+ }
+ else
+ {
yyextra->mtype = Method;
yyextra->virt = Normal;
- yyextra->current->groups.clear();
- initEntry(yyscanner);
- }
- }
+ yyextra->current->groups.clear();
+ initEntry(yyscanner);
+ }
+ }
-<FindMembers>"[" {
+<FindMembers>"[" {
if (yyextra->insideSlice)
{
- yyextra->squareCount=1;
+ yyextra->squareCount=1;
yyextra->lastSquareContext = YY_START;
yyextra->current->metaData += "[";
BEGIN( SliceMetadata );
}
- else if (!yyextra->insideCS &&
- (yyextra->current->name.isEmpty() ||
- yyextra->current->name=="typedef"
- )
- ) // IDL function property
- {
- yyextra->squareCount=1;
- yyextra->lastSquareContext = YY_START;
- yyextra->idlAttr.resize(0);
- yyextra->idlProp.resize(0);
- yyextra->current->mtype = yyextra->mtype;
-
- if (Config_getBool(IDL_PROPERTY_SUPPORT) &&
- yyextra->current->mtype == Property)
- { // we are yyextra->inside the properties section of a dispinterface
- yyextra->odlProp = true;
- yyextra->current->spec |= Entry::Gettable;
- yyextra->current->spec |= Entry::Settable;
- }
-
- BEGIN( IDLAttribute );
- }
+ else if (!yyextra->insideCS &&
+ (yyextra->current->name.isEmpty() ||
+ yyextra->current->name=="typedef"
+ )
+ ) // IDL function property
+ {
+ yyextra->squareCount=1;
+ yyextra->lastSquareContext = YY_START;
+ yyextra->idlAttr.resize(0);
+ yyextra->idlProp.resize(0);
+ yyextra->current->mtype = yyextra->mtype;
+
+ if (Config_getBool(IDL_PROPERTY_SUPPORT) &&
+ yyextra->current->mtype == Property)
+ { // we are yyextra->inside the properties section of a dispinterface
+ yyextra->odlProp = true;
+ yyextra->current->spec |= Entry::Gettable;
+ yyextra->current->spec |= Entry::Settable;
+ }
+
+ BEGIN( IDLAttribute );
+ }
else if (yyextra->insideCS &&
yyextra->current->name.isEmpty())
{
@@ -3247,20 +3247,20 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->args.resize(0);
BEGIN( SkipSquare );
}
- else
- {
- yyextra->current->args += yytext ;
- yyextra->squareCount=1;
- yyextra->externC=FALSE; // see bug759247
- BEGIN( Array ) ;
- }
- }
+ else
+ {
+ yyextra->current->args += yytext ;
+ yyextra->squareCount=1;
+ yyextra->externC=FALSE; // see bug759247
+ BEGIN( Array ) ;
+ }
+ }
<SliceMetadata>"[" { // Global metadata.
- yyextra->squareCount++;
+ yyextra->squareCount++;
yyextra->current->metaData += "[";
}
<SliceMetadata>{BN}* {
- lineCount(yyscanner);
+ lineCount(yyscanner);
}
<SliceMetadata>\"[^\"]*\" {
yyextra->current->metaData += yytext;
@@ -3289,294 +3289,294 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN (yyextra->lastModifierContext);
}
}
-<IDLAttribute>"]" {
- // end of IDL function attribute
- if (--yyextra->squareCount<=0)
- {
- lineCount(yyscanner);
- if (yyextra->current->mtype == Property)
- BEGIN( IDLPropName );
- else
- BEGIN( yyextra->lastSquareContext );
- }
- }
-<IDLAttribute>"propput" {
+<IDLAttribute>"]" {
+ // end of IDL function attribute
+ if (--yyextra->squareCount<=0)
+ {
+ lineCount(yyscanner);
+ if (yyextra->current->mtype == Property)
+ BEGIN( IDLPropName );
+ else
+ BEGIN( yyextra->lastSquareContext );
+ }
+ }
+<IDLAttribute>"propput" {
if (Config_getBool(IDL_PROPERTY_SUPPORT))
- {
- yyextra->current->mtype = Property;
- }
- yyextra->current->spec |= Entry::Settable;
- }
-<IDLAttribute>"propget" {
+ {
+ yyextra->current->mtype = Property;
+ }
+ yyextra->current->spec |= Entry::Settable;
+ }
+<IDLAttribute>"propget" {
if (Config_getBool(IDL_PROPERTY_SUPPORT))
- {
- yyextra->current->mtype = Property;
- }
- yyextra->current->spec |= Entry::Gettable;
- }
+ {
+ yyextra->current->mtype = Property;
+ }
+ yyextra->current->spec |= Entry::Gettable;
+ }
<IDLAttribute>"property" { // UNO IDL property
- yyextra->current->spec |= Entry::Property;
- }
+ yyextra->current->spec |= Entry::Property;
+ }
<IDLAttribute>"attribute" { // UNO IDL attribute
- yyextra->current->spec |= Entry::Attribute;
- }
+ yyextra->current->spec |= Entry::Attribute;
+ }
<IDLAttribute>"optional" { // on UNO IDL interface/service/attribute/property
yyextra->current->spec |= Entry::Optional;
}
<IDLAttribute>"readonly" { // on UNO IDL attribute or property
- if (Config_getBool(IDL_PROPERTY_SUPPORT) && yyextra->odlProp)
- {
- yyextra->current->spec ^= Entry::Settable;
- }
- else
- {
- yyextra->current->spec |= Entry::Readonly;
- }
- }
+ if (Config_getBool(IDL_PROPERTY_SUPPORT) && yyextra->odlProp)
+ {
+ yyextra->current->spec ^= Entry::Settable;
+ }
+ else
+ {
+ yyextra->current->spec |= Entry::Readonly;
+ }
+ }
<IDLAttribute>"bound" { // on UNO IDL attribute or property
- yyextra->current->spec |= Entry::Bound;
- }
+ yyextra->current->spec |= Entry::Bound;
+ }
<IDLAttribute>"removable" { // on UNO IDL property
- yyextra->current->spec |= Entry::Removable;
- }
+ yyextra->current->spec |= Entry::Removable;
+ }
<IDLAttribute>"constrained" { // on UNO IDL property
- yyextra->current->spec |= Entry::Constrained;
- }
+ yyextra->current->spec |= Entry::Constrained;
+ }
<IDLAttribute>"transient" { // on UNO IDL property
- yyextra->current->spec |= Entry::Transient;
- }
+ yyextra->current->spec |= Entry::Transient;
+ }
<IDLAttribute>"maybevoid" { // on UNO IDL property
- yyextra->current->spec |= Entry::MaybeVoid;
- }
+ yyextra->current->spec |= Entry::MaybeVoid;
+ }
<IDLAttribute>"maybedefault" { // on UNO IDL property
- yyextra->current->spec |= Entry::MaybeDefault;
- }
+ yyextra->current->spec |= Entry::MaybeDefault;
+ }
<IDLAttribute>"maybeambiguous" { // on UNO IDL property
- yyextra->current->spec |= Entry::MaybeAmbiguous;
- }
-<IDLAttribute>. {
- }
-<IDLPropName>{BN}*{ID}{BN}* {
- // return type (probably HRESULT) - skip it
-
- if (yyextra->odlProp)
- { // property type
- yyextra->idlProp = yytext;
- }
- }
-<IDLPropName>{ID}{BN}*"(" {
- yyextra->current->name = yytext;
- yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- BEGIN( IDLProp );
- }
-<IDLPropName>{BN}*"("{BN}*{ID}{BN}*")"{BN}* {
- if (yyextra->odlProp)
- {
- yyextra->idlProp += yytext;
- }
- }
-<IDLPropName>{ID}{BN}*/";" {
- if (yyextra->odlProp)
- {
- yyextra->current->name = yytext;
- yyextra->idlProp = yyextra->idlProp.stripWhiteSpace();
- yyextra->odlProp = false;
-
- BEGIN( IDLProp );
- }
- }
-<IDLProp>{BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter
- yyextra->idlAttr = yytext;
- yyextra->idlAttr=yyextra->idlAttr.stripWhiteSpace();
- }
-<IDLProp>{ID} { // property type
- yyextra->idlProp = yytext;
- }
-<IDLProp>{BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);)
- if (!yyextra->current->args)
- yyextra->current->args = "(";
- else
- yyextra->current->args += ", ";
- yyextra->current->args += yyextra->idlAttr;
- yyextra->current->args += " ";
- yyextra->current->args += yyextra->idlProp; // prop was actually type of extra parameter
- yyextra->current->args += " ";
- yyextra->current->args += yytext;
- yyextra->current->args = yyextra->current->args.left(yyextra->current->args.length() - 1); // strip comma
- yyextra->idlProp.resize(0);
- yyextra->idlAttr.resize(0);
- BEGIN( IDLProp );
- }
-<IDLProp>{BN}*{ID}{BN}*")"{BN}* {
- // the parameter name for the property - just skip.
- }
-<IDLProp>";" {
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->type = yyextra->idlProp;
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- if (yyextra->current->args)
- yyextra->current->args += ")";
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::VARIABLE_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- BEGIN( FindMembers );
- }
-<IDLProp>. { // spaces, *, or other stuff
- //yyextra->idlProp+=yytext;
- }
-<Array>"]" { yyextra->current->args += *yytext ;
- if (--yyextra->squareCount<=0)
- BEGIN( FindMembers ) ;
- }
-<FuncFuncArray>"]" { yyextra->current->args += *yytext ;
- if (--yyextra->squareCount<=0)
- BEGIN( Function ) ;
- }
-<Array,FuncFuncArray>"[" { yyextra->current->args += *yytext ;
- yyextra->squareCount++;
- }
-<Array,FuncFuncArray>. { yyextra->current->args += *yytext ; }
-<SkipSquare>"[" { yyextra->squareCount++; }
-<SkipSquare>"]" {
- if (--yyextra->squareCount<=0)
- BEGIN( yyextra->lastSquareContext );
- }
-<SkipSquare>\" {
- yyextra->lastStringContext=YY_START;
- BEGIN( SkipString );
- }
+ yyextra->current->spec |= Entry::MaybeAmbiguous;
+ }
+<IDLAttribute>. {
+ }
+<IDLPropName>{BN}*{ID}{BN}* {
+ // return type (probably HRESULT) - skip it
+
+ if (yyextra->odlProp)
+ { // property type
+ yyextra->idlProp = yytext;
+ }
+ }
+<IDLPropName>{ID}{BN}*"(" {
+ yyextra->current->name = yytext;
+ yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ BEGIN( IDLProp );
+ }
+<IDLPropName>{BN}*"("{BN}*{ID}{BN}*")"{BN}* {
+ if (yyextra->odlProp)
+ {
+ yyextra->idlProp += yytext;
+ }
+ }
+<IDLPropName>{ID}{BN}*/";" {
+ if (yyextra->odlProp)
+ {
+ yyextra->current->name = yytext;
+ yyextra->idlProp = yyextra->idlProp.stripWhiteSpace();
+ yyextra->odlProp = false;
+
+ BEGIN( IDLProp );
+ }
+ }
+<IDLProp>{BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter
+ yyextra->idlAttr = yytext;
+ yyextra->idlAttr=yyextra->idlAttr.stripWhiteSpace();
+ }
+<IDLProp>{ID} { // property type
+ yyextra->idlProp = yytext;
+ }
+<IDLProp>{BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);)
+ if (!yyextra->current->args)
+ yyextra->current->args = "(";
+ else
+ yyextra->current->args += ", ";
+ yyextra->current->args += yyextra->idlAttr;
+ yyextra->current->args += " ";
+ yyextra->current->args += yyextra->idlProp; // prop was actually type of extra parameter
+ yyextra->current->args += " ";
+ yyextra->current->args += yytext;
+ yyextra->current->args = yyextra->current->args.left(yyextra->current->args.length() - 1); // strip comma
+ yyextra->idlProp.resize(0);
+ yyextra->idlAttr.resize(0);
+ BEGIN( IDLProp );
+ }
+<IDLProp>{BN}*{ID}{BN}*")"{BN}* {
+ // the parameter name for the property - just skip.
+ }
+<IDLProp>";" {
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->type = yyextra->idlProp;
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ if (yyextra->current->args)
+ yyextra->current->args += ")";
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ BEGIN( FindMembers );
+ }
+<IDLProp>. { // spaces, *, or other stuff
+ //yyextra->idlProp+=yytext;
+ }
+<Array>"]" { yyextra->current->args += *yytext ;
+ if (--yyextra->squareCount<=0)
+ BEGIN( FindMembers ) ;
+ }
+<FuncFuncArray>"]" { yyextra->current->args += *yytext ;
+ if (--yyextra->squareCount<=0)
+ BEGIN( Function ) ;
+ }
+<Array,FuncFuncArray>"[" { yyextra->current->args += *yytext ;
+ yyextra->squareCount++;
+ }
+<Array,FuncFuncArray>. { yyextra->current->args += *yytext ; }
+<SkipSquare>"[" { yyextra->squareCount++; }
+<SkipSquare>"]" {
+ if (--yyextra->squareCount<=0)
+ BEGIN( yyextra->lastSquareContext );
+ }
+<SkipSquare>\" {
+ yyextra->lastStringContext=YY_START;
+ BEGIN( SkipString );
+ }
<SkipSquare>[^\n\[\]\"]+
-<FindMembers>"<" { addType(yyscanner);
- yyextra->current->type += yytext ;
- BEGIN( Sharp ) ;
- }
-<Sharp>">" { yyextra->current->type += *yytext ;
- if (--yyextra->sharpCount<=0)
- BEGIN( FindMembers ) ;
- }
-<Sharp>"<" { yyextra->current->type += *yytext ;
- yyextra->sharpCount++;
- }
-<Sharp>{BN}+ {
+<FindMembers>"<" { addType(yyscanner);
+ yyextra->current->type += yytext ;
+ BEGIN( Sharp ) ;
+ }
+<Sharp>">" { yyextra->current->type += *yytext ;
+ if (--yyextra->sharpCount<=0)
+ BEGIN( FindMembers ) ;
+ }
+<Sharp>"<" { yyextra->current->type += *yytext ;
+ yyextra->sharpCount++;
+ }
+<Sharp>{BN}+ {
yyextra->current->type += ' ';
- lineCount(yyscanner);
- }
-<Sharp>. { yyextra->current->type += *yytext ; }
-<FindFields>{ID} {
+ lineCount(yyscanner);
+ }
+<Sharp>. { yyextra->current->type += *yytext ; }
+<FindFields>{ID} {
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->name = yytext;
- }
-<FindFields>"(" {
- // Java enum initializer
- unput('(');
- yyextra->lastInitializerContext = YY_START;
- yyextra->initBracketCount=0;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->name = yytext;
+ }
+<FindFields>"(" {
+ // Java enum initializer
+ unput('(');
+ yyextra->lastInitializerContext = YY_START;
+ yyextra->initBracketCount=0;
yyextra->current->initializer = "=";
- BEGIN(ReadInitializer);
- }
-<FindFields>"=" {
- yyextra->lastInitializerContext = YY_START;
- yyextra->initBracketCount=0;
+ BEGIN(ReadInitializer);
+ }
+<FindFields>"=" {
+ yyextra->lastInitializerContext = YY_START;
+ yyextra->initBracketCount=0;
yyextra->current->initializer = yytext;
- BEGIN(ReadInitializer);
- }
+ BEGIN(ReadInitializer);
+ }
<FindFields>";" {
- if (yyextra->insideJava) // yyextra->last enum field in Java class
- {
- if (!yyextra->current->name.isEmpty())
- {
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- if (!(yyextra->current_root->spec&Entry::Enum))
- {
- yyextra->current->type = "@"; // enum marker
- }
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::VARIABLE_SEC;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- }
-
- BEGIN( FindMembers );
- }
- else
- {
- REJECT;
- }
- }
-<SkipRemainder>\n {
+ if (yyextra->insideJava) // yyextra->last enum field in Java class
+ {
+ if (!yyextra->current->name.isEmpty())
+ {
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ if (!(yyextra->current_root->spec&Entry::Enum))
+ {
+ yyextra->current->type = "@"; // enum marker
+ }
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ }
+
+ BEGIN( FindMembers );
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<SkipRemainder>\n {
lineCount(yyscanner);
}
<SkipRemainder>[^\n]*
-<FindFields>"," {
- //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n",
- // yyextra->current->type.data(), yyextra->current->name.data(),
- // yyextra->current->args.data(), yyextra->current_root->name.data(),yyextra->current->mGrpId);
- if (!yyextra->current->name.isEmpty())
- {
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyLineNr;
- yyextra->current->startColumn = yyextra->yyColNr;
- if (!(yyextra->current_root->spec&Entry::Enum))
- {
- yyextra->current->type = "@"; // enum marker
- }
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- yyextra->current->section = Entry::VARIABLE_SEC;
- // add to the scope of the enum
- if (!yyextra->insideCS && !yyextra->insideJava &&
- !(yyextra->current_root->spec&Entry::Strong))
+<FindFields>"," {
+ //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n",
+ // yyextra->current->type.data(), yyextra->current->name.data(),
+ // yyextra->current->args.data(), yyextra->current_root->name.data(),yyextra->current->mGrpId);
+ if (!yyextra->current->name.isEmpty())
+ {
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyLineNr;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ if (!(yyextra->current_root->spec&Entry::Enum))
+ {
+ yyextra->current->type = "@"; // enum marker
+ }
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ // add to the scope of the enum
+ if (!yyextra->insideCS && !yyextra->insideJava &&
+ !(yyextra->current_root->spec&Entry::Strong))
// for C# and Java 1.5+ enum values always have to be explicitly qualified,
// same for C++11 style enums (enum class Name {})
- {
- // add to the scope surrounding the enum (copy!)
+ {
+ // add to the scope surrounding the enum (copy!)
// we cannot during it directly as that would invalidate the iterator in parseCompounds.
//printf("*** adding outer scope entry for %s\n",yyextra->current->name.data());
yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_shared<Entry>(*yyextra->current));
- }
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- }
- else // probably a redundant ,
- {
- yyextra->current->reset();
- initEntry(yyscanner);
- }
- }
-<FindFields>"[" { // attribute list in IDL
- yyextra->squareCount=1;
- yyextra->lastSquareContext = YY_START;
- BEGIN(SkipSquare);
- }
+ }
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ }
+ else // probably a redundant ,
+ {
+ yyextra->current->reset();
+ initEntry(yyscanner);
+ }
+ }
+<FindFields>"[" { // attribute list in IDL
+ yyextra->squareCount=1;
+ yyextra->lastSquareContext = YY_START;
+ BEGIN(SkipSquare);
+ }
/*
-<FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); }
+<FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); }
*/
-<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { yyextra->current->program += yytext ; }
-<ReadBody,ReadNSBody,ReadBodyIntf>"//".* { yyextra->current->program += yytext ; }
-<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP)
- REJECT;
- // append PHP comment.
- yyextra->current->program += yytext ;
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { yyextra->current->program += yytext ; }
+<ReadBody,ReadNSBody,ReadBodyIntf>"//".* { yyextra->current->program += yytext ; }
+<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP)
+ REJECT;
+ // append PHP comment.
+ yyextra->current->program += yytext ;
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program += yytext ;
yyextra->pSkipVerbString = &yyextra->current->program;
yyextra->lastSkipVerbStringContext=YY_START;
BEGIN( SkipVerbString );
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (yyextra->insidePHP)
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (yyextra->insidePHP)
{
- yyextra->current->program += yytext ;
+ yyextra->current->program += yytext ;
yyextra->pCopyHereDocGString = &yyextra->current->program;
yyextra->lastHereDocContext=YY_START;
BEGIN( CopyHereDoc );
@@ -3585,61 +3585,61 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
REJECT;
}
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program += yytext ;
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program += yytext ;
yyextra->pCopyQuotedGString = &yyextra->current->program;
yyextra->lastStringContext=YY_START;
BEGIN( CopyGString );
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { yyextra->current->program += yytext ;
- yyextra->lastContext = YY_START ;
- BEGIN( Comment ) ;
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL} { yyextra->current->program += yytext ;
- ++yyextra->yyLineNr ;
- yyextra->lastContext = YY_START ;
- BEGIN( Comment ) ;
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>"'" {
- if (!yyextra->insidePHP)
- {
- yyextra->current->program += yytext;
- }
- else
- { // begin of single quoted string
- yyextra->current->program += yytext;
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{B}* { yyextra->current->program += yytext ;
+ yyextra->lastContext = YY_START ;
+ BEGIN( Comment ) ;
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>"/*"{BL} { yyextra->current->program += yytext ;
+ ++yyextra->yyLineNr ;
+ yyextra->lastContext = YY_START ;
+ BEGIN( Comment ) ;
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>"'" {
+ if (!yyextra->insidePHP)
+ {
+ yyextra->current->program += yytext;
+ }
+ else
+ { // begin of single quoted string
+ yyextra->current->program += yytext;
yyextra->pCopyQuotedGString = &yyextra->current->program;
yyextra->lastStringContext=YY_START;
- BEGIN(CopyPHPGString);
- }
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} {
- if (yyextra->insidePHP)
- {
- REJECT; // for PHP code single quotes
- // are used for strings of arbitrary length
- }
- else
- {
- yyextra->current->program += yytext;
- }
+ BEGIN(CopyPHPGString);
+ }
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} {
+ if (yyextra->insidePHP)
+ {
+ REJECT; // for PHP code single quotes
+ // are used for strings of arbitrary length
+ }
+ else
+ {
+ yyextra->current->program += yytext;
+ }
}
<ReadBody,ReadNSBody,ReadBodyIntf>"{" { yyextra->current->program += yytext ;
- ++yyextra->curlyCount ;
- }
-<ReadBodyIntf>"}" {
- yyextra->current->program += yytext ;
- --yyextra->curlyCount ;
- }
-<ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",yyextra->curlyCount);
- if ( yyextra->curlyCount>0 )
- {
- yyextra->current->program += yytext ;
- --yyextra->curlyCount ;
- }
- else
- {
- yyextra->current->endBodyLine = yyextra->yyLineNr;
+ ++yyextra->curlyCount ;
+ }
+<ReadBodyIntf>"}" {
+ yyextra->current->program += yytext ;
+ --yyextra->curlyCount ;
+ }
+<ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",yyextra->curlyCount);
+ if ( yyextra->curlyCount>0 )
+ {
+ yyextra->current->program += yytext ;
+ --yyextra->curlyCount ;
+ }
+ else
+ {
+ yyextra->current->endBodyLine = yyextra->yyLineNr;
std::shared_ptr<Entry> original_root = yyextra->current_root; // save root this namespace is in
if (yyextra->current->section == Entry::NAMESPACE_SEC && yyextra->current->type == "namespace")
{
@@ -3678,817 +3678,817 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->briefLine = briefLine;
yyextra->current->briefFile = briefFile;
}
- QCString &cn = yyextra->current->name;
- QCString rn = yyextra->current_root->name.copy();
- //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef);
- if (!cn.isEmpty() && !rn.isEmpty())
- {
- prependScope(yyscanner);
- }
- if (yyextra->isTypedef && cn.isEmpty())
- {
- //printf("Typedef Name\n");
- BEGIN( TypedefName );
- }
- else
- {
- if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
- {
- yyextra->current->program+=','; // add field terminator
- }
- // add compound definition to the tree
- yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
- // was: yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data(),yyextra->current->brief.data(),yyextra->insideObjC,yyextra->current->section);
- if (yyextra->insideObjC &&
- ((yyextra->current->spec&Entry::Interface) || (yyextra->current->spec==Entry::Category))
- ) // method definition follows
- {
- BEGIN( ReadBodyIntf ) ;
- }
- else
- {
- yyextra->memspecEntry = yyextra->current;
- yyextra->current_root->moveToSubEntryAndKeep( yyextra->current ) ;
- yyextra->current = std::make_shared<Entry>(*yyextra->current);
- if (yyextra->current->section==Entry::NAMESPACE_SEC ||
- (yyextra->current->spec==Entry::Interface) ||
- yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideJS ||
+ QCString &cn = yyextra->current->name;
+ QCString rn = yyextra->current_root->name.copy();
+ //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef);
+ if (!cn.isEmpty() && !rn.isEmpty())
+ {
+ prependScope(yyscanner);
+ }
+ if (yyextra->isTypedef && cn.isEmpty())
+ {
+ //printf("Typedef Name\n");
+ BEGIN( TypedefName );
+ }
+ else
+ {
+ if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
+ {
+ yyextra->current->program+=','; // add field terminator
+ }
+ // add compound definition to the tree
+ yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
+ // was: yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data(),yyextra->current->brief.data(),yyextra->insideObjC,yyextra->current->section);
+ if (yyextra->insideObjC &&
+ ((yyextra->current->spec&Entry::Interface) || (yyextra->current->spec==Entry::Category))
+ ) // method definition follows
+ {
+ BEGIN( ReadBodyIntf ) ;
+ }
+ else
+ {
+ yyextra->memspecEntry = yyextra->current;
+ yyextra->current_root->moveToSubEntryAndKeep( yyextra->current ) ;
+ yyextra->current = std::make_shared<Entry>(*yyextra->current);
+ if (yyextra->current->section==Entry::NAMESPACE_SEC ||
+ (yyextra->current->spec==Entry::Interface) ||
+ yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideJS ||
yyextra->insideSlice
- )
- { // namespaces and interfaces and java classes ends with a closing bracket without semicolon
+ )
+ { // namespaces and interfaces and java classes ends with a closing bracket without semicolon
yyextra->current->reset();
yyextra->current_root = original_root; // restore scope from before namespace descent
- initEntry(yyscanner);
- yyextra->memspecEntry.reset();
- BEGIN( FindMembers ) ;
- }
- else
- {
+ initEntry(yyscanner);
+ yyextra->memspecEntry.reset();
+ BEGIN( FindMembers ) ;
+ }
+ else
+ {
static QRegExp re("@[0-9]+$");
- if (!yyextra->isTypedef && yyextra->memspecEntry &&
+ if (!yyextra->isTypedef && yyextra->memspecEntry &&
yyextra->memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071)
- {
- // enabled the next two lines for bug 623424
- yyextra->current->doc.resize(0);
- yyextra->current->brief.resize(0);
- }
- BEGIN( MemberSpec ) ;
- }
- }
- }
- }
- }
-<ReadBody>"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",yyextra->curlyCount);
- lineCount(yyscanner);
- if ( yyextra->curlyCount>0 )
- {
- yyextra->current->program += yytext ;
- --yyextra->curlyCount ;
- }
- else
- {
- yyextra->isTypedef = TRUE;
- yyextra->current->endBodyLine = yyextra->yyLineNr;
- QCString &cn = yyextra->current->name;
- QCString rn = yyextra->current_root->name.copy();
- if (!cn.isEmpty() && !rn.isEmpty())
- {
- prependScope(yyscanner);
- }
- BEGIN( TypedefName );
- }
- }
-<TypedefName>("const"|"volatile"){BN} { // late "const" or "volatile" keyword
- lineCount(yyscanner);
- yyextra->current->type.prepend(yytext);
- }
-<TypedefName>{ID} {
- if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
- {
- yyextra->current->program+=","; // add field terminator
- }
- yyextra->current->name=yytext;
- prependScope(yyscanner);
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
- //printf("Adding compound %s %s %s\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
- if (!yyextra->firstTypedefEntry)
- {
- yyextra->firstTypedefEntry = yyextra->current;
- }
- yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
- initEntry(yyscanner);
- yyextra->isTypedef=TRUE; // to undo reset by initEntry(yyscanner)
- BEGIN(MemberSpecSkip);
- }
-<TypedefName>";" { /* typedef of anonymous type */
- yyextra->current->name.sprintf("@%d",anonCount++);
- if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
- {
- yyextra->current->program+=','; // add field terminator
- }
- // add compound definition to the tree
- yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
- yyextra->memspecEntry = yyextra->current;
- yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
- initEntry(yyscanner);
- unput(';');
- BEGIN( MemberSpec ) ;
- }
+ {
+ // enabled the next two lines for bug 623424
+ yyextra->current->doc.resize(0);
+ yyextra->current->brief.resize(0);
+ }
+ BEGIN( MemberSpec ) ;
+ }
+ }
+ }
+ }
+ }
+<ReadBody>"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",yyextra->curlyCount);
+ lineCount(yyscanner);
+ if ( yyextra->curlyCount>0 )
+ {
+ yyextra->current->program += yytext ;
+ --yyextra->curlyCount ;
+ }
+ else
+ {
+ yyextra->isTypedef = TRUE;
+ yyextra->current->endBodyLine = yyextra->yyLineNr;
+ QCString &cn = yyextra->current->name;
+ QCString rn = yyextra->current_root->name.copy();
+ if (!cn.isEmpty() && !rn.isEmpty())
+ {
+ prependScope(yyscanner);
+ }
+ BEGIN( TypedefName );
+ }
+ }
+<TypedefName>("const"|"volatile"){BN} { // late "const" or "volatile" keyword
+ lineCount(yyscanner);
+ yyextra->current->type.prepend(yytext);
+ }
+<TypedefName>{ID} {
+ if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
+ {
+ yyextra->current->program+=","; // add field terminator
+ }
+ yyextra->current->name=yytext;
+ prependScope(yyscanner);
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
+ //printf("Adding compound %s %s %s\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
+ if (!yyextra->firstTypedefEntry)
+ {
+ yyextra->firstTypedefEntry = yyextra->current;
+ }
+ yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
+ initEntry(yyscanner);
+ yyextra->isTypedef=TRUE; // to undo reset by initEntry(yyscanner)
+ BEGIN(MemberSpecSkip);
+ }
+<TypedefName>";" { /* typedef of anonymous type */
+ yyextra->current->name.sprintf("@%d",anonCount++);
+ if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
+ {
+ yyextra->current->program+=','; // add field terminator
+ }
+ // add compound definition to the tree
+ yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
+ yyextra->memspecEntry = yyextra->current;
+ yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
+ initEntry(yyscanner);
+ unput(';');
+ BEGIN( MemberSpec ) ;
+ }
<MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved.
- lineCount(yyscanner);
- int i=0,l=(int)yyleng,j;
- while (i<l && (!isId(yytext[i]))) i++;
- yyextra->msName = QCString(yytext).right(l-i).stripWhiteSpace();
- j=yyextra->msName.find("[");
- if (j!=-1)
- {
- yyextra->msArgs=yyextra->msName.right(yyextra->msName.length()-j);
- yyextra->msName=yyextra->msName.left(j);
- }
- yyextra->msType=QCString(yytext).left(i);
-
- // handle *pName in: typedef { ... } name, *pName;
- if (yyextra->firstTypedefEntry)
- {
- if (yyextra->firstTypedefEntry->spec&Entry::Struct)
- {
- yyextra->msType.prepend("struct "+yyextra->firstTypedefEntry->name);
- }
- else if (yyextra->firstTypedefEntry->spec&Entry::Union)
- {
- yyextra->msType.prepend("union "+yyextra->firstTypedefEntry->name);
- }
- else if (yyextra->firstTypedefEntry->section==Entry::ENUM_SEC)
- {
- yyextra->msType.prepend("enum "+yyextra->firstTypedefEntry->name);
- }
- else
- {
- yyextra->msType.prepend(yyextra->firstTypedefEntry->name);
- }
- }
- }
-<MemberSpec>"(" { // function with struct return type
- addType(yyscanner);
- yyextra->current->name = yyextra->msName;
- yyextra->current->spec = 0;
- unput('(');
- BEGIN(FindMembers);
- }
-<MemberSpec>[,;] {
- if (yyextra->msName.isEmpty() && !yyextra->current->name.isEmpty())
- {
- // see if the compound does not have a name or is yyextra->inside another
- // anonymous compound. If so we insert a
- // special 'anonymous' variable.
- //Entry *p=yyextra->current_root;
+ lineCount(yyscanner);
+ int i=0,l=(int)yyleng,j;
+ while (i<l && (!isId(yytext[i]))) i++;
+ yyextra->msName = QCString(yytext).right(l-i).stripWhiteSpace();
+ j=yyextra->msName.find("[");
+ if (j!=-1)
+ {
+ yyextra->msArgs=yyextra->msName.right(yyextra->msName.length()-j);
+ yyextra->msName=yyextra->msName.left(j);
+ }
+ yyextra->msType=QCString(yytext).left(i);
+
+ // handle *pName in: typedef { ... } name, *pName;
+ if (yyextra->firstTypedefEntry)
+ {
+ if (yyextra->firstTypedefEntry->spec&Entry::Struct)
+ {
+ yyextra->msType.prepend("struct "+yyextra->firstTypedefEntry->name);
+ }
+ else if (yyextra->firstTypedefEntry->spec&Entry::Union)
+ {
+ yyextra->msType.prepend("union "+yyextra->firstTypedefEntry->name);
+ }
+ else if (yyextra->firstTypedefEntry->section==Entry::ENUM_SEC)
+ {
+ yyextra->msType.prepend("enum "+yyextra->firstTypedefEntry->name);
+ }
+ else
+ {
+ yyextra->msType.prepend(yyextra->firstTypedefEntry->name);
+ }
+ }
+ }
+<MemberSpec>"(" { // function with struct return type
+ addType(yyscanner);
+ yyextra->current->name = yyextra->msName;
+ yyextra->current->spec = 0;
+ unput('(');
+ BEGIN(FindMembers);
+ }
+<MemberSpec>[,;] {
+ if (yyextra->msName.isEmpty() && !yyextra->current->name.isEmpty())
+ {
+ // see if the compound does not have a name or is yyextra->inside another
+ // anonymous compound. If so we insert a
+ // special 'anonymous' variable.
+ //Entry *p=yyextra->current_root;
const Entry *p=yyextra->current.get();
- while (p)
- {
- // only look for class scopes, not namespace scopes
- if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty())
- {
- //printf("Trying scope '%s'\n",p->name.data());
- int i=p->name.findRev("::");
- int pi = (i==-1) ? 0 : i+2;
- if (p->name.at(pi)=='@')
- {
- // anonymous compound yyextra->inside -> insert dummy variable name
- //printf("Adding anonymous variable for scope %s\n",p->name.data());
- yyextra->msName.sprintf("@%d",anonCount++);
- break;
- }
- }
- //p=p->parent;
- if (p==yyextra->current.get()) p=yyextra->current_root.get(); else p=p->parent();
- }
- }
- //printf("yyextra->msName=%s yyextra->current->name=%s\n",yyextra->msName.data(),yyextra->current->name.data());
- if (!yyextra->msName.isEmpty()
- /*&& yyextra->msName!=yyextra->current->name*/) // skip typedef T {} T;, removed due to bug608493
- {
- bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT);
- // case 1: typedef struct _S { ... } S_t;
- // -> omit typedef and use S_t as the struct name
- if (typedefHidesStruct &&
- yyextra->isTypedef &&
- ((yyextra->current->spec&(Entry::Struct|Entry::Union)) ||
- yyextra->current->section==Entry::ENUM_SEC )&&
- yyextra->msType.stripWhiteSpace().isEmpty() &&
- yyextra->memspecEntry)
- {
- yyextra->memspecEntry->name=yyextra->msName;
- }
- else // case 2: create a typedef field
- {
+ while (p)
+ {
+ // only look for class scopes, not namespace scopes
+ if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty())
+ {
+ //printf("Trying scope '%s'\n",p->name.data());
+ int i=p->name.findRev("::");
+ int pi = (i==-1) ? 0 : i+2;
+ if (p->name.at(pi)=='@')
+ {
+ // anonymous compound yyextra->inside -> insert dummy variable name
+ //printf("Adding anonymous variable for scope %s\n",p->name.data());
+ yyextra->msName.sprintf("@%d",anonCount++);
+ break;
+ }
+ }
+ //p=p->parent;
+ if (p==yyextra->current.get()) p=yyextra->current_root.get(); else p=p->parent();
+ }
+ }
+ //printf("yyextra->msName=%s yyextra->current->name=%s\n",yyextra->msName.data(),yyextra->current->name.data());
+ if (!yyextra->msName.isEmpty()
+ /*&& yyextra->msName!=yyextra->current->name*/) // skip typedef T {} T;, removed due to bug608493
+ {
+ bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT);
+ // case 1: typedef struct _S { ... } S_t;
+ // -> omit typedef and use S_t as the struct name
+ if (typedefHidesStruct &&
+ yyextra->isTypedef &&
+ ((yyextra->current->spec&(Entry::Struct|Entry::Union)) ||
+ yyextra->current->section==Entry::ENUM_SEC )&&
+ yyextra->msType.stripWhiteSpace().isEmpty() &&
+ yyextra->memspecEntry)
+ {
+ yyextra->memspecEntry->name=yyextra->msName;
+ }
+ else // case 2: create a typedef field
+ {
std::shared_ptr<Entry> varEntry=std::make_shared<Entry>();
- varEntry->lang = yyextra->language;
- varEntry->protection = yyextra->current->protection ;
- varEntry->mtype = yyextra->current->mtype;
- varEntry->virt = yyextra->current->virt;
- varEntry->stat = yyextra->current->stat;
- varEntry->section = Entry::VARIABLE_SEC;
- varEntry->name = yyextra->msName.stripWhiteSpace();
- varEntry->type = yyextra->current->type.simplifyWhiteSpace()+" ";
- varEntry->args = yyextra->msArgs;
- if (yyextra->isTypedef)
- {
- varEntry->type.prepend("typedef ");
- // //printf("yyextra->current->name = %s %s\n",yyextra->current->name.data(),yyextra->msName.data());
- }
- if (typedefHidesStruct &&
- yyextra->isTypedef &&
- (yyextra->current->spec&(Entry::Struct|Entry::Union)) &&
- yyextra->memspecEntry
- ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;"
- {
- varEntry->type+=yyextra->memspecEntry->name+yyextra->msType;
- }
- else // case 2: use _S as type for for pS_t
- {
- varEntry->type+=yyextra->current->name+yyextra->msType;
- }
- varEntry->fileName = yyextra->yyFileName;
- varEntry->startLine = yyextra->yyLineNr;
- varEntry->startColumn = yyextra->yyColNr;
- varEntry->doc = yyextra->current->doc.copy();
- varEntry->brief = yyextra->current->brief.copy();
- varEntry->mGrpId = yyextra->current->mGrpId;
+ varEntry->lang = yyextra->language;
+ varEntry->protection = yyextra->current->protection ;
+ varEntry->mtype = yyextra->current->mtype;
+ varEntry->virt = yyextra->current->virt;
+ varEntry->stat = yyextra->current->stat;
+ varEntry->section = Entry::VARIABLE_SEC;
+ varEntry->name = yyextra->msName.stripWhiteSpace();
+ varEntry->type = yyextra->current->type.simplifyWhiteSpace()+" ";
+ varEntry->args = yyextra->msArgs;
+ if (yyextra->isTypedef)
+ {
+ varEntry->type.prepend("typedef ");
+ // //printf("yyextra->current->name = %s %s\n",yyextra->current->name.data(),yyextra->msName.data());
+ }
+ if (typedefHidesStruct &&
+ yyextra->isTypedef &&
+ (yyextra->current->spec&(Entry::Struct|Entry::Union)) &&
+ yyextra->memspecEntry
+ ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;"
+ {
+ varEntry->type+=yyextra->memspecEntry->name+yyextra->msType;
+ }
+ else // case 2: use _S as type for for pS_t
+ {
+ varEntry->type+=yyextra->current->name+yyextra->msType;
+ }
+ varEntry->fileName = yyextra->yyFileName;
+ varEntry->startLine = yyextra->yyLineNr;
+ varEntry->startColumn = yyextra->yyColNr;
+ varEntry->doc = yyextra->current->doc.copy();
+ varEntry->brief = yyextra->current->brief.copy();
+ varEntry->mGrpId = yyextra->current->mGrpId;
varEntry->initializer = yyextra->current->initializer;
varEntry->groups = yyextra->current->groups;
varEntry->sli = yyextra->current->sli;
- //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n",
- // varEntry->type.data(),varEntry->name.data(),
- // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data());
- yyextra->current_root->moveToSubEntryAndKeep(varEntry);
- }
- }
- if (*yytext==';') // end of a struct/class ...
- {
- if (!yyextra->isTypedef && yyextra->msName.isEmpty() && yyextra->memspecEntry && (yyextra->current->section&Entry::COMPOUND_MASK))
- { // case where a class/struct has a doc block after it
- if (!yyextra->current->doc.isEmpty())
- {
- yyextra->memspecEntry->doc += yyextra->current->doc;
- }
- if (!yyextra->current->brief.isEmpty())
- {
- yyextra->memspecEntry->brief += yyextra->current->brief;
- }
- }
- yyextra->msType.resize(0);
- yyextra->msName.resize(0);
- yyextra->msArgs.resize(0);
- yyextra->isTypedef=FALSE;
- yyextra->firstTypedefEntry.reset();
- yyextra->memspecEntry.reset();
- yyextra->current->reset();
- initEntry(yyscanner);
- BEGIN( FindMembers );
- }
- else
- {
- yyextra->current->doc.resize(0);
- yyextra->current->brief.resize(0);
- }
-
- }
-<MemberSpec>"=" {
- yyextra->lastInitializerContext=YY_START;
- yyextra->initBracketCount=0;
+ //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n",
+ // varEntry->type.data(),varEntry->name.data(),
+ // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data());
+ yyextra->current_root->moveToSubEntryAndKeep(varEntry);
+ }
+ }
+ if (*yytext==';') // end of a struct/class ...
+ {
+ if (!yyextra->isTypedef && yyextra->msName.isEmpty() && yyextra->memspecEntry && (yyextra->current->section&Entry::COMPOUND_MASK))
+ { // case where a class/struct has a doc block after it
+ if (!yyextra->current->doc.isEmpty())
+ {
+ yyextra->memspecEntry->doc += yyextra->current->doc;
+ }
+ if (!yyextra->current->brief.isEmpty())
+ {
+ yyextra->memspecEntry->brief += yyextra->current->brief;
+ }
+ }
+ yyextra->msType.resize(0);
+ yyextra->msName.resize(0);
+ yyextra->msArgs.resize(0);
+ yyextra->isTypedef=FALSE;
+ yyextra->firstTypedefEntry.reset();
+ yyextra->memspecEntry.reset();
+ yyextra->current->reset();
+ initEntry(yyscanner);
+ BEGIN( FindMembers );
+ }
+ else
+ {
+ yyextra->current->doc.resize(0);
+ yyextra->current->brief.resize(0);
+ }
+
+ }
+<MemberSpec>"=" {
+ yyextra->lastInitializerContext=YY_START;
+ yyextra->initBracketCount=0;
yyextra->current->initializer = yytext;
- BEGIN(ReadInitializer);
- /* BEGIN(MemberSpecSkip); */
- }
+ BEGIN(ReadInitializer);
+ /* BEGIN(MemberSpecSkip); */
+ }
/*
-<MemberSpecSkip>"{" {
- yyextra->curlyCount=0;
- yyextra->lastCurlyContext = MemberSpecSkip;
- yyextra->previous = yyextra->current;
- BEGIN(SkipCurly);
- }
+<MemberSpecSkip>"{" {
+ yyextra->curlyCount=0;
+ yyextra->lastCurlyContext = MemberSpecSkip;
+ yyextra->previous = yyextra->current;
+ BEGIN(SkipCurly);
+ }
*/
-<MemberSpecSkip>"," { BEGIN(MemberSpec); }
-<MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); }
+<MemberSpecSkip>"," { BEGIN(MemberSpec); }
+<MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); }
<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { yyextra->current->program += yytext ;
- lineCount(yyscanner) ;
- }
-<ReadBodyIntf>"@end"/[^a-z_A-Z0-9] { // end of Objective C block
- yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
- initEntry(yyscanner);
- yyextra->language = yyextra->current->lang = SrcLangExt_Cpp; // see bug746361
- yyextra->insideObjC=FALSE;
- BEGIN( FindMembers );
- }
-<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program += yytext ; }
+ lineCount(yyscanner) ;
+ }
+<ReadBodyIntf>"@end"/[^a-z_A-Z0-9] { // end of Objective C block
+ yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
+ initEntry(yyscanner);
+ yyextra->language = yyextra->current->lang = SrcLangExt_Cpp; // see bug746361
+ yyextra->insideObjC=FALSE;
+ BEGIN( FindMembers );
+ }
+<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program += yytext ; }
<FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */
<FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */
- if (yyextra->insidePHP) // reference parameter
- {
- REJECT
- }
- else
- {
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- lineCount(yyscanner);
- addType(yyscanner);
- yyextra->funcPtrType=yytext;
- yyextra->roundCount=0;
- //yyextra->current->type += yytext;
- BEGIN( FuncPtr );
- }
- }
-<FuncPtr>{SCOPENAME} {
- yyextra->current->name = yytext;
- if (nameIsOperator(yyextra->current->name))
- {
- BEGIN( FuncPtrOperator );
- }
- else
- {
- if (yyextra->current->name=="const" || yyextra->current->name=="volatile")
- {
- yyextra->funcPtrType += yyextra->current->name;
- }
- else
- {
- BEGIN( EndFuncPtr );
- }
- }
- }
-<FuncPtr>. {
- //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyextra->yyLineNr,yyextra->yyFileName);
- }
-<FuncPtrOperator>"("{BN}*")"{BN}*/"(" {
- yyextra->current->name += yytext;
- yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
- lineCount(yyscanner);
- }
-<FuncPtrOperator>\n {
+ if (yyextra->insidePHP) // reference parameter
+ {
+ REJECT
+ }
+ else
+ {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ lineCount(yyscanner);
+ addType(yyscanner);
+ yyextra->funcPtrType=yytext;
+ yyextra->roundCount=0;
+ //yyextra->current->type += yytext;
+ BEGIN( FuncPtr );
+ }
+ }
+<FuncPtr>{SCOPENAME} {
+ yyextra->current->name = yytext;
+ if (nameIsOperator(yyextra->current->name))
+ {
+ BEGIN( FuncPtrOperator );
+ }
+ else
+ {
+ if (yyextra->current->name=="const" || yyextra->current->name=="volatile")
+ {
+ yyextra->funcPtrType += yyextra->current->name;
+ }
+ else
+ {
+ BEGIN( EndFuncPtr );
+ }
+ }
+ }
+<FuncPtr>. {
+ //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyextra->yyLineNr,yyextra->yyFileName);
+ }
+<FuncPtrOperator>"("{BN}*")"{BN}*/"(" {
+ yyextra->current->name += yytext;
+ yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
+ lineCount(yyscanner);
+ }
+<FuncPtrOperator>\n {
+ lineCount(yyscanner);
+ yyextra->current->name += *yytext;
+ }
+<FuncPtrOperator>"(" {
+ unput(*yytext);
+ BEGIN( EndFuncPtr );
+ }
+<FuncPtrOperator>. {
+ yyextra->current->name += *yytext;
+ }
+<EndFuncPtr>")"{BN}*/";" { // a variable with extra braces
+ lineCount(yyscanner);
+ yyextra->current->type+=yyextra->funcPtrType.data()+1;
+ BEGIN(FindMembers);
+ }
+<EndFuncPtr>")"{BN}*/"(" { // a function pointer
+ lineCount(yyscanner);
+ yyextra->current->type+=yyextra->funcPtrType+")";
+ BEGIN(FindMembers);
+ }
+<EndFuncPtr>")"{BN}*/"[" { // an array of variables
lineCount(yyscanner);
- yyextra->current->name += *yytext;
- }
-<FuncPtrOperator>"(" {
- unput(*yytext);
- BEGIN( EndFuncPtr );
- }
-<FuncPtrOperator>. {
- yyextra->current->name += *yytext;
- }
-<EndFuncPtr>")"{BN}*/";" { // a variable with extra braces
- lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType.data()+1;
- BEGIN(FindMembers);
- }
-<EndFuncPtr>")"{BN}*/"(" { // a function pointer
- lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType+")";
- BEGIN(FindMembers);
- }
-<EndFuncPtr>")"{BN}*/"[" { // an array of variables
- lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType.data();
- yyextra->current->args += ")";
- BEGIN(FindMembers);
- }
-<EndFuncPtr>"(" { // a function returning a function or
+ yyextra->current->type+=yyextra->funcPtrType.data();
+ yyextra->current->args += ")";
+ BEGIN(FindMembers);
+ }
+<EndFuncPtr>"(" { // a function returning a function or
// a function returning a pointer to an array
- yyextra->current->args += *yytext ;
- //yyextra->roundCount=0;
- //BEGIN( FuncFunc );
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->currentArgumentContext = FuncFuncEnd;
- yyextra->fullArgString=yyextra->current->args.copy();
- yyextra->copyArgString=&yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- }
-<EndFuncPtr>"["[^\n\]]*"]" {
- yyextra->funcPtrType+=yytext;
- }
-<EndFuncPtr>")" {
- BEGIN(FindMembers);
- }
-<FuncFunc>"(" {
- yyextra->current->args += *yytext ;
- ++yyextra->roundCount;
- }
-<FuncFunc>")" {
- yyextra->current->args += *yytext ;
- if ( yyextra->roundCount )
- --yyextra->roundCount;
- else
- {
- BEGIN(FuncFuncEnd);
- }
- }
-<FuncFuncEnd>")"{BN}*"(" {
- lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType+")(";
- BEGIN(FuncFuncType);
- }
-<FuncFuncEnd>")"{BN}*/[;{] {
- lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType.data()+1;
- BEGIN(Function);
- }
-<FuncFuncEnd>")"{BN}*/"[" { // function returning a pointer to an array
+ yyextra->current->args += *yytext ;
+ //yyextra->roundCount=0;
+ //BEGIN( FuncFunc );
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->currentArgumentContext = FuncFuncEnd;
+ yyextra->fullArgString=yyextra->current->args.copy();
+ yyextra->copyArgString=&yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ }
+<EndFuncPtr>"["[^\n\]]*"]" {
+ yyextra->funcPtrType+=yytext;
+ }
+<EndFuncPtr>")" {
+ BEGIN(FindMembers);
+ }
+<FuncFunc>"(" {
+ yyextra->current->args += *yytext ;
+ ++yyextra->roundCount;
+ }
+<FuncFunc>")" {
+ yyextra->current->args += *yytext ;
+ if ( yyextra->roundCount )
+ --yyextra->roundCount;
+ else
+ {
+ BEGIN(FuncFuncEnd);
+ }
+ }
+<FuncFuncEnd>")"{BN}*"(" {
+ lineCount(yyscanner);
+ yyextra->current->type+=yyextra->funcPtrType+")(";
+ BEGIN(FuncFuncType);
+ }
+<FuncFuncEnd>")"{BN}*/[;{] {
+ lineCount(yyscanner);
+ yyextra->current->type+=yyextra->funcPtrType.data()+1;
+ BEGIN(Function);
+ }
+<FuncFuncEnd>")"{BN}*/"[" { // function returning a pointer to an array
lineCount(yyscanner);
- yyextra->current->type+=yyextra->funcPtrType;
- yyextra->current->args+=")";
- BEGIN(FuncFuncArray);
- }
-<FuncFuncEnd>. {
- yyextra->current->args += *yytext;
- }
-<FuncFuncType>"(" {
- yyextra->current->type += *yytext;
- yyextra->roundCount++;
- }
-<FuncFuncType>")" {
- yyextra->current->type += *yytext;
- if (yyextra->roundCount)
- --yyextra->roundCount;
- else
- BEGIN(Function);
- }
-<FuncFuncType>{BN}*","{BN}* { lineCount(yyscanner) ; yyextra->current->type += ", " ; }
-<FuncFuncType>{BN}+ { lineCount(yyscanner) ; yyextra->current->type += ' ' ; }
-<FuncFuncType>. {
- yyextra->current->type += *yytext;
- }
+ yyextra->current->type+=yyextra->funcPtrType;
+ yyextra->current->args+=")";
+ BEGIN(FuncFuncArray);
+ }
+<FuncFuncEnd>. {
+ yyextra->current->args += *yytext;
+ }
+<FuncFuncType>"(" {
+ yyextra->current->type += *yytext;
+ yyextra->roundCount++;
+ }
+<FuncFuncType>")" {
+ yyextra->current->type += *yytext;
+ if (yyextra->roundCount)
+ --yyextra->roundCount;
+ else
+ BEGIN(Function);
+ }
+<FuncFuncType>{BN}*","{BN}* { lineCount(yyscanner) ; yyextra->current->type += ", " ; }
+<FuncFuncType>{BN}+ { lineCount(yyscanner) ; yyextra->current->type += ' ' ; }
+<FuncFuncType>. {
+ yyextra->current->type += *yytext;
+ }
<FindMembers>"("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")"{BN}*"(" { // for catching typedef void (__stdcall *f)() like definitions
- if (yyextra->current->type.left(7)=="typedef" && yyextra->current->bodyLine==-1)
- // the bodyLine check is to prevent this guard to be true more than once
- {
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- BEGIN( GetCallType );
- }
- else if (!yyextra->current->name.isEmpty()) // normal function
- {
- yyextra->current->args = yytext;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->currentArgumentContext = FuncQual;
- yyextra->fullArgString=yyextra->current->args.copy();
- yyextra->copyArgString=&yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- //printf(">>> Read function arguments!\n");
- }
- }
-<GetCallType>{BN}*{ID}{BN}*"*" {
- lineCount(yyscanner);
- addType(yyscanner);
- yyextra->funcPtrType="(";
- yyextra->funcPtrType+=yytext;
- yyextra->roundCount=0;
- BEGIN( FuncPtr );
- }
-<FindMembers>"(" {
+ if (yyextra->current->type.left(7)=="typedef" && yyextra->current->bodyLine==-1)
+ // the bodyLine check is to prevent this guard to be true more than once
+ {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ BEGIN( GetCallType );
+ }
+ else if (!yyextra->current->name.isEmpty()) // normal function
+ {
+ yyextra->current->args = yytext;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->currentArgumentContext = FuncQual;
+ yyextra->fullArgString=yyextra->current->args.copy();
+ yyextra->copyArgString=&yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ //printf(">>> Read function arguments!\n");
+ }
+ }
+<GetCallType>{BN}*{ID}{BN}*"*" {
+ lineCount(yyscanner);
+ addType(yyscanner);
+ yyextra->funcPtrType="(";
+ yyextra->funcPtrType+=yytext;
+ yyextra->roundCount=0;
+ BEGIN( FuncPtr );
+ }
+<FindMembers>"(" {
if (!yyextra->current->name.isEmpty())
- {
- yyextra->current->args = yytext;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->currentArgumentContext = FuncQual;
- yyextra->fullArgString=yyextra->current->args.copy();
- yyextra->copyArgString=&yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- //printf(">>> Read function arguments yyextra->current->argList.size()=%d\n",yyextra->current->argList.size());
- }
- }
+ {
+ yyextra->current->args = yytext;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->currentArgumentContext = FuncQual;
+ yyextra->fullArgString=yyextra->current->args.copy();
+ yyextra->copyArgString=&yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ //printf(">>> Read function arguments yyextra->current->argList.size()=%d\n",yyextra->current->argList.size());
+ }
+ }
/*
-<FindMembers>"("{BN}*("void"{BN}*)?")" {
- lineCount(yyscanner);
- yyextra->current->args = "()";
- BEGIN( FuncQual );
- }
+<FindMembers>"("{BN}*("void"{BN}*)?")" {
+ lineCount(yyscanner);
+ yyextra->current->args = "()";
+ BEGIN( FuncQual );
+ }
*/
/*- Function argument reading rules ---------------------------------------*/
-<ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
-<CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
-<CopyArgRound>[^\/\n\)\(\"\']+ {
- *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
-<ReadFuncArgType,ReadTempArgs>{BN}* {
- *yyextra->copyArgString+=" ";
- yyextra->fullArgString+=" ";
- lineCount(yyscanner);
- }
-<ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>{RAWBEGIN} {
+<ReadFuncArgType>[^ \/\r\t\n\)\(\"\'#]+ { *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+<CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+<CopyArgRound>[^\/\n\)\(\"\']+ {
+ *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+<ReadFuncArgType,ReadTempArgs>{BN}* {
+ *yyextra->copyArgString+=" ";
+ yyextra->fullArgString+=" ";
+ lineCount(yyscanner);
+ }
+<ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>{RAWBEGIN} {
yyextra->delimiter = yytext+2;
yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
yyextra->lastRawStringContext = YY_START;
yyextra->pCopyRawString = yyextra->copyArgString;
*yyextra->pCopyRawString+=yytext;
- yyextra->fullArgString+=yytext;
+ yyextra->fullArgString+=yytext;
BEGIN(RawString);
}
-<ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>\" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- yyextra->lastCopyArgStringContext = YY_START;
- BEGIN( CopyArgString );
- }
-<ReadFuncArgType,ReadTempArgs>"(" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- yyextra->argRoundCount=0;
- yyextra->lastCopyArgContext = YY_START;
- BEGIN( CopyArgRound );
- }
-<ReadFuncArgType>")" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
+<ReadFuncArgType,CopyArgRound,CopyArgSharp,ReadTempArgs>\" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ yyextra->lastCopyArgStringContext = YY_START;
+ BEGIN( CopyArgString );
+ }
+<ReadFuncArgType,ReadTempArgs>"(" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ yyextra->argRoundCount=0;
+ yyextra->lastCopyArgContext = YY_START;
+ BEGIN( CopyArgRound );
+ }
+<ReadFuncArgType>")" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
- if (yyextra->insideJS)
- {
- fixArgumentListForJavaScript(yyextra->current->argList);
- }
+ if (yyextra->insideJS)
+ {
+ fixArgumentListForJavaScript(yyextra->current->argList);
+ }
handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
- /* remember the yyextra->current documentation block, since
- we could overwrite it with the documentation of
- a function argument, which we then have to correct later
- on
- */
- yyextra->docBackup = yyextra->current->doc;
- yyextra->briefBackup = yyextra->current->brief;
-
- BEGIN( yyextra->currentArgumentContext );
- }
- /* a special comment */
-<ReadFuncArgType,ReadTempArgs>("/*"[*!]|"//"[/!])("<"?) {
+ /* remember the yyextra->current documentation block, since
+ we could overwrite it with the documentation of
+ a function argument, which we then have to correct later
+ on
+ */
+ yyextra->docBackup = yyextra->current->doc;
+ yyextra->briefBackup = yyextra->current->brief;
+
+ BEGIN( yyextra->currentArgumentContext );
+ }
+ /* a special comment */
+<ReadFuncArgType,ReadTempArgs>("/*"[*!]|"//"[/!])("<"?) {
if (yyextra->currentArgumentContext==DefineEnd)
- {
- // for defines we interpret a comment
- // as documentation for the define
- int i;for (i=(int)yyleng-1;i>=0;i--)
- {
- unput(yytext[i]);
- }
+ {
+ // for defines we interpret a comment
+ // as documentation for the define
+ int i;for (i=(int)yyleng-1;i>=0;i--)
+ {
+ unput(yytext[i]);
+ }
yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
- BEGIN( yyextra->currentArgumentContext );
- }
- else // not a define
- {
- // for functions we interpret a comment
- // as documentation for the argument
- yyextra->fullArgString+=yytext;
- yyextra->lastCopyArgChar=0;
- yyextra->lastCommentInArgContext=YY_START;
- if (yytext[1]=='/')
- BEGIN( CopyArgCommentLine );
- else
- BEGIN( CopyArgComment );
- }
- }
- /* a non-special comment */
-<ReadFuncArgType,ReadTempArgs>"/**/" { /* empty comment */ }
-<ReadFuncArgType,ReadTempArgs>"/*" {
- yyextra->lastCContext = YY_START;
- BEGIN( SkipComment );
- }
-<ReadFuncArgType,ReadTempArgs>"//" {
- yyextra->lastCContext = YY_START;
- BEGIN( SkipCxxComment );
- }
+ BEGIN( yyextra->currentArgumentContext );
+ }
+ else // not a define
+ {
+ // for functions we interpret a comment
+ // as documentation for the argument
+ yyextra->fullArgString+=yytext;
+ yyextra->lastCopyArgChar=0;
+ yyextra->lastCommentInArgContext=YY_START;
+ if (yytext[1]=='/')
+ BEGIN( CopyArgCommentLine );
+ else
+ BEGIN( CopyArgComment );
+ }
+ }
+ /* a non-special comment */
+<ReadFuncArgType,ReadTempArgs>"/**/" { /* empty comment */ }
+<ReadFuncArgType,ReadTempArgs>"/*" {
+ yyextra->lastCContext = YY_START;
+ BEGIN( SkipComment );
+ }
+<ReadFuncArgType,ReadTempArgs>"//" {
+ yyextra->lastCContext = YY_START;
+ BEGIN( SkipCxxComment );
+ }
/*
-<ReadFuncArgType,ReadTempArgs>"'#" { if (yyextra->insidePHP)
+<ReadFuncArgType,ReadTempArgs>"'#" { if (yyextra->insidePHP)
REJECT;
- *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
-<ReadFuncArgType,ReadTempArgs>"#" {
- if (!yyextra->insidePHP)
- REJECT;
- yyextra->lastCContext = YY_START;
- BEGIN( SkipCxxComment );
- }
+ *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+<ReadFuncArgType,ReadTempArgs>"#" {
+ if (!yyextra->insidePHP)
+ REJECT;
+ yyextra->lastCContext = YY_START;
+ BEGIN( SkipCxxComment );
+ }
*/
- /* ')' followed by a special comment */
-<ReadFuncArgType>")"{BN}*("/*"[*!]|"//"[/!])"<" {
- lineCount(yyscanner);
+ /* ')' followed by a special comment */
+<ReadFuncArgType>")"{BN}*("/*"[*!]|"//"[/!])"<" {
+ lineCount(yyscanner);
if (yyextra->currentArgumentContext==DefineEnd)
- {
- // for defines we interpret a comment
- // as documentation for the define
- int i;for (i=(int)yyleng-1;i>0;i--)
- {
- unput(yytext[i]);
- }
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
+ {
+ // for defines we interpret a comment
+ // as documentation for the define
+ int i;for (i=(int)yyleng-1;i>0;i--)
+ {
+ unput(yytext[i]);
+ }
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
- BEGIN( yyextra->currentArgumentContext );
- }
- else
- {
- // for functions we interpret a comment
- // as documentation for the yyextra->last argument
- yyextra->lastCopyArgChar=*yytext;
- QCString text=&yytext[1];
- text=text.stripWhiteSpace();
- yyextra->lastCommentInArgContext=YY_START;
- yyextra->fullArgString+=text;
- if (text.find("//")!=-1)
- BEGIN( CopyArgCommentLine );
- else
- BEGIN( CopyArgComment );
- }
- }
-<CopyArgComment>^{B}*"*"+/{BN}+
-<CopyArgComment>[^\n\\\@\*]+ { yyextra->fullArgString+=yytext; }
-<CopyArgComment>"*/" { yyextra->fullArgString+=yytext;
- if (yyextra->lastCopyArgChar!=0)
- unput(yyextra->lastCopyArgChar);
- BEGIN( yyextra->lastCommentInArgContext );
- }
-<CopyArgCommentLine>\n { yyextra->fullArgString+=yytext;
+ BEGIN( yyextra->currentArgumentContext );
+ }
+ else
+ {
+ // for functions we interpret a comment
+ // as documentation for the yyextra->last argument
+ yyextra->lastCopyArgChar=*yytext;
+ QCString text=&yytext[1];
+ text=text.stripWhiteSpace();
+ yyextra->lastCommentInArgContext=YY_START;
+ yyextra->fullArgString+=text;
+ if (text.find("//")!=-1)
+ BEGIN( CopyArgCommentLine );
+ else
+ BEGIN( CopyArgComment );
+ }
+ }
+<CopyArgComment>^{B}*"*"+/{BN}+
+<CopyArgComment>[^\n\\\@\*]+ { yyextra->fullArgString+=yytext; }
+<CopyArgComment>"*/" { yyextra->fullArgString+=yytext;
+ if (yyextra->lastCopyArgChar!=0)
+ unput(yyextra->lastCopyArgChar);
+ BEGIN( yyextra->lastCommentInArgContext );
+ }
+<CopyArgCommentLine>\n { yyextra->fullArgString+=yytext;
lineCount(yyscanner);
- if (yyextra->lastCopyArgChar!=0)
- unput(yyextra->lastCopyArgChar);
- BEGIN( yyextra->lastCommentInArgContext );
- }
-<CopyArgCommentLine>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
- yyextra->docBlockName=&yytext[1];
- yyextra->fullArgString+=yytext;
- BEGIN(CopyArgVerbatim);
- }
-<CopyArgCommentLine>{CMD}("f$"|"f["|"f{") {
- yyextra->docBlockName=&yytext[1];
- if (yyextra->docBlockName.at(1)=='[')
- {
- yyextra->docBlockName.at(1)='}';
- }
- if (yyextra->docBlockName.at(1)=='{')
- {
- yyextra->docBlockName.at(1)='}';
- }
- yyextra->fullArgString+=yytext;
- BEGIN(CopyArgVerbatim);
+ if (yyextra->lastCopyArgChar!=0)
+ unput(yyextra->lastCopyArgChar);
+ BEGIN( yyextra->lastCommentInArgContext );
+ }
+<CopyArgCommentLine>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
+ yyextra->docBlockName=&yytext[1];
+ yyextra->fullArgString+=yytext;
+ BEGIN(CopyArgVerbatim);
+ }
+<CopyArgCommentLine>{CMD}("f$"|"f["|"f{") {
+ yyextra->docBlockName=&yytext[1];
+ if (yyextra->docBlockName.at(1)=='[')
+ {
+ yyextra->docBlockName.at(1)='}';
+ }
+ if (yyextra->docBlockName.at(1)=='{')
+ {
+ yyextra->docBlockName.at(1)='}';
+ }
+ yyextra->fullArgString+=yytext;
+ BEGIN(CopyArgVerbatim);
}
<CopyArgVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9\-] { // end of verbatim block
- yyextra->fullArgString+=yytext;
- if (yytext[1]=='f') // end of formula
- {
- BEGIN(CopyArgCommentLine);
- }
- if (&yytext[4]==yyextra->docBlockName)
- {
- BEGIN(CopyArgCommentLine);
- }
- }
-<CopyArgCommentLine>[^\\\@\n]+ { yyextra->fullArgString+=yytext; }
-<CopyArgCommentLine>. { yyextra->fullArgString+=*yytext; }
-<CopyArgComment,CopyArgVerbatim>\n { yyextra->fullArgString+=*yytext; lineCount(yyscanner); }
-<CopyArgComment,CopyArgVerbatim>. { yyextra->fullArgString+=*yytext; }
+ yyextra->fullArgString+=yytext;
+ if (yytext[1]=='f') // end of formula
+ {
+ BEGIN(CopyArgCommentLine);
+ }
+ if (&yytext[4]==yyextra->docBlockName)
+ {
+ BEGIN(CopyArgCommentLine);
+ }
+ }
+<CopyArgCommentLine>[^\\\@\n]+ { yyextra->fullArgString+=yytext; }
+<CopyArgCommentLine>. { yyextra->fullArgString+=*yytext; }
+<CopyArgComment,CopyArgVerbatim>\n { yyextra->fullArgString+=*yytext; lineCount(yyscanner); }
+<CopyArgComment,CopyArgVerbatim>. { yyextra->fullArgString+=*yytext; }
<CopyArgComment>{CMD}("brief"|"short"){B}+ {
- warn(yyextra->yyFileName,yyextra->yyLineNr,
- "Ignoring %cbrief command inside argument documentation",*yytext
- );
+ warn(yyextra->yyFileName,yyextra->yyLineNr,
+ "Ignoring %cbrief command inside argument documentation",*yytext
+ );
yyextra->fullArgString+=' ';
}
-<ReadTempArgs>"<" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- yyextra->argSharpCount=1;
- BEGIN( CopyArgSharp );
- }
-<ReadTempArgs>">" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- //printf("end template list '%s'\n",yyextra->copyArgString->data());
+<ReadTempArgs>"<" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ yyextra->argSharpCount=1;
+ BEGIN( CopyArgSharp );
+ }
+<ReadTempArgs>">" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ //printf("end template list '%s'\n",yyextra->copyArgString->data());
*yyextra->currentArgumentList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
- BEGIN( yyextra->currentArgumentContext );
- }
-<CopyArgRound>"(" {
- yyextra->argRoundCount++;
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- }
-<CopyArgRound>")" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- if (yyextra->argRoundCount>0)
- yyextra->argRoundCount--;
- else
- BEGIN( yyextra->lastCopyArgContext );
- }
+ BEGIN( yyextra->currentArgumentContext );
+ }
+<CopyArgRound>"(" {
+ yyextra->argRoundCount++;
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ }
+<CopyArgRound>")" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ if (yyextra->argRoundCount>0)
+ yyextra->argRoundCount--;
+ else
+ BEGIN( yyextra->lastCopyArgContext );
+ }
<CopyArgSharp>"(" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- yyextra->argRoundCount=0;
- yyextra->lastCopyArgContext = YY_START;
- BEGIN( CopyArgRound );
- }
-<CopyArgSharp>"<" {
- yyextra->argSharpCount++;
- //printf("yyextra->argSharpCount++=%d copy\n",yyextra->argSharpCount);
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- }
-<CopyArgSharp>">" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- yyextra->argSharpCount--;
- if (yyextra->argSharpCount>0)
- {
- //printf("yyextra->argSharpCount--=%d copy\n",yyextra->argSharpCount);
- }
- else
- {
- BEGIN( ReadTempArgs );
- //printf("end of yyextra->argSharpCount\n");
- }
- }
-<CopyArgString,CopyArgPHPString>\\. {
- *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
-<CopyArgString>\" {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- BEGIN( yyextra->lastCopyArgStringContext );
- }
-<CopyArgPHPString>\' {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- BEGIN( yyextra->lastCopyArgStringContext );
- }
-<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>{CHARLIT} {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ yyextra->argRoundCount=0;
+ yyextra->lastCopyArgContext = YY_START;
+ BEGIN( CopyArgRound );
+ }
+<CopyArgSharp>"<" {
+ yyextra->argSharpCount++;
+ //printf("yyextra->argSharpCount++=%d copy\n",yyextra->argSharpCount);
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ }
+<CopyArgSharp>">" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ yyextra->argSharpCount--;
+ if (yyextra->argSharpCount>0)
+ {
+ //printf("yyextra->argSharpCount--=%d copy\n",yyextra->argSharpCount);
+ }
+ else
+ {
+ BEGIN( ReadTempArgs );
+ //printf("end of yyextra->argSharpCount\n");
+ }
+ }
+<CopyArgString,CopyArgPHPString>\\. {
+ *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+<CopyArgString>\" {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ BEGIN( yyextra->lastCopyArgStringContext );
+ }
+<CopyArgPHPString>\' {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ BEGIN( yyextra->lastCopyArgStringContext );
+ }
+<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>{CHARLIT} {
+ if (yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
+ }
+ }
+<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>\' {
+ *yyextra->copyArgString+=yytext;
+ yyextra->fullArgString+=yytext;
if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- }
- }
-<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSharp>\' {
- *yyextra->copyArgString+=yytext;
- yyextra->fullArgString+=yytext;
- if (yyextra->insidePHP)
- {
- yyextra->lastCopyArgStringContext=YY_START;
- BEGIN(CopyArgPHPString);
- }
- }
-<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>\n {
+ {
+ yyextra->lastCopyArgStringContext=YY_START;
+ BEGIN(CopyArgPHPString);
+ }
+ }
+<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>\n {
lineCount(yyscanner);
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- }
-<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>. {
- *yyextra->copyArgString+=*yytext;
- yyextra->fullArgString+=*yytext;
- }
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ }
+<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSharp>. {
+ *yyextra->copyArgString+=*yytext;
+ yyextra->fullArgString+=*yytext;
+ }
/*------------------------------------------------------------------------*/
-<FuncRound>"(" { yyextra->current->args += *yytext ;
- ++yyextra->roundCount ;
- }
-<FuncRound>")" { yyextra->current->args += *yytext ;
- if ( yyextra->roundCount )
- --yyextra->roundCount ;
- else
- BEGIN( FuncQual ) ;
- }
+<FuncRound>"(" { yyextra->current->args += *yytext ;
+ ++yyextra->roundCount ;
+ }
+<FuncRound>")" { yyextra->current->args += *yytext ;
+ if ( yyextra->roundCount )
+ --yyextra->roundCount ;
+ else
+ BEGIN( FuncQual ) ;
+ }
/*
-<FuncQual>"#" { if (yyextra->insidePHP)
- REJECT;
- yyextra->lastCPPContext = YY_START;
- BEGIN(SkipCPP);
- }
+<FuncQual>"#" { if (yyextra->insidePHP)
+ REJECT;
+ yyextra->lastCPPContext = YY_START;
+ BEGIN(SkipCPP);
+ }
*/
<FuncQual>[{:;,] {
- if ( qstrcmp(yytext,";")==0 &&
- yyextra->insidePHP &&
- !containsWord(yyextra->current->type,"function") )
+ if ( qstrcmp(yytext,";")==0 &&
+ yyextra->insidePHP &&
+ !containsWord(yyextra->current->type,"function") )
{
yyextra->current->reset();
initEntry(yyscanner);
@@ -4500,54 +4500,54 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
}
<FuncQual>{BN}*"abstract"{BN}* { // pure virtual member function
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
yyextra->current->virt = Pure;
- yyextra->current->args += " override ";
+ yyextra->current->args += " override ";
}
<FuncQual,TrailingReturn>{BN}*"override"{BN}* { // C++11 overridden virtual member function
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
yyextra->current->spec |= Entry::Override;
- yyextra->current->args += " override ";
+ yyextra->current->args += " override ";
BEGIN(FuncQual);
}
<FuncQual,TrailingReturn>{BN}*"final"{BN}* { // C++11 final method
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
yyextra->current->spec |= Entry::Final;
- yyextra->current->args += " final ";
+ yyextra->current->args += " final ";
BEGIN(FuncQual);
}
<FuncQual>{BN}*"sealed"{BN}* { // sealed member function
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
yyextra->current->spec |= Entry::Sealed;
- yyextra->current->args += " sealed ";
+ yyextra->current->args += " sealed ";
}
<FuncQual>{BN}*"new"{BN}* { // new member function
- lineCount(yyscanner) ;
+ lineCount(yyscanner) ;
yyextra->current->spec |= Entry::New;
- yyextra->current->args += " new ";
- }
-<FuncQual>{BN}*"const"{BN}* { // const member function
- lineCount(yyscanner) ;
- yyextra->current->args += " const ";
- yyextra->current->argList.setConstSpecifier(TRUE);
- }
-<FuncQual>{BN}*"volatile"{BN}* { // volatile member function
- lineCount(yyscanner) ;
- yyextra->current->args += " volatile ";
- yyextra->current->argList.setVolatileSpecifier(TRUE);
- }
-<FuncQual>{BN}*"noexcept"{BN}* { // noexcept qualifier
- lineCount(yyscanner) ;
- yyextra->current->args += " noexcept ";
- yyextra->current->spec |= Entry::NoExcept;
- }
-<FuncQual>{BN}*"noexcept"{BN}*"(" { // noexcept expression
- lineCount(yyscanner) ;
- yyextra->current->args += " noexcept(";
- yyextra->current->spec |= Entry::NoExcept;
- yyextra->lastRoundContext=FuncQual;
- yyextra->pCopyRoundString=&yyextra->current->args;
- yyextra->roundCount=0;
+ yyextra->current->args += " new ";
+ }
+<FuncQual>{BN}*"const"{BN}* { // const member function
+ lineCount(yyscanner) ;
+ yyextra->current->args += " const ";
+ yyextra->current->argList.setConstSpecifier(TRUE);
+ }
+<FuncQual>{BN}*"volatile"{BN}* { // volatile member function
+ lineCount(yyscanner) ;
+ yyextra->current->args += " volatile ";
+ yyextra->current->argList.setVolatileSpecifier(TRUE);
+ }
+<FuncQual>{BN}*"noexcept"{BN}* { // noexcept qualifier
+ lineCount(yyscanner) ;
+ yyextra->current->args += " noexcept ";
+ yyextra->current->spec |= Entry::NoExcept;
+ }
+<FuncQual>{BN}*"noexcept"{BN}*"(" { // noexcept expression
+ lineCount(yyscanner) ;
+ yyextra->current->args += " noexcept(";
+ yyextra->current->spec |= Entry::NoExcept;
+ yyextra->lastRoundContext=FuncQual;
+ yyextra->pCopyRoundString=&yyextra->current->args;
+ yyextra->roundCount=0;
BEGIN(CopyRound);
}
<FuncQual>{BN}*"&" {
@@ -4559,36 +4559,57 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->argList.setRefQualifier(RefQualifierRValue);
}
-<FuncQual,TrailingReturn>{BN}*"="{BN}*"0"{BN}* { // pure virtual member function
- lineCount(yyscanner) ;
- yyextra->current->args += " = 0";
- yyextra->current->virt = Pure;
- yyextra->current->argList.setPureSpecifier(TRUE);
+<FuncQual,TrailingReturn>{BN}*"="{BN}*"0"{BN}* { // pure virtual member function
+ lineCount(yyscanner) ;
+ yyextra->current->args += " = 0";
+ yyextra->current->virt = Pure;
+ yyextra->current->argList.setPureSpecifier(TRUE);
BEGIN(FuncQual);
- }
+ }
<FuncQual,TrailingReturn>{BN}*"="{BN}*"delete"{BN}* { // C++11 explicitly delete member
lineCount(yyscanner);
yyextra->current->args += " = delete";
- yyextra->current->spec |= Entry::Delete;
- yyextra->current->argList.setIsDeleted(TRUE);
+ yyextra->current->spec |= Entry::Delete;
+ yyextra->current->argList.setIsDeleted(TRUE);
BEGIN(FuncQual);
}
<FuncQual,TrailingReturn>{BN}*"="{BN}*"default"{BN}* { // C++11 explicitly defaulted constructor/assignment operator
lineCount(yyscanner);
yyextra->current->args += " = default";
- yyextra->current->spec |= Entry::Default;
+ yyextra->current->spec |= Entry::Default;
BEGIN(FuncQual);
}
<FuncQual>{BN}*"->"{BN}* {
lineCount(yyscanner);
yyextra->current->argList.setTrailingReturnType(" -> ");
yyextra->current->args += " -> ";
+ yyextra->roundCount=0;
BEGIN(TrailingReturn);
}
<TrailingReturn>[{;] {
+ if (yyextra->roundCount>0) REJECT;
unput(*yytext);
BEGIN(FuncQual);
}
+<TrailingReturn>"(" {
+ yyextra->roundCount++;
+ yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
+ yyextra->current->args+=yytext;
+ }
+<TrailingReturn>")" {
+ if (yyextra->roundCount>0)
+ {
+ yyextra->roundCount--;
+ }
+ else
+ {
+ warn(yyextra->yyFileName,yyextra->yyLineNr,
+ "Found ')' without opening '(' for trailing return type '%s)...'",
+ yyextra->current->argList.trailingReturnType().data());
+ }
+ yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
+ yyextra->current->args+=yytext;
+ }
<TrailingReturn>. {
yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
yyextra->current->args+=yytext;
@@ -4598,207 +4619,207 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
yyextra->current->args+=' ';
}
-<FuncRound,FuncFunc>{BN}*","{BN}* {
- lineCount(yyscanner) ;
- yyextra->current->args += ", " ;
- }
-<FuncQual,FuncRound,FuncFunc>{BN}+ {
- lineCount(yyscanner) ;
- yyextra->current->args += ' ' ;
- }
+<FuncRound,FuncFunc>{BN}*","{BN}* {
+ lineCount(yyscanner) ;
+ yyextra->current->args += ", " ;
+ }
+<FuncQual,FuncRound,FuncFunc>{BN}+ {
+ lineCount(yyscanner) ;
+ yyextra->current->args += ' ' ;
+ }
<Function,FuncQual,FuncRound,FuncFunc>"#" { if (yyextra->insidePHP)
- REJECT;
- yyextra->lastCPPContext = YY_START;
- BEGIN(SkipCPP);
- }
-<FuncQual>"=" {
- if (yyextra->insideCli &&
- (yyextra->current_root->section&Entry::COMPOUND_MASK)
- )
- {
- BEGIN(CliOverride);
- }
- else
- {
+ REJECT;
+ yyextra->lastCPPContext = YY_START;
+ BEGIN(SkipCPP);
+ }
+<FuncQual>"=" {
+ if (yyextra->insideCli &&
+ (yyextra->current_root->section&Entry::COMPOUND_MASK)
+ )
+ {
+ BEGIN(CliOverride);
+ }
+ else
+ {
// typically an initialized function pointer
- yyextra->lastInitializerContext=YY_START;
- yyextra->initBracketCount=0;
+ yyextra->lastInitializerContext=YY_START;
+ yyextra->initBracketCount=0;
yyextra->current->initializer = yytext;
- BEGIN(ReadInitializer);
- }
- }
-<CliOverride>{ID} {
- }
-<CliOverride>"{" {
- unput(*yytext);
- BEGIN(FuncQual);
- }
-<CliOverride>\n {
+ BEGIN(ReadInitializer);
+ }
+ }
+<CliOverride>{ID} {
+ }
+<CliOverride>"{" {
+ unput(*yytext);
+ BEGIN(FuncQual);
+ }
+<CliOverride>\n {
lineCount(yyscanner);
- }
-<CliOverride>. {
- }
-<FuncPtrInit>[{;] {
- unput(*yytext);
- BEGIN(FuncQual);
- }
-<FuncPtrInit>\" {
- yyextra->current->args += *yytext;
- yyextra->pCopyQuotedString=&yyextra->current->args;
- yyextra->lastStringContext=FuncPtrInit;
- BEGIN(CopyString);
- }
-<FuncPtrInit>\' {
- yyextra->current->args += *yytext;
- if (yyextra->insidePHP)
- {
- yyextra->pCopyQuotedString=&yyextra->current->args;
- yyextra->lastStringContext=FuncPtrInit;
- BEGIN(CopyPHPString);
- }
- }
-<FuncPtrInit>{CHARLIT} {
+ }
+<CliOverride>. {
+ }
+<FuncPtrInit>[{;] {
+ unput(*yytext);
+ BEGIN(FuncQual);
+ }
+<FuncPtrInit>\" {
+ yyextra->current->args += *yytext;
+ yyextra->pCopyQuotedString=&yyextra->current->args;
+ yyextra->lastStringContext=FuncPtrInit;
+ BEGIN(CopyString);
+ }
+<FuncPtrInit>\' {
+ yyextra->current->args += *yytext;
if (yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
- yyextra->current->args += yytext;
- }
- }
-<FuncPtrInit>{ID} {
- yyextra->current->args += yytext;
- }
-<FuncPtrInit>. {
- yyextra->current->args += *yytext;
- }
-<FuncPtrInit>\n {
- yyextra->current->args += *yytext;
+ {
+ yyextra->pCopyQuotedString=&yyextra->current->args;
+ yyextra->lastStringContext=FuncPtrInit;
+ BEGIN(CopyPHPString);
+ }
+ }
+<FuncPtrInit>{CHARLIT} {
+ if (yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
+ yyextra->current->args += yytext;
+ }
+ }
+<FuncPtrInit>{ID} {
+ yyextra->current->args += yytext;
+ }
+<FuncPtrInit>. {
+ yyextra->current->args += *yytext;
+ }
+<FuncPtrInit>\n {
+ yyextra->current->args += *yytext;
lineCount(yyscanner);
- }
-<FuncQual>{ID} { // typically a K&R style C function
+ }
+<FuncQual>{ID} { // typically a K&R style C function
if (yyextra->insideCS && qstrcmp(yytext,"where")==0)
- {
- // type constraint for a method
- yyextra->current->typeConstr.clear();
- yyextra->current->typeConstr.push_back(Argument());
- yyextra->lastCSConstraint = YY_START;
- BEGIN( CSConstraintName );
- }
- else if (checkForKnRstyleC(yyscanner))
- {
- yyextra->current->args = yytext;
- yyextra->oldStyleArgType.resize(0);
- BEGIN(OldStyleArgs);
- }
- else
- {
- yyextra->current->args += yytext;
- }
- }
-<OldStyleArgs>[,;] {
- QCString oldStyleArgPtr;
- QCString oldStyleArgName;
- splitKnRArg(yyscanner,oldStyleArgPtr,oldStyleArgName);
- QCString doc,brief;
- if (yyextra->current->doc!=yyextra->docBackup)
- {
+ {
+ // type constraint for a method
+ yyextra->current->typeConstr.clear();
+ yyextra->current->typeConstr.push_back(Argument());
+ yyextra->lastCSConstraint = YY_START;
+ BEGIN( CSConstraintName );
+ }
+ else if (checkForKnRstyleC(yyscanner))
+ {
+ yyextra->current->args = yytext;
+ yyextra->oldStyleArgType.resize(0);
+ BEGIN(OldStyleArgs);
+ }
+ else
+ {
+ yyextra->current->args += yytext;
+ }
+ }
+<OldStyleArgs>[,;] {
+ QCString oldStyleArgPtr;
+ QCString oldStyleArgName;
+ splitKnRArg(yyscanner,oldStyleArgPtr,oldStyleArgName);
+ QCString doc,brief;
+ if (yyextra->current->doc!=yyextra->docBackup)
+ {
doc=yyextra->current->doc.copy();
- yyextra->current->doc=yyextra->docBackup;
- }
- if (yyextra->current->brief!=yyextra->briefBackup)
- {
+ yyextra->current->doc=yyextra->docBackup;
+ }
+ if (yyextra->current->brief!=yyextra->briefBackup)
+ {
brief=yyextra->current->brief.copy();
- yyextra->current->brief=yyextra->briefBackup;
- }
- addKnRArgInfo(yyscanner,yyextra->oldStyleArgType+oldStyleArgPtr,
- oldStyleArgName,brief,doc);
- yyextra->current->args.resize(0);
- if (*yytext==';') yyextra->oldStyleArgType.resize(0);
- }
-<OldStyleArgs>{ID} { yyextra->current->args += yytext; }
-<OldStyleArgs>"{" {
+ yyextra->current->brief=yyextra->briefBackup;
+ }
+ addKnRArgInfo(yyscanner,yyextra->oldStyleArgType+oldStyleArgPtr,
+ oldStyleArgName,brief,doc);
+ yyextra->current->args.resize(0);
+ if (*yytext==';') yyextra->oldStyleArgType.resize(0);
+ }
+<OldStyleArgs>{ID} { yyextra->current->args += yytext; }
+<OldStyleArgs>"{" {
if (yyextra->current->argList.empty())
{
yyextra->current->argList.setNoParameters(TRUE);
}
- yyextra->current->args = argListToString(yyextra->current->argList);
- unput('{');
- BEGIN(FuncQual);
- }
-<OldStyleArgs>. { yyextra->current->args += *yytext; }
-<FuncQual,FuncRound,FuncFunc>. { yyextra->current->args += *yytext; }
-<FuncQual>{BN}*"try:" |
-<FuncQual>{BN}*"try"{BN}+ { /* try-function-block */
- yyextra->insideTryBlock=TRUE;
- lineCount(yyscanner);
- if (yytext[yyleng-1]==':')
- {
- unput(':');
- BEGIN( Function );
- }
- }
-<FuncQual>{BN}*"throw"{BN}*"(" { // C++ style throw clause
- yyextra->current->exception = " throw (" ;
- yyextra->roundCount=0;
- lineCount(yyscanner) ;
- BEGIN( ExcpRound ) ;
- }
+ yyextra->current->args = argListToString(yyextra->current->argList);
+ unput('{');
+ BEGIN(FuncQual);
+ }
+<OldStyleArgs>. { yyextra->current->args += *yytext; }
+<FuncQual,FuncRound,FuncFunc>. { yyextra->current->args += *yytext; }
+<FuncQual>{BN}*"try:" |
+<FuncQual>{BN}*"try"{BN}+ { /* try-function-block */
+ yyextra->insideTryBlock=TRUE;
+ lineCount(yyscanner);
+ if (yytext[yyleng-1]==':')
+ {
+ unput(':');
+ BEGIN( Function );
+ }
+ }
+<FuncQual>{BN}*"throw"{BN}*"(" { // C++ style throw clause
+ yyextra->current->exception = " throw (" ;
+ yyextra->roundCount=0;
+ lineCount(yyscanner) ;
+ BEGIN( ExcpRound ) ;
+ }
<FuncQual>{BN}*"raises"{BN}*"(" {
- yyextra->current->exception = " raises (" ;
- lineCount(yyscanner) ;
- yyextra->roundCount=0;
- BEGIN( ExcpRound ) ;
- }
-<FuncQual>{BN}*"throws"{BN}+ { // Java style throw clause
- yyextra->current->exception = " throws " ;
- lineCount(yyscanner) ;
- BEGIN( ExcpList );
- }
-<ExcpRound>"(" { yyextra->current->exception += *yytext ;
- ++yyextra->roundCount ;
- }
-<ExcpRound>")" { yyextra->current->exception += *yytext ;
- if ( yyextra->roundCount )
- --yyextra->roundCount ;
- else
- BEGIN( FuncQual ) ;
- }
-<ExcpRound>. {
- yyextra->current->exception += *yytext;
- }
-<ExcpList>"{" {
- unput('{'); BEGIN( FuncQual );
- }
-<ExcpList>";" {
- unput(';'); BEGIN( FuncQual );
- }
-<ExcpList>"\n" {
- yyextra->current->exception += ' ';
+ yyextra->current->exception = " raises (" ;
+ lineCount(yyscanner) ;
+ yyextra->roundCount=0;
+ BEGIN( ExcpRound ) ;
+ }
+<FuncQual>{BN}*"throws"{BN}+ { // Java style throw clause
+ yyextra->current->exception = " throws " ;
+ lineCount(yyscanner) ;
+ BEGIN( ExcpList );
+ }
+<ExcpRound>"(" { yyextra->current->exception += *yytext ;
+ ++yyextra->roundCount ;
+ }
+<ExcpRound>")" { yyextra->current->exception += *yytext ;
+ if ( yyextra->roundCount )
+ --yyextra->roundCount ;
+ else
+ BEGIN( FuncQual ) ;
+ }
+<ExcpRound>. {
+ yyextra->current->exception += *yytext;
+ }
+<ExcpList>"{" {
+ unput('{'); BEGIN( FuncQual );
+ }
+<ExcpList>";" {
+ unput(';'); BEGIN( FuncQual );
+ }
+<ExcpList>"\n" {
+ yyextra->current->exception += ' ';
lineCount(yyscanner);
- }
-<ExcpList>. {
- yyextra->current->exception += *yytext;
- }
-<Function>"(" { yyextra->current->type += yyextra->current->name ;
- yyextra->current->name = yyextra->current->args ;
- yyextra->current->args = yytext ;
- yyextra->roundCount=0;
- BEGIN( FuncRound ) ;
- }
-<Function>":" {
- if (!yyextra->insidePHP) BEGIN(SkipInits);
- }
-<Function>[;{,] {
- yyextra->current->name=yyextra->current->name.simplifyWhiteSpace();
- yyextra->current->type=yyextra->current->type.simplifyWhiteSpace();
- yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
- // was: yyextra->current->args.simplifyWhiteSpace();
- yyextra->current->fileName = yyextra->yyFileName;
- yyextra->current->startLine = yyextra->yyBegLineNr;
- yyextra->current->startColumn = yyextra->yyBegColNr;
- static QRegExp re("([^)]*[*&][^)]*)"); // (...*...)
+ }
+<ExcpList>. {
+ yyextra->current->exception += *yytext;
+ }
+<Function>"(" { yyextra->current->type += yyextra->current->name ;
+ yyextra->current->name = yyextra->current->args ;
+ yyextra->current->args = yytext ;
+ yyextra->roundCount=0;
+ BEGIN( FuncRound ) ;
+ }
+<Function>":" {
+ if (!yyextra->insidePHP) BEGIN(SkipInits);
+ }
+<Function>[;{,] {
+ yyextra->current->name=yyextra->current->name.simplifyWhiteSpace();
+ yyextra->current->type=yyextra->current->type.simplifyWhiteSpace();
+ yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
+ // was: yyextra->current->args.simplifyWhiteSpace();
+ yyextra->current->fileName = yyextra->yyFileName;
+ yyextra->current->startLine = yyextra->yyBegLineNr;
+ yyextra->current->startColumn = yyextra->yyBegColNr;
+ static QRegExp re("([^)]*[*&][^)]*)"); // (...*...)
int ts=yyextra->current->type.find('<');
int te=yyextra->current->type.findRev('>');
int ti=yyextra->current->type.find(re,0);
@@ -4807,117 +4828,117 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
bool isFunction = ti==-1 || // not a (...*...) pattern
(ts!=-1 && ts<te && ts<ti && ti<te); // (...*...) is part of a template argument list
bool isVariable = (!yyextra->current->type.isEmpty() &&
- (!isFunction || yyextra->current->type.left(8)=="typedef "));
+ (!isFunction || yyextra->current->type.left(8)=="typedef "));
//printf("type=%s ts=%d te=%d ti=%d isFunction=%d\n",
// yyextra->current->type.data(),ts,te,ti,isFunction);
- if (*yytext!=';' || (yyextra->current_root->section&Entry::COMPOUND_MASK) )
- {
- int tempArg=yyextra->current->name.find('<');
- QCString tempName;
- if (tempArg==-1) tempName=yyextra->current->name; else tempName=yyextra->current->name.left(tempArg);
- if (isVariable)
- {
- //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
- if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
- {
- yyextra->current->type.prepend("typedef ");
- }
- yyextra->current->section = Entry::VARIABLE_SEC ;
- }
- else
- {
- //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
- yyextra->current->section = Entry::FUNCTION_SEC ;
- yyextra->current->proto = *yytext==';';
- }
- }
- else // a global function prototype or function variable
- {
- //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
- if (isVariable)
- {
- if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
- {
- yyextra->current->type.prepend("typedef ");
- }
- //printf("Scanner.l: found function variable!\n");
- yyextra->current->section = Entry::VARIABLE_SEC;
- }
- else
- {
- //printf("Scanner.l: found prototype\n");
- yyextra->current->section = Entry::FUNCTION_SEC;
- yyextra->current->proto = TRUE;
- }
- }
- //printf("Adding entry '%s'\n",yyextra->current->name.data());
- if ( yyextra->insidePHP)
- {
- if (findAndRemoveWord(yyextra->current->type,"final"))
- {
- yyextra->current->spec |= Entry::Final;
- }
- if (findAndRemoveWord(yyextra->current->type,"abstract"))
- {
- yyextra->current->spec |= Entry::Abstract;
- }
- }
- if ( yyextra->insidePHP && !containsWord(yyextra->current->type,"function"))
- {
- initEntry(yyscanner);
- if ( *yytext == '{' )
- {
- yyextra->lastCurlyContext = FindMembers;
- yyextra->curlyCount=0;
- BEGIN( SkipCurly );
- }
- else
- {
- BEGIN( FindMembers );
- }
- }
- else
- {
- if ( yyextra->insidePHP)
- {
- findAndRemoveWord(yyextra->current->type,"function");
- }
- yyextra->previous = yyextra->current;
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- initEntry(yyscanner);
- // Objective C 2.0: Required/Optional section
- if (yyextra->previous->spec & (Entry::Optional | Entry::Required))
- {
- yyextra->current->spec |= yyextra->previous->spec & (Entry::Optional|Entry::Required);
- }
- yyextra->lastCurlyContext = FindMembers;
- if ( *yytext == ',' )
- {
- yyextra->current->type = yyextra->previous->type;
- // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
- int i=yyextra->current->type.length();
- while (i>0 && (yyextra->current->type[i-1]=='*' || yyextra->current->type[i-1]=='&' || yyextra->current->type[i-1]==' ')) i--;
- yyextra->current->type = yyextra->current->type.left(i);
- }
- if ( *yytext == '{' )
- {
- if ( !yyextra->insidePHP && (yyextra->current_root->section & Entry::COMPOUND_MASK) )
- {
- yyextra->previous->spec |= Entry::Inline;
- }
- //addToBody(yytext);
- yyextra->curlyCount=0;
- BEGIN( SkipCurly ) ;
- }
- else
- {
- if (yyextra->previous->section!=Entry::VARIABLE_SEC)
- yyextra->previous->bodyLine=-1; // a function/member declaration
- BEGIN( FindMembers ) ;
- }
- }
+ if (*yytext!=';' || (yyextra->current_root->section&Entry::COMPOUND_MASK) )
+ {
+ int tempArg=yyextra->current->name.find('<');
+ QCString tempName;
+ if (tempArg==-1) tempName=yyextra->current->name; else tempName=yyextra->current->name.left(tempArg);
+ if (isVariable)
+ {
+ //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
+ if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
+ {
+ yyextra->current->type.prepend("typedef ");
+ }
+ yyextra->current->section = Entry::VARIABLE_SEC ;
+ }
+ else
+ {
+ //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
+ yyextra->current->section = Entry::FUNCTION_SEC ;
+ yyextra->current->proto = *yytext==';';
+ }
+ }
+ else // a global function prototype or function variable
+ {
+ //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data());
+ if (isVariable)
+ {
+ if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ")
+ {
+ yyextra->current->type.prepend("typedef ");
+ }
+ //printf("Scanner.l: found function variable!\n");
+ yyextra->current->section = Entry::VARIABLE_SEC;
+ }
+ else
+ {
+ //printf("Scanner.l: found prototype\n");
+ yyextra->current->section = Entry::FUNCTION_SEC;
+ yyextra->current->proto = TRUE;
+ }
+ }
+ //printf("Adding entry '%s'\n",yyextra->current->name.data());
+ if ( yyextra->insidePHP)
+ {
+ if (findAndRemoveWord(yyextra->current->type,"final"))
+ {
+ yyextra->current->spec |= Entry::Final;
+ }
+ if (findAndRemoveWord(yyextra->current->type,"abstract"))
+ {
+ yyextra->current->spec |= Entry::Abstract;
+ }
+ }
+ if ( yyextra->insidePHP && !containsWord(yyextra->current->type,"function"))
+ {
+ initEntry(yyscanner);
+ if ( *yytext == '{' )
+ {
+ yyextra->lastCurlyContext = FindMembers;
+ yyextra->curlyCount=0;
+ BEGIN( SkipCurly );
+ }
+ else
+ {
+ BEGIN( FindMembers );
+ }
+ }
+ else
+ {
+ if ( yyextra->insidePHP)
+ {
+ findAndRemoveWord(yyextra->current->type,"function");
+ }
+ yyextra->previous = yyextra->current;
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ initEntry(yyscanner);
+ // Objective C 2.0: Required/Optional section
+ if (yyextra->previous->spec & (Entry::Optional | Entry::Required))
+ {
+ yyextra->current->spec |= yyextra->previous->spec & (Entry::Optional|Entry::Required);
+ }
+ yyextra->lastCurlyContext = FindMembers;
+ if ( *yytext == ',' )
+ {
+ yyextra->current->type = yyextra->previous->type;
+ // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
+ int i=yyextra->current->type.length();
+ while (i>0 && (yyextra->current->type[i-1]=='*' || yyextra->current->type[i-1]=='&' || yyextra->current->type[i-1]==' ')) i--;
+ yyextra->current->type = yyextra->current->type.left(i);
+ }
+ if ( *yytext == '{' )
+ {
+ if ( !yyextra->insidePHP && (yyextra->current_root->section & Entry::COMPOUND_MASK) )
+ {
+ yyextra->previous->spec |= Entry::Inline;
+ }
+ //addToBody(yytext);
+ yyextra->curlyCount=0;
+ BEGIN( SkipCurly ) ;
+ }
+ else
+ {
+ if (yyextra->previous->section!=Entry::VARIABLE_SEC)
+ yyextra->previous->bodyLine=-1; // a function/member declaration
+ BEGIN( FindMembers ) ;
+ }
+ }
}
<SkipInits>">"{BN}*"{" { // C++11 style initializer (see bug 790788)
lineCount(yyscanner);
@@ -4933,7 +4954,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
++yyextra->curlyCount;
}
<SkipC11Inits>"}" {
- if ( --yyextra->curlyCount<=0 )
+ if ( --yyextra->curlyCount<=0 )
{
BEGIN(SkipInits);
}
@@ -4941,116 +4962,116 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
<SkipC11Attribute>"]]" {
BEGIN(yyextra->lastC11AttributeContext);
}
-<SkipInits>"{" { // C++11 style initializer
- unput('{');
- BEGIN( Function );
- }
-<SkipCurly>"{" {
- //addToBody(yytext);
- ++yyextra->curlyCount ;
- }
+<SkipInits>"{" { // C++11 style initializer
+ unput('{');
+ BEGIN( Function );
+ }
+<SkipCurly>"{" {
+ //addToBody(yytext);
+ ++yyextra->curlyCount ;
+ }
<SkipCurly>"}"/{BN}*("/*!"|"/**"|"//!"|"///")"<!--" | /* see bug710917 */
-<SkipCurly>"}" {
- //addToBody(yytext);
- if( yyextra->curlyCount )
- {
- --yyextra->curlyCount ;
- }
- else
- {
- if (!yyextra->current->sli.empty() && yyextra->previous) // copy special list items
- {
+<SkipCurly>"}" {
+ //addToBody(yytext);
+ if( yyextra->curlyCount )
+ {
+ --yyextra->curlyCount ;
+ }
+ else
+ {
+ if (!yyextra->current->sli.empty() && yyextra->previous) // copy special list items
+ {
yyextra->previous->sli = yyextra->current->sli;
- yyextra->current->sli.clear();
- }
- if (yyextra->previous) yyextra->previous->endBodyLine=yyextra->yyLineNr;
- BEGIN( yyextra->lastCurlyContext ) ;
- }
- }
-<SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" {
- lineCount(yyscanner);
- if ( yyextra->curlyCount )
- {
- //addToBody(yytext);
- --yyextra->curlyCount ;
- }
- else
- {
- yyextra->current->endBodyLine=yyextra->yyLineNr;
- yyextra->tempEntry = yyextra->current; // temporarily switch to the previous entry
- yyextra->current = yyextra->previous;
-
- yyextra->docBlockContext = SkipCurlyEndDoc;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
- yyextra->docBlock.resize(0);
- yyextra->docBlockTerm = '}';
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
- }
+ yyextra->current->sli.clear();
+ }
+ if (yyextra->previous) yyextra->previous->endBodyLine=yyextra->yyLineNr;
+ BEGIN( yyextra->lastCurlyContext ) ;
+ }
+ }
+<SkipCurly>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" {
+ lineCount(yyscanner);
+ if ( yyextra->curlyCount )
+ {
+ //addToBody(yytext);
+ --yyextra->curlyCount ;
+ }
+ else
+ {
+ yyextra->current->endBodyLine=yyextra->yyLineNr;
+ yyextra->tempEntry = yyextra->current; // temporarily switch to the previous entry
+ yyextra->current = yyextra->previous;
+
+ yyextra->docBlockContext = SkipCurlyEndDoc;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ yyextra->docBlock.resize(0);
+ yyextra->docBlockTerm = '}';
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
+ }
<SkipCurlyEndDoc>"}"{BN}*("/*!"|"/**"|"//!"|"///")"<" { // desc is followed by another one
- yyextra->docBlockContext = SkipCurlyEndDoc;
- yyextra->docBlockInBody = FALSE;
- yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
- ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
- yyextra->docBlock.resize(0);
- yyextra->docBlockTerm = '}';
- if (yytext[yyleng-3]=='/')
- {
- startCommentBlock(yyscanner,TRUE);
- BEGIN( DocLine );
- }
- else
- {
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
- }
-<SkipCurlyEndDoc>"}" {
- //addToBody("}");
+ yyextra->docBlockContext = SkipCurlyEndDoc;
+ yyextra->docBlockInBody = FALSE;
+ yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
+ ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
+ yyextra->docBlock.resize(0);
+ yyextra->docBlockTerm = '}';
+ if (yytext[yyleng-3]=='/')
+ {
+ startCommentBlock(yyscanner,TRUE);
+ BEGIN( DocLine );
+ }
+ else
+ {
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+ }
+<SkipCurlyEndDoc>"}" {
+ //addToBody("}");
if (yyextra->tempEntry) // we can only switch back to yyextra->current if no new item was created
- {
- yyextra->current = yyextra->tempEntry;
- yyextra->tempEntry.reset();
- }
- BEGIN( yyextra->lastCurlyContext );
- }
-<SkipCurly>\" {
- //addToBody(yytext);
- yyextra->lastStringContext=SkipCurly;
- BEGIN( SkipString );
- }
-<SkipCurly>^{B}*"#" {
- if (yyextra->insidePHP)
- REJECT;
- //addToBody(yytext);
- BEGIN( SkipCurlyCpp );
- }
-<SkipCurly,SkipC11Inits,SkipInits,SkipC11Attribute>\n {
+ {
+ yyextra->current = yyextra->tempEntry;
+ yyextra->tempEntry.reset();
+ }
+ BEGIN( yyextra->lastCurlyContext );
+ }
+<SkipCurly>\" {
+ //addToBody(yytext);
+ yyextra->lastStringContext=SkipCurly;
+ BEGIN( SkipString );
+ }
+<SkipCurly>^{B}*"#" {
+ if (yyextra->insidePHP)
+ REJECT;
+ //addToBody(yytext);
+ BEGIN( SkipCurlyCpp );
+ }
+<SkipCurly,SkipC11Inits,SkipInits,SkipC11Attribute>\n {
lineCount(yyscanner);
- //addToBody(yytext);
- }
-<SkipCurly,SkipCurlyCpp,ReadInitializer>"<<<" {
- if (!yyextra->insidePHP)
- {
- REJECT;
- }
- else
- {
+ //addToBody(yytext);
+ }
+<SkipCurly,SkipCurlyCpp,ReadInitializer>"<<<" {
+ if (!yyextra->insidePHP)
+ {
+ REJECT;
+ }
+ else
+ {
yyextra->lastHereDocContext = YY_START;
- BEGIN(HereDoc);
- }
- }
+ BEGIN(HereDoc);
+ }
+ }
<SkipCurly,SkipCurlyCpp>{B}*{RAWBEGIN} {
QCString raw=QCString(yytext).stripWhiteSpace();
yyextra->delimiter = raw.data()+2;
@@ -5063,191 +5084,191 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ {
lineCount(yyscanner); // for yyextra->column updates
- //addToBody(yytext);
- }
-<SkipCurlyCpp>\n {
- //addToBody(yytext);
+ //addToBody(yytext);
+ }
+<SkipCurlyCpp>\n {
+ //addToBody(yytext);
lineCount(yyscanner);
- yyextra->lastCurlyContext = FindMembers;
- BEGIN( SkipCurly );
- }
-<SkipCurlyCpp>\\[\r]*"\n"[\r]* {
- //addToBody(yytext);
+ yyextra->lastCurlyContext = FindMembers;
+ BEGIN( SkipCurly );
+ }
+<SkipCurlyCpp>\\[\r]*"\n"[\r]* {
+ //addToBody(yytext);
lineCount(yyscanner);
- }
-<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"/*" {
- //addToBody(yytext);
- yyextra->lastCContext = YY_START;
- BEGIN(SkipComment);
- }
+ }
+<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"/*" {
+ //addToBody(yytext);
+ yyextra->lastCContext = YY_START;
+ BEGIN(SkipComment);
+ }
<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>"//" {
- //addToBody(yytext);
- yyextra->lastCContext = YY_START;
- BEGIN(SkipCxxComment);
- }
+ //addToBody(yytext);
+ yyextra->lastCContext = YY_START;
+ BEGIN(SkipCxxComment);
+ }
<SkipInits,SkipC11Inits,SkipC11Attribute>"(" {
yyextra->roundCount=0;
yyextra->lastSkipRoundContext=YY_START;
BEGIN(SkipRound);
}
-<SkipInits,SkipC11Inits,SkipC11Attribute>\" {
- yyextra->lastStringContext=YY_START;
- BEGIN( SkipString );
- }
-<SkipInits>; {
- warn(yyextra->yyFileName,yyextra->yyLineNr,
- "Found ';' while parsing initializer list! "
- "(doxygen could be confused by a macro call without semicolon)"
- );
- BEGIN( FindMembers );
- }
+<SkipInits,SkipC11Inits,SkipC11Attribute>\" {
+ yyextra->lastStringContext=YY_START;
+ BEGIN( SkipString );
+ }
+<SkipInits>; {
+ warn(yyextra->yyFileName,yyextra->yyLineNr,
+ "Found ';' while parsing initializer list! "
+ "(doxygen could be confused by a macro call without semicolon)"
+ );
+ BEGIN( FindMembers );
+ }
<SkipInits,SkipCurly,SkipCurlyCpp>"#" {
- if (!yyextra->insidePHP)
- REJECT;
- //addToBody(yytext);
- yyextra->lastCContext = YY_START;
- BEGIN(SkipCxxComment);
- }
+ if (!yyextra->insidePHP)
+ REJECT;
+ //addToBody(yytext);
+ yyextra->lastCContext = YY_START;
+ BEGIN(SkipCxxComment);
+ }
<SkipInits,SkipCurly,SkipCurlyCpp>@\" {
- if (!yyextra->insideCS) REJECT;
- // C# verbatim string
- yyextra->lastSkipVerbStringContext=YY_START;
- yyextra->pSkipVerbString=&yyextra->current->initializer;
- BEGIN(SkipVerbString);
- }
-<SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} {
+ if (!yyextra->insideCS) REJECT;
+ // C# verbatim string
+ yyextra->lastSkipVerbStringContext=YY_START;
+ yyextra->pSkipVerbString=&yyextra->current->initializer;
+ BEGIN(SkipVerbString);
+ }
+<SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} {
if (yyextra->insidePHP) REJECT;
}
-<SkipInits,SkipCurly,SkipCurlyCpp>\' {
- if (yyextra->insidePHP)
- {
- yyextra->lastStringContext=YY_START;
- BEGIN(SkipPHPString);
- }
- }
-<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>. { }
-<SkipString,SkipPHPString>\\. { }
-<SkipString>\" {
- BEGIN( yyextra->lastStringContext );
- }
-<SkipPHPString>\' {
- BEGIN( yyextra->lastStringContext );
- }
+<SkipInits,SkipCurly,SkipCurlyCpp>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->lastStringContext=YY_START;
+ BEGIN(SkipPHPString);
+ }
+ }
+<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>. { }
+<SkipString,SkipPHPString>\\. { }
+<SkipString>\" {
+ BEGIN( yyextra->lastStringContext );
+ }
+<SkipPHPString>\' {
+ BEGIN( yyextra->lastStringContext );
+ }
<SkipString,SkipPHPString>"/*"|"*/"|"//" { }
-<SkipString,SkipPHPString>\n {
+<SkipString,SkipPHPString>\n {
lineCount(yyscanner);
- }
-<SkipString,SkipPHPString>. { }
-<CompoundName>":" { // for "class : public base {} var;" construct, see bug 608359
- unput(':');
- BEGIN(ClassVar);
- }
-<CompoundName>";" {
- yyextra->current->section = Entry::EMPTY_SEC ;
- yyextra->current->type.resize(0) ;
- yyextra->current->name.resize(0) ;
- yyextra->current->args.resize(0) ;
- yyextra->current->argList.clear();
- BEGIN( FindMembers ) ;
- }
-<Bases>";" {
- if (yyextra->insideIDL && (yyextra->current->spec & (Entry::Singleton |
- Entry::Service)))
- {
- // in UNO IDL a service or singleton may be defined
- // completely like this: "service Foo : XFoo;"
- if (!yyextra->current->name.isEmpty() && !yyextra->current_root->name.isEmpty())
- {
- prependScope(yyscanner);
- }
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- // there can be only one base class here
- if (!yyextra->baseName.isEmpty())
- {
- yyextra->current->extends.push_back(
- BaseInfo(yyextra->baseName,Public,Normal));
- yyextra->baseName.resize(0);
- }
- yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
+ }
+<SkipString,SkipPHPString>. { }
+<CompoundName>":" { // for "class : public base {} var;" construct, see bug 608359
+ unput(':');
+ BEGIN(ClassVar);
+ }
+<CompoundName>";" {
+ yyextra->current->section = Entry::EMPTY_SEC ;
+ yyextra->current->type.resize(0) ;
+ yyextra->current->name.resize(0) ;
+ yyextra->current->args.resize(0) ;
+ yyextra->current->argList.clear();
+ BEGIN( FindMembers ) ;
+ }
+<Bases>";" {
+ if (yyextra->insideIDL && (yyextra->current->spec & (Entry::Singleton |
+ Entry::Service)))
+ {
+ // in UNO IDL a service or singleton may be defined
+ // completely like this: "service Foo : XFoo;"
+ if (!yyextra->current->name.isEmpty() && !yyextra->current_root->name.isEmpty())
+ {
+ prependScope(yyscanner);
+ }
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ // there can be only one base class here
+ if (!yyextra->baseName.isEmpty())
+ {
+ yyextra->current->extends.push_back(
+ BaseInfo(yyextra->baseName,Public,Normal));
+ yyextra->baseName.resize(0);
+ }
+ yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
initEntry(yyscanner);
- }
- else
- {
- yyextra->current->section = Entry::EMPTY_SEC ;
- yyextra->current->type.resize(0) ;
- yyextra->current->name.resize(0) ;
- yyextra->current->args.resize(0) ;
- yyextra->current->argList.clear();
- }
- BEGIN( FindMembers ) ;
- }
-<CompoundName>{SCOPENAME}/{BN}*"<" {
- yyextra->sharpCount = 0;
- yyextra->current->name = yytext ;
- if (yyextra->current->spec & Entry::Protocol)
- {
- yyextra->current->name+="-p";
- }
- lineCount(yyscanner);
- yyextra->lastClassTemplSpecContext = ClassVar;
- if (yyextra->insideObjC) // protocol list
- {
- BEGIN( ObjCProtocolList );
- }
- else if (yyextra->insideCS) // C# generic class
- {
+ }
+ else
+ {
+ yyextra->current->section = Entry::EMPTY_SEC ;
+ yyextra->current->type.resize(0) ;
+ yyextra->current->name.resize(0) ;
+ yyextra->current->args.resize(0) ;
+ yyextra->current->argList.clear();
+ }
+ BEGIN( FindMembers ) ;
+ }
+<CompoundName>{SCOPENAME}/{BN}*"<" {
+ yyextra->sharpCount = 0;
+ yyextra->current->name = yytext ;
+ if (yyextra->current->spec & Entry::Protocol)
+ {
+ yyextra->current->name+="-p";
+ }
+ lineCount(yyscanner);
+ yyextra->lastClassTemplSpecContext = ClassVar;
+ if (yyextra->insideObjC) // protocol list
+ {
+ BEGIN( ObjCProtocolList );
+ }
+ else if (yyextra->insideCS) // C# generic class
+ {
//yyextra->current->name+="-g";
- BEGIN( CSGeneric );
- }
- else // C++ template specialization
- {
- yyextra->roundCount=0;
- BEGIN( ClassTemplSpec );
- }
- }
-<CSGeneric>"<" {
- ArgumentList al;
- // check bug 612858 before enabling the next line
- //yyextra->current->spec |= Entry::Template;
- yyextra->current->tArgLists.push_back(al);
- yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
- yyextra->templateStr="<";
- yyextra->current->name += "<";
- yyextra->fullArgString = yyextra->templateStr;
- yyextra->copyArgString = &yyextra->current->name;
- //yyextra->copyArgString = &yyextra->templateStr;
- yyextra->currentArgumentContext = ClassVar;
- BEGIN( ReadTempArgs );
- }
-<ObjCProtocolList>"<" {
- yyextra->insideProtocolList=TRUE;
- BEGIN( Bases );
- }
-<ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? {
- yyextra->current->name += yytext;
- lineCount(yyscanner);
- if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
- {
- yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
- if (yyextra->current->spec & Entry::Protocol)
- { // Objective-C protocol
- unput('{'); // fake start of body
- BEGIN( ClassVar );
- }
- else
- {
- BEGIN( yyextra->lastClassTemplSpecContext );
- }
- }
- }
-<ClassTemplSpec>"<" {
- yyextra->current->name += yytext;
- if (yyextra->roundCount==0) yyextra->sharpCount++;
- }
-<ClassTemplSpec>. {
- yyextra->current->name += yytext;
- }
-<CompoundName>{SCOPENAME}{BN}*";" { // forward declaration
+ BEGIN( CSGeneric );
+ }
+ else // C++ template specialization
+ {
+ yyextra->roundCount=0;
+ BEGIN( ClassTemplSpec );
+ }
+ }
+<CSGeneric>"<" {
+ ArgumentList al;
+ // check bug 612858 before enabling the next line
+ //yyextra->current->spec |= Entry::Template;
+ yyextra->current->tArgLists.push_back(al);
+ yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
+ yyextra->templateStr="<";
+ yyextra->current->name += "<";
+ yyextra->fullArgString = yyextra->templateStr;
+ yyextra->copyArgString = &yyextra->current->name;
+ //yyextra->copyArgString = &yyextra->templateStr;
+ yyextra->currentArgumentContext = ClassVar;
+ BEGIN( ReadTempArgs );
+ }
+<ObjCProtocolList>"<" {
+ yyextra->insideProtocolList=TRUE;
+ BEGIN( Bases );
+ }
+<ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? {
+ yyextra->current->name += yytext;
+ lineCount(yyscanner);
+ if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
+ {
+ yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
+ if (yyextra->current->spec & Entry::Protocol)
+ { // Objective-C protocol
+ unput('{'); // fake start of body
+ BEGIN( ClassVar );
+ }
+ else
+ {
+ BEGIN( yyextra->lastClassTemplSpecContext );
+ }
+ }
+ }
+<ClassTemplSpec>"<" {
+ yyextra->current->name += yytext;
+ if (yyextra->roundCount==0) yyextra->sharpCount++;
+ }
+<ClassTemplSpec>. {
+ yyextra->current->name += yytext;
+ }
+<CompoundName>{SCOPENAME}{BN}*";" { // forward declaration
if (!yyextra->current->tArgLists.empty())
{
// found a forward template declaration, this has
@@ -5255,54 +5276,54 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->name = yytext;
yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
//printf("template class declaration for %s!\n",yyextra->current->name.data());
- QCString rn = yyextra->current_root->name.copy();
- //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef);
- if (!yyextra->current->name.isEmpty() && !rn.isEmpty())
- {
- prependScope(yyscanner);
- }
+ QCString rn = yyextra->current_root->name.copy();
+ //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef);
+ if (!yyextra->current->name.isEmpty() && !rn.isEmpty())
+ {
+ prependScope(yyscanner);
+ }
yyextra->current->spec|=Entry::ForwardDecl;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
}
- else if (yyextra->insideIDL &&
- (((yyextra->current_root->spec & (Entry::Interface |
- Entry::Service)) &&
- (yyextra->current->spec & Entry::Interface)) ||
- ((yyextra->current_root->spec & (Entry::Service |
- Entry::Singleton)) &&
- (yyextra->current->spec & Entry::Service))))
- {
- // interface yyextra->inside of UNO IDL service or interface
- // service yyextra->inside of UNO IDL service or singleton
- // there may be documentation on the member,
- // so do not throw it away...
- yyextra->current->name = yytext;
- yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
- yyextra->current->section = (yyextra->current->spec & Entry::Interface)
- ? Entry::EXPORTED_INTERFACE_SEC
- : Entry::INCLUDED_SERVICE_SEC;
-// yyextra->current->section = Entry::MEMBERDOC_SEC;
- yyextra->current->spec &= ~(Entry::Interface|Entry::Service); // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from different enums in this case... granted only Optional and Interface are actually valid in this context but urgh...
- yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
- }
-
- unput(';');
- yyextra->current->reset();
- initEntry(yyscanner);
+ else if (yyextra->insideIDL &&
+ (((yyextra->current_root->spec & (Entry::Interface |
+ Entry::Service)) &&
+ (yyextra->current->spec & Entry::Interface)) ||
+ ((yyextra->current_root->spec & (Entry::Service |
+ Entry::Singleton)) &&
+ (yyextra->current->spec & Entry::Service))))
+ {
+ // interface yyextra->inside of UNO IDL service or interface
+ // service yyextra->inside of UNO IDL service or singleton
+ // there may be documentation on the member,
+ // so do not throw it away...
+ yyextra->current->name = yytext;
+ yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
+ yyextra->current->section = (yyextra->current->spec & Entry::Interface)
+ ? Entry::EXPORTED_INTERFACE_SEC
+ : Entry::INCLUDED_SERVICE_SEC;
+// yyextra->current->section = Entry::MEMBERDOC_SEC;
+ yyextra->current->spec &= ~(Entry::Interface|Entry::Service); // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from different enums in this case... granted only Optional and Interface are actually valid in this context but urgh...
+ yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
+ }
+
+ unput(';');
+ yyextra->current->reset();
+ initEntry(yyscanner);
if (yyextra->insideObjC) // see bug746361
{
- yyextra->language = yyextra->current->lang = SrcLangExt_Cpp;
+ yyextra->language = yyextra->current->lang = SrcLangExt_Cpp;
yyextra->insideObjC = FALSE;
}
- if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
- {
- yyextra->current->type.prepend("typedef");
- }
- BEGIN( FindMembers );
- }
-<CompoundName>{SCOPENAME}/{BN}*"(" {
- yyextra->current->name = yytext ;
- lineCount(yyscanner);
+ if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
+ {
+ yyextra->current->type.prepend("typedef");
+ }
+ BEGIN( FindMembers );
+ }
+<CompoundName>{SCOPENAME}/{BN}*"(" {
+ yyextra->current->name = yytext ;
+ lineCount(yyscanner);
if (yyextra->insideCpp && yyextra->current->name=="alignas") // C++11
{
yyextra->lastAlignAsContext = YY_START;
@@ -5316,186 +5337,186 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
BEGIN( ClassVar );
}
- }
-<AlignAs>"(" { yyextra->roundCount=0;
- BEGIN( AlignAsEnd );
+ }
+<AlignAs>"(" { yyextra->roundCount=0;
+ BEGIN( AlignAsEnd );
}
<AlignAs>\n { lineCount(yyscanner); }
<AlignAs>.
<AlignAsEnd>"(" { yyextra->roundCount++; }
-<AlignAsEnd>")" { if (--yyextra->roundCount<0)
+<AlignAsEnd>")" { if (--yyextra->roundCount<0)
{
- BEGIN( yyextra->lastAlignAsContext );
+ BEGIN( yyextra->lastAlignAsContext );
}
}
<AlignAsEnd>\n { lineCount(yyscanner); }
<AlignAsEnd>.
-<CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line
+<CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line
// e.g. @protocol A,B;
- yyextra->current->reset();
- initEntry(yyscanner);
- }
-<CompoundName>{SCOPENAME} {
- yyextra->current->name = yytext ;
+ yyextra->current->reset();
+ initEntry(yyscanner);
+ }
+<CompoundName>{SCOPENAME} {
+ yyextra->current->name = yytext ;
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- lineCount(yyscanner);
- if (yyextra->current->spec & Entry::Protocol)
- {
- yyextra->current->name += "-p";
- }
- if ((yyextra->current->spec & Entry::Protocol) ||
- yyextra->current->section == Entry::OBJCIMPL_SEC)
- {
- unput('{'); // fake start of body
- }
- BEGIN( ClassVar );
- }
-<CompoundName>{CSSCOPENAME} { // C# style scope
- yyextra->current->name = substitute(yytext,".","::");
- lineCount(yyscanner);
- BEGIN( ClassVar );
- }
-<ClassVar>{SCOPENAME}{BN}*/"(" {
- if (yyextra->insideIDL && qstrncmp(yytext,"switch",6)==0 && !isId(yytext[6]))
- {
- // Corba IDL style union
- yyextra->roundCount=0;
- BEGIN(SkipUnionSwitch);
- }
- else
- {
- addType(yyscanner);
- yyextra->current->name = yytext;
- yyextra->current->name = yyextra->current->name.stripWhiteSpace();
- lineCount(yyscanner);
- BEGIN( FindMembers );
- }
- }
-<ClassVar>"," {
- if (yyextra->isTypedef)
- {
- // multiple types in one typedef
- unput(',');
- yyextra->current->type.prepend("typedef ");
- BEGIN(FindMembers);
- }
- else
- {
- // Multiple class forward declaration
- }
- }
+ lineCount(yyscanner);
+ if (yyextra->current->spec & Entry::Protocol)
+ {
+ yyextra->current->name += "-p";
+ }
+ if ((yyextra->current->spec & Entry::Protocol) ||
+ yyextra->current->section == Entry::OBJCIMPL_SEC)
+ {
+ unput('{'); // fake start of body
+ }
+ BEGIN( ClassVar );
+ }
+<CompoundName>{CSSCOPENAME} { // C# style scope
+ yyextra->current->name = substitute(yytext,".","::");
+ lineCount(yyscanner);
+ BEGIN( ClassVar );
+ }
+<ClassVar>{SCOPENAME}{BN}*/"(" {
+ if (yyextra->insideIDL && qstrncmp(yytext,"switch",6)==0 && !isId(yytext[6]))
+ {
+ // Corba IDL style union
+ yyextra->roundCount=0;
+ BEGIN(SkipUnionSwitch);
+ }
+ else
+ {
+ addType(yyscanner);
+ yyextra->current->name = yytext;
+ yyextra->current->name = yyextra->current->name.stripWhiteSpace();
+ lineCount(yyscanner);
+ BEGIN( FindMembers );
+ }
+ }
+<ClassVar>"," {
+ if (yyextra->isTypedef)
+ {
+ // multiple types in one typedef
+ unput(',');
+ yyextra->current->type.prepend("typedef ");
+ BEGIN(FindMembers);
+ }
+ else
+ {
+ // Multiple class forward declaration
+ }
+ }
<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
- if (yyextra->insideCli)
- {
- if (yytext[0]=='s') // sealed
- yyextra->current->spec |= Entry::SealedClass;
- else // abstract
- yyextra->current->spec |= Entry::AbstractClass;
- BEGIN( ClassVar );
- }
- else
- {
- REJECT;
- }
- }
-<ClassVar>{ID} {
+ if (yyextra->insideCli)
+ {
+ if (yytext[0]=='s') // sealed
+ yyextra->current->spec |= Entry::SealedClass;
+ else // abstract
+ yyextra->current->spec |= Entry::AbstractClass;
+ BEGIN( ClassVar );
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<ClassVar>{ID} {
if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
{
yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext);
}
- if (yyextra->insideIDL && qstrcmp(yytext,"switch")==0)
- {
- // Corba IDL style union
- yyextra->roundCount=0;
- BEGIN(SkipUnionSwitch);
- }
- else if ((yyextra->insideJava || yyextra->insidePHP || yyextra->insideJS || yyextra->insideSlice) && (qstrcmp(yytext,"implements")==0 || qstrcmp(yytext,"extends")==0))
- {
- yyextra->current->type.resize(0);
- yyextra->baseProt=Public;
+ if (yyextra->insideIDL && qstrcmp(yytext,"switch")==0)
+ {
+ // Corba IDL style union
+ yyextra->roundCount=0;
+ BEGIN(SkipUnionSwitch);
+ }
+ else if ((yyextra->insideJava || yyextra->insidePHP || yyextra->insideJS || yyextra->insideSlice) && (qstrcmp(yytext,"implements")==0 || qstrcmp(yytext,"extends")==0))
+ {
+ yyextra->current->type.resize(0);
+ yyextra->baseProt=Public;
yyextra->baseVirt=Normal;
- yyextra->baseName.resize(0);
- BEGIN( BasesProt ) ;
- }
- else if (yyextra->insideCS && qstrcmp(yytext,"where")==0) // C# type constraint
- {
+ yyextra->baseName.resize(0);
+ BEGIN( BasesProt ) ;
+ }
+ else if (yyextra->insideCS && qstrcmp(yytext,"where")==0) // C# type constraint
+ {
yyextra->current->typeConstr.clear();
- yyextra->current->typeConstr.push_back(Argument());
- yyextra->lastCSConstraint = YY_START;
- BEGIN( CSConstraintName );
- }
- else if (yyextra->insideCli && qstrcmp(yytext,"abstract")==0)
- {
- yyextra->current->spec|=Entry::Abstract;
- }
- else if (yyextra->insideCli && qstrcmp(yytext,"sealed")==0)
- {
- yyextra->current->spec|=Entry::Sealed;
- }
+ yyextra->current->typeConstr.push_back(Argument());
+ yyextra->lastCSConstraint = YY_START;
+ BEGIN( CSConstraintName );
+ }
+ else if (yyextra->insideCli && qstrcmp(yytext,"abstract")==0)
+ {
+ yyextra->current->spec|=Entry::Abstract;
+ }
+ else if (yyextra->insideCli && qstrcmp(yytext,"sealed")==0)
+ {
+ yyextra->current->spec|=Entry::Sealed;
+ }
else if (qstrcmp(yytext,"final")==0)
{
yyextra->current->spec|=Entry::Final;
}
- else
- {
- if (yyextra->current->section == Entry::ENUM_SEC)
- { // found "enum a b" -> variable
- yyextra->current->section = Entry::VARIABLE_SEC ;
- }
- yyextra->current->type += ' ' ;
- yyextra->current->type += yyextra->current->name ;
- yyextra->current->name = yytext ;
-
- if (nameIsOperator(yyextra->current->name))
- {
- BEGIN( Operator );
- }
- }
- }
-<ClassVar>[(\[] {
- if (yyextra->insideObjC && *yytext=='(') // class category
- {
- yyextra->current->name+='(';
+ else
+ {
+ if (yyextra->current->section == Entry::ENUM_SEC)
+ { // found "enum a b" -> variable
+ yyextra->current->section = Entry::VARIABLE_SEC ;
+ }
+ yyextra->current->type += ' ' ;
+ yyextra->current->type += yyextra->current->name ;
+ yyextra->current->name = yytext ;
+
+ if (nameIsOperator(yyextra->current->name))
+ {
+ BEGIN( Operator );
+ }
+ }
+ }
+<ClassVar>[(\[] {
+ if (yyextra->insideObjC && *yytext=='(') // class category
+ {
+ yyextra->current->name+='(';
//if (yyextra->current->section!=Entry::OBJCIMPL_SEC)
//{
- yyextra->current->spec|=Entry::Category;
+ yyextra->current->spec|=Entry::Category;
//}
- BEGIN( ClassCategory );
- }
- else
- {
+ BEGIN( ClassCategory );
+ }
+ else
+ {
// probably a function anyway
unput(*yytext);
- BEGIN( FindMembers );
- }
- }
+ BEGIN( FindMembers );
+ }
+ }
<CSConstraintType,CSConstraintName>"/**/" { /* empty comment */ }
-<CSConstraintType,CSConstraintName>("/*"[*!]|"//"[/!])("<"?) { // special comment
+<CSConstraintType,CSConstraintName>("/*"[*!]|"//"[/!])("<"?) { // special comment
yyextra->fullArgString.resize(0);
- yyextra->lastCopyArgChar='#'; // end marker
- yyextra->lastCommentInArgContext=YY_START;
- if (yytext[1]=='/')
- BEGIN( CopyArgCommentLine );
- else
- BEGIN( CopyArgComment );
- }
-<CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block
+ yyextra->lastCopyArgChar='#'; // end marker
+ yyextra->lastCommentInArgContext=YY_START;
+ if (yytext[1]=='/')
+ BEGIN( CopyArgCommentLine );
+ else
+ BEGIN( CopyArgComment );
+ }
+<CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block
yyextra->current->typeConstr.back().docs = yyextra->fullArgString;
- }
-<CSConstraintType>"{" { // end of type constraint reached
+ }
+<CSConstraintType>"{" { // end of type constraint reached
// parse documentation of the constraints
handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr);
- unput('{');
- BEGIN( yyextra->lastCSConstraint );
- }
+ unput('{');
+ BEGIN( yyextra->lastCSConstraint );
+ }
<CSConstraintType,CSConstraintName>";" {
handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr);
- unput(';');
- BEGIN( yyextra->lastCSConstraint );
- }
+ unput(';');
+ BEGIN( yyextra->lastCSConstraint );
+ }
<CSConstraintName>":" {
BEGIN( CSConstraintType );
}
@@ -5503,10 +5524,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
// parameter name
yyextra->current->typeConstr.back().name=yytext;
}
-<CSConstraintType>"where" { // another constraint for a different param
- yyextra->current->typeConstr.push_back(Argument());
+<CSConstraintType>"where" { // another constraint for a different param
+ yyextra->current->typeConstr.push_back(Argument());
BEGIN( CSConstraintName );
- }
+ }
<CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? {
if (yyextra->current->typeConstr.back().type.isEmpty())
// first type constraint for this parameter
@@ -5521,300 +5542,300 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
yyextra->current->typeConstr.back().type=yytext;
}
}
-<CSConstraintName,CSConstraintType>\n {
+<CSConstraintName,CSConstraintType>\n {
lineCount(yyscanner);
- }
-<CSConstraintName,CSConstraintType>. {
- }
-<ClassCategory>{ID} {
- yyextra->current->name+=yytext;
- }
-<ClassCategory>")"/{BN}*"{" {
- yyextra->current->name+=')';
- BEGIN( ClassVar );
- }
-<ClassCategory>")"/{BN}*"<" {
- yyextra->current->name+=')';
- BEGIN( ObjCProtocolList );
- }
-<ClassCategory>")" {
- yyextra->current->name+=')';
- if ((yyextra->current->section & Entry::Protocol) ||
- yyextra->current->section == Entry::OBJCIMPL_SEC)
- {
- unput('{'); // fake start of body
- }
- else // category has no variables so push back an empty body
- {
- unput('}');
- unput('{');
- }
- BEGIN( ClassVar );
- }
-<ClassVar>":" {
+ }
+<CSConstraintName,CSConstraintType>. {
+ }
+<ClassCategory>{ID} {
+ yyextra->current->name+=yytext;
+ }
+<ClassCategory>")"/{BN}*"{" {
+ yyextra->current->name+=')';
+ BEGIN( ClassVar );
+ }
+<ClassCategory>")"/{BN}*"<" {
+ yyextra->current->name+=')';
+ BEGIN( ObjCProtocolList );
+ }
+<ClassCategory>")" {
+ yyextra->current->name+=')';
+ if ((yyextra->current->section & Entry::Protocol) ||
+ yyextra->current->section == Entry::OBJCIMPL_SEC)
+ {
+ unput('{'); // fake start of body
+ }
+ else // category has no variables so push back an empty body
+ {
+ unput('}');
+ unput('{');
+ }
+ BEGIN( ClassVar );
+ }
+<ClassVar>":" {
if (yyextra->current->section==Entry::VARIABLE_SEC) // enum A B:2, see bug 748208
{
yyextra->current->bitfields+=":";
yyextra->current->args.resize(0);
BEGIN(BitFields);
}
- else if (yyextra->current->section==Entry::ENUM_SEC) // enum E:2, see bug 313527,
+ else if (yyextra->current->section==Entry::ENUM_SEC) // enum E:2, see bug 313527,
// or C++11 style enum: 'E : unsigned int {...}'
- {
- yyextra->current->args.resize(0);
- BEGIN(EnumBaseType);
- }
- else
- {
- yyextra->current->type.resize(0);
- if ((yyextra->current->spec & Entry::Interface) ||
- (yyextra->current->spec & Entry::Struct) ||
- (yyextra->current->spec & Entry::Ref) ||
- (yyextra->current->spec & Entry::Value) ||
- yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL
- )
- yyextra->baseProt=Public;
- else
- yyextra->baseProt=Private;
- yyextra->baseVirt=Normal;
- yyextra->baseName.resize(0);
- BEGIN( BasesProt ) ;
- }
- }
-<ClassVar>[;=*&] {
- unput(*yytext);
- if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
- {
- yyextra->current->type.prepend("typedef");
- }
- if ((yytext[0]=='*' || yytext[0]=='&') &&
- yyextra->current->section == Entry::ENUM_SEC)
- { // found "enum a *b" -> variable
- yyextra->current->section = Entry::VARIABLE_SEC ;
- }
- BEGIN( FindMembers );
- }
+ {
+ yyextra->current->args.resize(0);
+ BEGIN(EnumBaseType);
+ }
+ else
+ {
+ yyextra->current->type.resize(0);
+ if ((yyextra->current->spec & Entry::Interface) ||
+ (yyextra->current->spec & Entry::Struct) ||
+ (yyextra->current->spec & Entry::Ref) ||
+ (yyextra->current->spec & Entry::Value) ||
+ yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL
+ )
+ yyextra->baseProt=Public;
+ else
+ yyextra->baseProt=Private;
+ yyextra->baseVirt=Normal;
+ yyextra->baseName.resize(0);
+ BEGIN( BasesProt ) ;
+ }
+ }
+<ClassVar>[;=*&] {
+ unput(*yytext);
+ if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
+ {
+ yyextra->current->type.prepend("typedef");
+ }
+ if ((yytext[0]=='*' || yytext[0]=='&') &&
+ yyextra->current->section == Entry::ENUM_SEC)
+ { // found "enum a *b" -> variable
+ yyextra->current->section = Entry::VARIABLE_SEC ;
+ }
+ BEGIN( FindMembers );
+ }
<Bases,ClassVar>"///"/[^/] {
- if (!yyextra->insideObjC)
- {
- REJECT;
- }
- else
- {
- lineCount(yyscanner);
- yyextra->current->program+=yytext;
+ if (!yyextra->insideObjC)
+ {
+ REJECT;
+ }
+ else
+ {
+ lineCount(yyscanner);
+ yyextra->current->program+=yytext;
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->startLine = yyextra->yyLineNr ;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->curlyCount=0;
- BEGIN( ReadBodyIntf );
- }
- }
+ yyextra->current->startLine = yyextra->yyLineNr ;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->curlyCount=0;
+ BEGIN( ReadBodyIntf );
+ }
+ }
<Bases,ClassVar>("//"{B}*)?"/**"/[^/*] |
<Bases,ClassVar>("//"{B}*)?"/*!" |
<Bases,ClassVar>"//!" |
-<Bases,ClassVar>[\-+]{BN}* {
- if (!yyextra->insideObjC)
- {
- REJECT;
- }
- else
- {
- lineCount(yyscanner);
- yyextra->current->program+=yytext;
+<Bases,ClassVar>[\-+]{BN}* {
+ if (!yyextra->insideObjC)
+ {
+ REJECT;
+ }
+ else
+ {
+ lineCount(yyscanner);
+ yyextra->current->program+=yytext;
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->startLine = yyextra->yyLineNr ;
- yyextra->current->startColumn = yyextra->yyColNr;
- yyextra->curlyCount=0;
- BEGIN( ReadBodyIntf );
- }
- }
-<CompoundName,ClassVar>{B}*"{"{B}* {
+ yyextra->current->startLine = yyextra->yyLineNr ;
+ yyextra->current->startColumn = yyextra->yyColNr;
+ yyextra->curlyCount=0;
+ BEGIN( ReadBodyIntf );
+ }
+ }
+<CompoundName,ClassVar>{B}*"{"{B}* {
yyextra->current->program.resize(0);
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
- if (yyextra->current->name.isEmpty() && !yyextra->isTypedef) // anonymous compound
- {
- if (yyextra->current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces
- {
- if (Config_getBool(EXTRACT_ANON_NSPACES)) // use visible name
- {
- yyextra->current->name="anonymous_namespace{"+stripPath(yyextra->current->fileName)+"}";
- }
- else // use invisible name
- {
- yyextra->current->name.sprintf("@%d",anonNSCount.load());
- }
- }
- else
- {
- yyextra->current->name.sprintf("@%d",anonCount++);
- }
- }
- yyextra->curlyCount=0;
- if (yyextra->current_root && // not a nested struct yyextra->inside an @interface section
- !(yyextra->current_root->spec & Entry::Interface) &&
- ((yyextra->current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) ||
- yyextra->current->section==Entry::OBJCIMPL_SEC)
- ) &&
- yyextra->insideObjC
- )
- { // ObjC body that ends with @end
- BEGIN( ReadBodyIntf );
- }
- else if (yyextra->current->section==Entry::NAMESPACE_SEC)
- { // namespace body
- BEGIN( ReadNSBody );
- }
- else
- { // class body
- BEGIN( ReadBody ) ;
- }
- }
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
+ if (yyextra->current->name.isEmpty() && !yyextra->isTypedef) // anonymous compound
+ {
+ if (yyextra->current->section==Entry::NAMESPACE_SEC) // allow reopening of anonymous namespaces
+ {
+ if (Config_getBool(EXTRACT_ANON_NSPACES)) // use visible name
+ {
+ yyextra->current->name="anonymous_namespace{"+stripPath(yyextra->current->fileName)+"}";
+ }
+ else // use invisible name
+ {
+ yyextra->current->name.sprintf("@%d",anonNSCount.load());
+ }
+ }
+ else
+ {
+ yyextra->current->name.sprintf("@%d",anonCount++);
+ }
+ }
+ yyextra->curlyCount=0;
+ if (yyextra->current_root && // not a nested struct yyextra->inside an @interface section
+ !(yyextra->current_root->spec & Entry::Interface) &&
+ ((yyextra->current->spec & (Entry::Interface | Entry::Protocol | Entry::Category) ||
+ yyextra->current->section==Entry::OBJCIMPL_SEC)
+ ) &&
+ yyextra->insideObjC
+ )
+ { // ObjC body that ends with @end
+ BEGIN( ReadBodyIntf );
+ }
+ else if (yyextra->current->section==Entry::NAMESPACE_SEC)
+ { // namespace body
+ BEGIN( ReadNSBody );
+ }
+ else
+ { // class body
+ BEGIN( ReadBody ) ;
+ }
+ }
<BasesProt>"virtual"{BN}+ { lineCount(yyscanner); yyextra->baseVirt = Virtual; }
<BasesProt>"public"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Public; }
<BasesProt>"protected"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Protected; }
<BasesProt>"internal"{BN}+ { if (!yyextra->insideCli) REJECT ; lineCount(yyscanner); yyextra->baseProt = Package; }
<BasesProt>"private"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Private; }
-<BasesProt>{BN} { lineCount(yyscanner); }
-<BasesProt>. { unput(*yytext); BEGIN(Bases); }
-<Bases>("\\")?({ID}"\\")*{ID} { // PHP namespace token, not sure if interspacing is allowed but it gives problems (see bug 640847)
+<BasesProt>{BN} { lineCount(yyscanner); }
+<BasesProt>. { unput(*yytext); BEGIN(Bases); }
+<Bases>("\\")?({ID}"\\")*{ID} { // PHP namespace token, not sure if interspacing is allowed but it gives problems (see bug 640847)
if (!yyextra->insidePHP)
- {
- REJECT;
- }
- else // PHP base class of the form \Ns\Cl or Ns\Cl
- {
- lineCount(yyscanner);
- QCString bn=yytext;
- bn = substitute(bn,"\\","::");
- yyextra->baseName += bn;
- yyextra->current->args += ' ';
- yyextra->current->args += yytext;
- }
- }
-<Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} {
- lineCount(yyscanner);
+ {
+ REJECT;
+ }
+ else // PHP base class of the form \Ns\Cl or Ns\Cl
+ {
+ lineCount(yyscanner);
+ QCString bn=yytext;
+ bn = substitute(bn,"\\","::");
+ yyextra->baseName += bn;
+ yyextra->current->args += ' ';
+ yyextra->current->args += yytext;
+ }
+ }
+<Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} {
+ lineCount(yyscanner);
QCString baseScope = yytext;
if (yyextra->insideCS && baseScope.stripWhiteSpace()=="where")
- {
- // type constraint for a class
+ {
+ // type constraint for a class
yyextra->current->typeConstr.clear();
- yyextra->current->typeConstr.push_back(Argument());
- yyextra->lastCSConstraint = YY_START;
- BEGIN( CSConstraintName );
- }
- else
- {
- yyextra->baseName+=yytext;
- yyextra->current->args += ' ';
- yyextra->current->args += yytext;
- }
- }
-<Bases>{BN}*{ID}("."{ID})* { // Java style class
- QCString name = substitute(yytext,".","::");
- yyextra->baseName += name;
- yyextra->current->args += ' ';
- yyextra->current->args += name;
- }
-<ClassVar,Bases>\n/{BN}*[^{, \t\n] {
- if (!yyextra->insideObjC)
- {
- REJECT;
- }
- else
- {
+ yyextra->current->typeConstr.push_back(Argument());
+ yyextra->lastCSConstraint = YY_START;
+ BEGIN( CSConstraintName );
+ }
+ else
+ {
+ yyextra->baseName+=yytext;
+ yyextra->current->args += ' ';
+ yyextra->current->args += yytext;
+ }
+ }
+<Bases>{BN}*{ID}("."{ID})* { // Java style class
+ QCString name = substitute(yytext,".","::");
+ yyextra->baseName += name;
+ yyextra->current->args += ' ';
+ yyextra->current->args += name;
+ }
+<ClassVar,Bases>\n/{BN}*[^{, \t\n] {
+ if (!yyextra->insideObjC)
+ {
+ REJECT;
+ }
+ else
+ {
lineCount(yyscanner);
- unput('{');
- }
- }
-<ClassVar,Bases>"@end" { // empty ObjC interface
- unput('d'); // insert fake body: {}@end
- unput('n');
- unput('e');
- unput('@');
- unput('}');
- unput('{');
- }
-<ClassVar>"<" { yyextra->current->name += *yytext;
- yyextra->sharpCount=1;
- yyextra->roundCount=0;
- yyextra->lastSkipSharpContext = YY_START;
- yyextra->specName = &yyextra->current->name;
- BEGIN ( Specialization );
- }
+ unput('{');
+ }
+ }
+<ClassVar,Bases>"@end" { // empty ObjC interface
+ unput('d'); // insert fake body: {}@end
+ unput('n');
+ unput('e');
+ unput('@');
+ unput('}');
+ unput('{');
+ }
+<ClassVar>"<" { yyextra->current->name += *yytext;
+ yyextra->sharpCount=1;
+ yyextra->roundCount=0;
+ yyextra->lastSkipSharpContext = YY_START;
+ yyextra->specName = &yyextra->current->name;
+ BEGIN ( Specialization );
+ }
<Bases>{BN}*"<" {
lineCount(yyscanner);
- yyextra->sharpCount=1;
- yyextra->roundCount=0;
- yyextra->lastSkipSharpContext = YY_START;
- if (yyextra->insideObjC) // start of protocol list
- {
- unput(',');
- }
- else // template specialization
- {
- //if (yyextra->insideCS) // generic
- //{
- // yyextra->baseName+="-g";
- //}
+ yyextra->sharpCount=1;
+ yyextra->roundCount=0;
+ yyextra->lastSkipSharpContext = YY_START;
+ if (yyextra->insideObjC) // start of protocol list
+ {
+ unput(',');
+ }
+ else // template specialization
+ {
+ //if (yyextra->insideCS) // generic
+ //{
+ // yyextra->baseName+="-g";
+ //}
yyextra->templateStr = yytext;
- yyextra->specName = &yyextra->templateStr;
- BEGIN ( Specialization );
- }
- }
-<Specialization>"<" { *yyextra->specName += *yytext;
- if (yyextra->roundCount==0) yyextra->sharpCount++;
- }
-<Specialization>">" {
- *yyextra->specName += *yytext;
- if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
- {
- yyextra->baseName+=removeRedundantWhiteSpace(*yyextra->specName);
- BEGIN(yyextra->lastSkipSharpContext);
- }
- }
-<Specialization>{BN}+ { lineCount(yyscanner); *yyextra->specName +=' '; }
-<Specialization>"<<" { *yyextra->specName += yytext; }
-<Specialization>">>"/{B}*"::" { // M$ C++ extension to allow >> to close a template...
- unput('>');
- unput(' ');
- unput('>');
- }
-<Specialization>">>" {
+ yyextra->specName = &yyextra->templateStr;
+ BEGIN ( Specialization );
+ }
+ }
+<Specialization>"<" { *yyextra->specName += *yytext;
+ if (yyextra->roundCount==0) yyextra->sharpCount++;
+ }
+<Specialization>">" {
+ *yyextra->specName += *yytext;
+ if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
+ {
+ yyextra->baseName+=removeRedundantWhiteSpace(*yyextra->specName);
+ BEGIN(yyextra->lastSkipSharpContext);
+ }
+ }
+<Specialization>{BN}+ { lineCount(yyscanner); *yyextra->specName +=' '; }
+<Specialization>"<<" { *yyextra->specName += yytext; }
+<Specialization>">>"/{B}*"::" { // M$ C++ extension to allow >> to close a template...
+ unput('>');
+ unput(' ');
+ unput('>');
+ }
+<Specialization>">>" {
if (yyextra->insideCS) // for C# >> ends a nested template
- {
- REJECT;
- }
- else // for C++ >> is a bitshift
- // operator and > > would end
- // a nested template.
- // We require the bitshift to be enclosed in braces.
- // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
- {
- if (yyextra->roundCount>0)
- {
- *yyextra->specName += yytext;
- }
- else
- {
- unput('>');
- unput(' ');
- unput('>');
- }
- }
- }
-<Specialization>"typename"{BN}+ { lineCount(yyscanner); }
-<Specialization>"(" { *yyextra->specName += *yytext; yyextra->roundCount++; }
-<Specialization>")" { *yyextra->specName += *yytext; yyextra->roundCount--; }
-
-<Specialization>"\\\\" { *yyextra->specName += *yytext;}
-<Specialization>"\\'" { *yyextra->specName += *yytext;}
-<Specialization>"\\\"" { *yyextra->specName += *yytext;}
-<Specialization>"'" { *yyextra->specName += *yytext;BEGIN(SpecializationSingleQuote);}
-<Specialization>"\"" { *yyextra->specName += *yytext;BEGIN(SpecializationDoubleQuote);}
+ {
+ REJECT;
+ }
+ else // for C++ >> is a bitshift
+ // operator and > > would end
+ // a nested template.
+ // We require the bitshift to be enclosed in braces.
+ // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
+ {
+ if (yyextra->roundCount>0)
+ {
+ *yyextra->specName += yytext;
+ }
+ else
+ {
+ unput('>');
+ unput(' ');
+ unput('>');
+ }
+ }
+ }
+<Specialization>"typename"{BN}+ { lineCount(yyscanner); }
+<Specialization>"(" { *yyextra->specName += *yytext; yyextra->roundCount++; }
+<Specialization>")" { *yyextra->specName += *yytext; yyextra->roundCount--; }
+
+<Specialization>"\\\\" { *yyextra->specName += *yytext;}
+<Specialization>"\\'" { *yyextra->specName += *yytext;}
+<Specialization>"\\\"" { *yyextra->specName += *yytext;}
+<Specialization>"'" { *yyextra->specName += *yytext;BEGIN(SpecializationSingleQuote);}
+<Specialization>"\"" { *yyextra->specName += *yytext;BEGIN(SpecializationDoubleQuote);}
<SpecializationSingleQuote,SpecializationDoubleQuote>"\\\\" { *yyextra->specName += *yytext;}
<SpecializationSingleQuote>"\\'" { *yyextra->specName += *yytext;}
<SpecializationSingleQuote>"'" { *yyextra->specName += *yytext; BEGIN(Specialization);}
@@ -5822,154 +5843,154 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
<SpecializationDoubleQuote>"\"" { *yyextra->specName += *yytext; BEGIN(Specialization);}
<SpecializationSingleQuote,SpecializationDoubleQuote>. { *yyextra->specName += *yytext;}
-<Specialization>. {
- *yyextra->specName += *yytext;
- }
-<SkipRound>"(" { ++yyextra->roundCount; }
-<SkipRound>")" { if (--yyextra->roundCount<0)
- BEGIN ( yyextra->lastSkipRoundContext );
- }
-<SkipRound>\" {
- yyextra->lastStringContext=SkipRound;
- BEGIN(SkipString);
- }
-<Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(yyscanner);
+<Specialization>. {
+ *yyextra->specName += *yytext;
+ }
+<SkipRound>"(" { ++yyextra->roundCount; }
+<SkipRound>")" { if (--yyextra->roundCount<0)
+ BEGIN ( yyextra->lastSkipRoundContext );
+ }
+<SkipRound>\" {
+ yyextra->lastStringContext=SkipRound;
+ BEGIN(SkipString);
+ }
+<Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(yyscanner);
if (yyextra->insideProtocolList)
- {
- yyextra->baseName+="-p";
- }
- else
- {
- yyextra->current->args += ',' ;
- }
- yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
- if (!yyextra->baseName.isEmpty())
- {
- yyextra->current->extends.push_back(
- BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt)
- );
- }
- if ((yyextra->current->spec & (Entry::Interface|Entry::Struct)) ||
- yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS ||
- yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL || yyextra->insideSlice)
- {
- yyextra->baseProt=Public;
- }
- else
- {
- yyextra->baseProt=Private;
- }
- yyextra->baseVirt=Normal;
- yyextra->baseName.resize(0);
+ {
+ yyextra->baseName+="-p";
+ }
+ else
+ {
+ yyextra->current->args += ',' ;
+ }
+ yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
+ if (!yyextra->baseName.isEmpty())
+ {
+ yyextra->current->extends.push_back(
+ BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt)
+ );
+ }
+ if ((yyextra->current->spec & (Entry::Interface|Entry::Struct)) ||
+ yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS ||
+ yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL || yyextra->insideSlice)
+ {
+ yyextra->baseProt=Public;
+ }
+ else
+ {
+ yyextra->baseProt=Private;
+ }
+ yyextra->baseVirt=Normal;
+ yyextra->baseName.resize(0);
if (*yytext=='>')
- { // end of a ObjC protocol list
- yyextra->insideProtocolList=FALSE;
- if (yyleng==1)
- {
- unput('{'); // dummy start body
- }
- else
- {
- yyless(1);
- }
- }
- else
- {
- if (*yytext==',' && yyextra->insideObjC) // Begin of protocol list
- {
- yyextra->insideProtocolList=TRUE;
- }
- BEGIN(BasesProt);
- }
- }
-<Bases>{B}*"{"{B}* {
+ { // end of a ObjC protocol list
+ yyextra->insideProtocolList=FALSE;
+ if (yyleng==1)
+ {
+ unput('{'); // dummy start body
+ }
+ else
+ {
+ yyless(1);
+ }
+ }
+ else
+ {
+ if (*yytext==',' && yyextra->insideObjC) // Begin of protocol list
+ {
+ yyextra->insideProtocolList=TRUE;
+ }
+ BEGIN(BasesProt);
+ }
+ }
+<Bases>{B}*"{"{B}* {
yyextra->current->program.resize(0);
yyextra->current->fileName = yyextra->yyFileName ;
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
- if (!yyextra->baseName.isEmpty())
- yyextra->current->extends.push_back(
- BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt)
- );
- yyextra->curlyCount=0;
- if (yyextra->insideObjC)
- {
- BEGIN( ReadBodyIntf );
- }
- else
- {
- BEGIN( ReadBody ) ;
- }
- }
-<SkipUnionSwitch>{B}*"(" {
- yyextra->roundCount++;
- }
-<SkipUnionSwitch>")" {
- if (--yyextra->roundCount==0)
- {
- BEGIN(ClassVar);
- }
- }
-<SkipUnionSwitch>\n { lineCount(yyscanner); }
-<SkipUnionSwitch>.
-<Comment>{BN}+ { yyextra->current->program += yytext ;
- lineCount(yyscanner) ;
- }
-<Comment>"/*" { yyextra->current->program += yytext ; }
-<Comment>"//" { yyextra->current->program += yytext ; }
-<Comment>{CMD}("code"|"verbatim") {
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
+ if (!yyextra->baseName.isEmpty())
+ yyextra->current->extends.push_back(
+ BaseInfo(yyextra->baseName,yyextra->baseProt,yyextra->baseVirt)
+ );
+ yyextra->curlyCount=0;
+ if (yyextra->insideObjC)
+ {
+ BEGIN( ReadBodyIntf );
+ }
+ else
+ {
+ BEGIN( ReadBody ) ;
+ }
+ }
+<SkipUnionSwitch>{B}*"(" {
+ yyextra->roundCount++;
+ }
+<SkipUnionSwitch>")" {
+ if (--yyextra->roundCount==0)
+ {
+ BEGIN(ClassVar);
+ }
+ }
+<SkipUnionSwitch>\n { lineCount(yyscanner); }
+<SkipUnionSwitch>.
+<Comment>{BN}+ { yyextra->current->program += yytext ;
+ lineCount(yyscanner) ;
+ }
+<Comment>"/*" { yyextra->current->program += yytext ; }
+<Comment>"//" { yyextra->current->program += yytext ; }
+<Comment>{CMD}("code"|"verbatim") {
yyextra->insideCode=TRUE;
- yyextra->current->program += yytext ;
- }
-<Comment>{CMD}("endcode"|"endverbatim") {
+ yyextra->current->program += yytext ;
+ }
+<Comment>{CMD}("endcode"|"endverbatim") {
yyextra->insideCode=FALSE;
- yyextra->current->program += yytext ;
- }
-<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program += yytext ; }
-<Comment>"*/" { yyextra->current->program += yytext ;
- if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
- }
-<Comment>. { yyextra->current->program += *yytext ; }
-
-<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>("//"{B}*)?"/*!" {
- //printf("Start doc block at %d\n",yyextra->yyLineNr);
- if (!yyextra->current->doc.isEmpty())
- {
- yyextra->current->doc+="\n\n";
- }
- else
- {
- yyextra->current->docLine = yyextra->yyLineNr;
- yyextra->current->docFile = yyextra->yyFileName;
- }
-
- yyextra->lastDocContext = YY_START;
- if (yyextra->current_root->section & Entry::SCOPE_MASK)
- {
- yyextra->current->inside = yyextra->current_root->name+"::";
- }
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = YY_START==SkipCurly;
- yyextra->docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF);
+ yyextra->current->program += yytext ;
+ }
+<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program += yytext ; }
+<Comment>"*/" { yyextra->current->program += yytext ;
+ if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
+ }
+<Comment>. { yyextra->current->program += *yytext ; }
+
+<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>("//"{B}*)?"/*!" {
+ //printf("Start doc block at %d\n",yyextra->yyLineNr);
+ if (!yyextra->current->doc.isEmpty())
+ {
+ yyextra->current->doc+="\n\n";
+ }
+ else
+ {
+ yyextra->current->docLine = yyextra->yyLineNr;
+ yyextra->current->docFile = yyextra->yyFileName;
+ }
+
+ yyextra->lastDocContext = YY_START;
+ if (yyextra->current_root->section & Entry::SCOPE_MASK)
+ {
+ yyextra->current->inside = yyextra->current_root->name+"::";
+ }
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = YY_START==SkipCurly;
+ yyextra->docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF);
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- if (yyextra->docBlockAutoBrief)
- {
- yyextra->current->briefLine = yyextra->yyLineNr;
- yyextra->current->briefFile = yyextra->yyFileName;
- }
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
+ if (yyextra->docBlockAutoBrief)
+ {
+ yyextra->current->briefLine = yyextra->yyLineNr;
+ yyextra->current->briefFile = yyextra->yyFileName;
+ }
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>"/**"[*]+{BL} {
- bool javadocBanner = Config_getBool(JAVADOC_BANNER);
+ bool javadocBanner = Config_getBool(JAVADOC_BANNER);
lineCount(yyscanner);
- if( javadocBanner )
+ if( javadocBanner )
{
yyextra->lastDocContext = YY_START;
@@ -5999,185 +6020,185 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
else
{
- yyextra->current->program += yytext ;
- yyextra->lastContext = YY_START ;
- BEGIN( Comment ) ;
- }
- }
+ yyextra->current->program += yytext ;
+ yyextra->lastContext = YY_START ;
+ BEGIN( Comment ) ;
+ }
+ }
<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>("//"{B}*)?"/**"/[^/*] {
- yyextra->lastDocContext = YY_START;
+ yyextra->lastDocContext = YY_START;
- //printf("Found comment block at %s:%d\n",yyextra->yyFileName,yyextra->yyLineNr);
- if (yyextra->current_root->section & Entry::SCOPE_MASK)
+ //printf("Found comment block at %s:%d\n",yyextra->yyFileName,yyextra->yyLineNr);
+ if (yyextra->current_root->section & Entry::SCOPE_MASK)
{
- yyextra->current->inside = yyextra->current_root->name+"::";
+ yyextra->current->inside = yyextra->current_root->name+"::";
}
- yyextra->current->docLine = yyextra->yyLineNr;
- yyextra->current->docFile = yyextra->yyFileName;
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = YY_START==SkipCurly;
+ yyextra->current->docLine = yyextra->yyLineNr;
+ yyextra->current->docFile = yyextra->yyFileName;
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = YY_START==SkipCurly;
bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
- yyextra->docBlockAutoBrief = javadocAutoBrief;
+ yyextra->docBlockAutoBrief = javadocAutoBrief;
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- if (yyextra->docBlockAutoBrief)
- {
- yyextra->current->briefLine = yyextra->yyLineNr;
- yyextra->current->briefFile = yyextra->yyFileName;
- }
- startCommentBlock(yyscanner,FALSE);
- BEGIN( DocBlock );
- }
-<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"//!" {
- yyextra->lastDocContext = YY_START;
- if (yyextra->current_root->section & Entry::SCOPE_MASK)
+ if (yyextra->docBlockAutoBrief)
{
- yyextra->current->inside = yyextra->current_root->name+"::";
+ yyextra->current->briefLine = yyextra->yyLineNr;
+ yyextra->current->briefFile = yyextra->yyFileName;
}
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = YY_START==SkipCurly;
- yyextra->docBlockAutoBrief = FALSE;
+ startCommentBlock(yyscanner,FALSE);
+ BEGIN( DocBlock );
+ }
+<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"//!" {
+ yyextra->lastDocContext = YY_START;
+ if (yyextra->current_root->section & Entry::SCOPE_MASK)
+ {
+ yyextra->current->inside = yyextra->current_root->name+"::";
+ }
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = YY_START==SkipCurly;
+ yyextra->docBlockAutoBrief = FALSE;
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
- BEGIN( DocLine );
- }
-<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"///"/[^/] {
- yyextra->lastDocContext = YY_START;
- if (yyextra->current_root->section & Entry::SCOPE_MASK)
+ startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
+ BEGIN( DocLine );
+ }
+<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>"///"/[^/] {
+ yyextra->lastDocContext = YY_START;
+ if (yyextra->current_root->section & Entry::SCOPE_MASK)
{
- yyextra->current->inside = yyextra->current_root->name+"::";
+ yyextra->current->inside = yyextra->current_root->name+"::";
}
- yyextra->docBlockContext = YY_START;
- yyextra->docBlockInBody = YY_START==SkipCurly;
- yyextra->docBlockAutoBrief = FALSE;
+ yyextra->docBlockContext = YY_START;
+ yyextra->docBlockInBody = YY_START==SkipCurly;
+ yyextra->docBlockAutoBrief = FALSE;
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock=indent;
- startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
- BEGIN( DocLine );
- }
+ startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
+ BEGIN( DocLine );
+ }
<FindMembers>"extern"{BN}*"\"C"("++")?"\""{BN}*("{")? {
- lineCount(yyscanner);
- yyextra->externC=TRUE;
- }
-<FindMembers>"{" {
- if (yyextra->externC)
- {
- yyextra->externC=FALSE;
- }
- else if (yyextra->insideCS &&
- !yyextra->current->name.isEmpty() &&
- !yyextra->current->type.isEmpty())
- {
- if (containsWord(yyextra->current->type,"event")) // event
- {
- yyextra->current->mtype = yyextra->mtype = Event;
- }
- else // property
- {
- yyextra->current->mtype = yyextra->mtype = Property;
- }
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->curlyCount=0;
- BEGIN( CSAccessorDecl );
- }
- else if (yyextra->insideIDL && (yyextra->current->spec & Entry::Attribute))
- {
- // UNO IDL: attributes may have setter and getter
- // exception specifications
- yyextra->current->exception = " {";
- BEGIN(UNOIDLAttributeBlock);
- }
- else
- {
- if ((yyextra->insideJava || yyextra->insideCS || yyextra->insideD) &&
- yyextra->current->name.isEmpty()
- )
- {
- // static Java initializer
- yyextra->needsSemi = FALSE;
- if (yyextra->current->stat)
- {
- yyextra->current->name="[static initializer]";
- yyextra->current->type.resize(0);
- }
- else
- {
- yyextra->current->name="[instance initializer]";
- }
- unput(*yytext);
- BEGIN( Function );
- }
- else
- {
- // pre C++11 code -> ignore the initializer
+ lineCount(yyscanner);
+ yyextra->externC=TRUE;
+ }
+<FindMembers>"{" {
+ if (yyextra->externC)
+ {
+ yyextra->externC=FALSE;
+ }
+ else if (yyextra->insideCS &&
+ !yyextra->current->name.isEmpty() &&
+ !yyextra->current->type.isEmpty())
+ {
+ if (containsWord(yyextra->current->type,"event")) // event
+ {
+ yyextra->current->mtype = yyextra->mtype = Event;
+ }
+ else // property
+ {
+ yyextra->current->mtype = yyextra->mtype = Property;
+ }
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->curlyCount=0;
+ BEGIN( CSAccessorDecl );
+ }
+ else if (yyextra->insideIDL && (yyextra->current->spec & Entry::Attribute))
+ {
+ // UNO IDL: attributes may have setter and getter
+ // exception specifications
+ yyextra->current->exception = " {";
+ BEGIN(UNOIDLAttributeBlock);
+ }
+ else
+ {
+ if ((yyextra->insideJava || yyextra->insideCS || yyextra->insideD) &&
+ yyextra->current->name.isEmpty()
+ )
+ {
+ // static Java initializer
+ yyextra->needsSemi = FALSE;
+ if (yyextra->current->stat)
+ {
+ yyextra->current->name="[static initializer]";
+ yyextra->current->type.resize(0);
+ }
+ else
+ {
+ yyextra->current->name="[instance initializer]";
+ }
+ unput(*yytext);
+ BEGIN( Function );
+ }
+ else
+ {
+ // pre C++11 code -> ignore the initializer
//yyextra->needsSemi = TRUE;
- //yyextra->current->type.resize(0);
- //yyextra->current->name.resize(0);
- //yyextra->current->args.resize(0);
- //yyextra->current->argList.clear();
- //yyextra->curlyCount=0;
- //BEGIN( SkipCurlyBlock );
+ //yyextra->current->type.resize(0);
+ //yyextra->current->name.resize(0);
+ //yyextra->current->args.resize(0);
+ //yyextra->current->argList.clear();
+ //yyextra->curlyCount=0;
+ //BEGIN( SkipCurlyBlock );
// C++11 style initializer list
- yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->bodyColumn = yyextra->yyColNr;
+ yyextra->current->bodyLine = yyextra->yyLineNr;
+ yyextra->current->bodyColumn = yyextra->yyColNr;
yyextra->current->initializer = yytext;
- yyextra->lastInitializerContext = YY_START;
- yyextra->initBracketCount=1;
- BEGIN(ReadInitializer);
- }
- }
- }
-<CSAccessorDecl>"{" { yyextra->curlyCount++; }
-<CSAccessorDecl>"}"{B}*"=" {
- // fall back to next rule if it's not the right bracket
- if (yyextra->curlyCount != 0) REJECT;
- yyextra->current->initializer = "=";
- yyextra->current->endBodyLine=yyextra->yyLineNr;
- yyextra->lastInitializerContext = FindMembers;
- BEGIN(ReadInitializer);
- }
-<CSAccessorDecl>"}" {
- if (yyextra->curlyCount)
- {
- yyextra->curlyCount--;
- }
- else
- {
- yyextra->mtype = Method;
+ yyextra->lastInitializerContext = YY_START;
+ yyextra->initBracketCount=1;
+ BEGIN(ReadInitializer);
+ }
+ }
+ }
+<CSAccessorDecl>"{" { yyextra->curlyCount++; }
+<CSAccessorDecl>"}"{B}*"=" {
+ // fall back to next rule if it's not the right bracket
+ if (yyextra->curlyCount != 0) REJECT;
+ yyextra->current->initializer = "=";
+ yyextra->current->endBodyLine=yyextra->yyLineNr;
+ yyextra->lastInitializerContext = FindMembers;
+ BEGIN(ReadInitializer);
+ }
+<CSAccessorDecl>"}" {
+ if (yyextra->curlyCount)
+ {
+ yyextra->curlyCount--;
+ }
+ else
+ {
+ yyextra->mtype = Method;
yyextra->virt = Normal;
- // not really important, but while we are at it
- yyextra->current->endBodyLine=yyextra->yyLineNr;
+ // not really important, but while we are at it
+ yyextra->current->endBodyLine=yyextra->yyLineNr;
unput(';');
- BEGIN(FindMembers);
- }
- }
-<CSAccessorDecl>"private "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateSettable; }
-<CSAccessorDecl>"protected "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedSettable; }
-<CSAccessorDecl>"private "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateGettable; }
-<CSAccessorDecl>"protected "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedGettable; }
-<CSAccessorDecl>"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Settable; }
-<CSAccessorDecl>"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Gettable; }
-<CSAccessorDecl>"add" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Addable; }
-<CSAccessorDecl>"remove" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Removable; }
-<CSAccessorDecl>"raise" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Raisable; }
-<CSAccessorDecl>"\"" { BEGIN(CSString);}
-<CSAccessorDecl>"." {}
-<CSAccessorDecl>\n { lineCount(yyscanner); }
-<CSString>"\"" { BEGIN(CSAccessorDecl);}
-<CSString>"//" {} // Otherwise the rule <*>"//" will kick in
-<CSString>"/*" {} // Otherwise the rule <*>"/*" will kick in
-<CSString>\n { lineCount(yyscanner); }
-<CSString>"." {}
+ BEGIN(FindMembers);
+ }
+ }
+<CSAccessorDecl>"private "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateSettable; }
+<CSAccessorDecl>"protected "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedSettable; }
+<CSAccessorDecl>"private "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::PrivateGettable; }
+<CSAccessorDecl>"protected "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::ProtectedGettable; }
+<CSAccessorDecl>"set" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Settable; }
+<CSAccessorDecl>"get" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Gettable; }
+<CSAccessorDecl>"add" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Addable; }
+<CSAccessorDecl>"remove" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Removable; }
+<CSAccessorDecl>"raise" { if (yyextra->curlyCount==0) yyextra->current->spec |= Entry::Raisable; }
+<CSAccessorDecl>"\"" { BEGIN(CSString);}
+<CSAccessorDecl>"." {}
+<CSAccessorDecl>\n { lineCount(yyscanner); }
+<CSString>"\"" { BEGIN(CSAccessorDecl);}
+<CSString>"//" {} // Otherwise the rule <*>"//" will kick in
+<CSString>"/*" {} // Otherwise the rule <*>"/*" will kick in
+<CSString>\n { lineCount(yyscanner); }
+<CSString>"." {}
/* ---- Slice-specific rules ------ */
@@ -6245,80 +6266,80 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
/* ---- Single line comments ------ */
<DocLine>[^\n]*"\n"[ \t]*"//"[/!][<]? { // continuation of multiline C++-style comment
- yyextra->docBlock+=yytext;
+ yyextra->docBlock+=yytext;
int markerLen = yytext[yyleng-1]=='<' ? 4 : 3;
- yyextra->docBlock.resize(yyextra->docBlock.length() - markerLen);
+ yyextra->docBlock.resize(yyextra->docBlock.length() - markerLen);
lineCount(yyscanner);
}
-<DocLine>{B}*"///"[/]+{B}*/"\n" { // ignore marker line (see bug700345)
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
- BEGIN( yyextra->docBlockContext );
- }
-<DocLine>[^\n]*/"\n"{B}*"//"[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712
- yyextra->docBlock+=yytext;
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
- BEGIN( yyextra->docBlockContext );
- }
-<DocLine>[^\n]*/"\n" { // whole line
- yyextra->docBlock+=yytext;
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
- BEGIN( yyextra->docBlockContext );
- }
+<DocLine>{B}*"///"[/]+{B}*/"\n" { // ignore marker line (see bug700345)
+ handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ BEGIN( yyextra->docBlockContext );
+ }
+<DocLine>[^\n]*/"\n"{B}*"//"[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712
+ yyextra->docBlock+=yytext;
+ handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ BEGIN( yyextra->docBlockContext );
+ }
+<DocLine>[^\n]*/"\n" { // whole line
+ yyextra->docBlock+=yytext;
+ handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ BEGIN( yyextra->docBlockContext );
+ }
/* ---- Comments blocks ------ */
-<DocBlock>"*"*"*/" { // end of comment block
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),FALSE);
- BEGIN(yyextra->docBlockContext);
- }
-<DocBlock>^{B}*"*"+/[^/] {
+<DocBlock>"*"*"*/" { // end of comment block
+ handleCommentBlock(yyscanner,yyextra->docBlock.data(),FALSE);
+ BEGIN(yyextra->docBlockContext);
+ }
+<DocBlock>^{B}*"*"+/[^/] {
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock+=indent;
- }
-<DocBlock>^{B}*("//")?{B}*"*"+/[^//a-z_A-Z0-9*] { // start of a comment line
+ }
+<DocBlock>^{B}*("//")?{B}*"*"+/[^//a-z_A-Z0-9*] { // start of a comment line
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
yyextra->docBlock+=indent;
- }
-<DocBlock>^{B}*("//"){B}* { // strip embedded C++ comments if at the start of a line
- }
-<DocBlock>"//" { // slashes in the middle of a comment block
- yyextra->docBlock+=yytext;
- }
-<DocBlock>"/*" { // start of a new comment in the
+ }
+<DocBlock>^{B}*("//"){B}* { // strip embedded C++ comments if at the start of a line
+ }
+<DocBlock>"//" { // slashes in the middle of a comment block
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>"/*" { // start of a new comment in the
// middle of a comment block
- yyextra->docBlock+=yytext;
- }
+ yyextra->docBlock+=yytext;
+ }
<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command
- yyextra->docBlock+=yytext;
- }
-<DocBlock>{CMD}("f$"|"f["|"f{") {
yyextra->docBlock+=yytext;
- yyextra->docBlockName=&yytext[1];
- if (yyextra->docBlockName.at(1)=='{')
- {
- yyextra->docBlockName.at(1)='}';
- }
+ }
+<DocBlock>{CMD}("f$"|"f["|"f{") {
+ yyextra->docBlock+=yytext;
+ yyextra->docBlockName=&yytext[1];
+ if (yyextra->docBlockName.at(1)=='{')
+ {
+ yyextra->docBlockName.at(1)='}';
+ }
yyextra->fencedSize=0;
yyextra->nestedComment=FALSE;
- BEGIN(DocCopyBlock);
+ BEGIN(DocCopyBlock);
}
-<DocBlock>{B}*"<"{PRE}">" {
+<DocBlock>{B}*"<"{PRE}">" {
yyextra->docBlock+=yytext;
- yyextra->docBlockName="<pre>";
+ yyextra->docBlockName="<pre>";
yyextra->fencedSize=0;
yyextra->nestedComment=FALSE;
- BEGIN(DocCopyBlock);
- }
-<DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
+ BEGIN(DocCopyBlock);
+ }
+<DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
yyextra->docBlock+=yytext;
- yyextra->docBlockName=&yytext[1];
+ yyextra->docBlockName=&yytext[1];
yyextra->fencedSize=0;
yyextra->nestedComment=FALSE;
- BEGIN(DocCopyBlock);
- }
+ BEGIN(DocCopyBlock);
+ }
<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
QCString pat = substitute(yytext,"*"," ");
@@ -6337,86 +6358,86 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN(DocCopyBlock);
}
<DocBlock>{B}*"<code>" {
- if (yyextra->insideCS)
- {
- yyextra->docBlock+=yytext;
- yyextra->docBlockName="<code>";
+ if (yyextra->insideCS)
+ {
+ yyextra->docBlock+=yytext;
+ yyextra->docBlockName="<code>";
yyextra->nestedComment=FALSE;
- BEGIN(DocCopyBlock);
- }
- else
- {
- REJECT;
- }
- }
-<DocBlock>[^@*~\/\\\n]+ { // any character that isn't special
- yyextra->docBlock+=yytext;
- }
-<DocBlock>\n { // newline
+ BEGIN(DocCopyBlock);
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<DocBlock>[^@*~\/\\\n]+ { // any character that isn't special
+ yyextra->docBlock+=yytext;
+ }
+<DocBlock>\n { // newline
lineCount(yyscanner);
- yyextra->docBlock+=*yytext;
- }
-<DocBlock>. { // command block
- yyextra->docBlock+=*yytext;
- }
+ yyextra->docBlock+=*yytext;
+ }
+<DocBlock>. { // command block
+ yyextra->docBlock+=*yytext;
+ }
/* ---- Copy verbatim sections ------ */
-<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
- yyextra->docBlock+=yytext;
- if (yyextra->docBlockName=="<pre>")
- {
- BEGIN(DocBlock);
- }
- }
-<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
- yyextra->docBlock+=yytext;
- if (yyextra->docBlockName=="<code>")
- {
- BEGIN(DocBlock);
- }
- }
+<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
+ yyextra->docBlock+=yytext;
+ if (yyextra->docBlockName=="<pre>")
+ {
+ BEGIN(DocBlock);
+ }
+ }
+<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
+ yyextra->docBlock+=yytext;
+ if (yyextra->docBlockName=="<code>")
+ {
+ BEGIN(DocBlock);
+ }
+ }
<DocCopyBlock>[\\@]("f$"|"f]"|"f}") {
- yyextra->docBlock+=yytext;
- BEGIN(DocBlock);
- }
+ yyextra->docBlock+=yytext;
+ BEGIN(DocBlock);
+ }
<DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
- yyextra->docBlock+=yytext;
- if (&yytext[4]==yyextra->docBlockName)
- {
- BEGIN(DocBlock);
- }
- }
-<DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line
- if (yyextra->docBlockName=="verbatim")
- {
- REJECT;
- }
- else if (yyextra->docBlockName=="code")
- {
- REJECT;
- }
+ yyextra->docBlock+=yytext;
+ if (&yytext[4]==yyextra->docBlockName)
+ {
+ BEGIN(DocBlock);
+ }
+ }
+<DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line
+ if (yyextra->docBlockName=="verbatim")
+ {
+ REJECT;
+ }
+ else if (yyextra->docBlockName=="code")
+ {
+ REJECT;
+ }
else
{
QCString indent;
indent.fill(' ',computeIndent(yytext,0));
yyextra->docBlock+=indent;
}
- }
-<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s
- if (yyextra->docBlockName=="code")
+ }
+<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s
+ if (yyextra->docBlockName=="code")
{
QCString indent;
indent.fill(' ',computeIndent(yytext,0));
yyextra->docBlock+=indent;
}
else
- {
- REJECT;
- }
- }
-<DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516)
- if (yyextra->docBlockName=="code")
+ {
+ REJECT;
+ }
+ }
+<DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516)
+ if (yyextra->docBlockName=="code")
{
QCString indent;
indent.fill(' ',computeIndent(yytext,-1));
@@ -6427,8 +6448,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
REJECT;
}
}
-<DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one *
- if (yyextra->docBlockName=="code")
+<DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one *
+ if (yyextra->docBlockName=="code")
{
QCString indent;
if (yyextra->nestedComment) // keep * it is part of the code
@@ -6443,10 +6464,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
}
}
else
- {
- REJECT;
- }
- }
+ {
+ REJECT;
+ }
+ }
<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
QCString pat = substitute(yytext,"*"," ");
yyextra->docBlock+=pat;
@@ -6463,10 +6484,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN(DocBlock);
}
}
-<DocCopyBlock>[^\<@/*\]~\$\\\n]+ { // any character that is not special
- yyextra->docBlock+=yytext;
- }
-<DocCopyBlock>"/*"|"*/"|"//" {
+<DocCopyBlock>[^\<@/*\]~\$\\\n]+ { // any character that is not special
+ yyextra->docBlock+=yytext;
+ }
+<DocCopyBlock>"/*"|"*/"|"//" {
if (yytext[1]=='*')
{
yyextra->nestedComment=TRUE;
@@ -6475,117 +6496,117 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
{
yyextra->nestedComment=FALSE;
}
- yyextra->docBlock+=yytext;
- }
-<DocCopyBlock>\n { // newline
- yyextra->docBlock+=*yytext;
+ yyextra->docBlock+=yytext;
+ }
+<DocCopyBlock>\n { // newline
+ yyextra->docBlock+=*yytext;
lineCount(yyscanner);
- }
-<DocCopyBlock>. { // any other character
- yyextra->docBlock+=*yytext;
- }
-<DocCopyBlock><<EOF>> {
- warn(yyextra->yyFileName,yyextra->yyLineNr,
- "reached end of file while inside a '%s' block!\n"
- "The command that should end the block seems to be missing!\n",
- yyextra->docBlockName.data());
- yyterminate();
- }
+ }
+<DocCopyBlock>. { // any other character
+ yyextra->docBlock+=*yytext;
+ }
+<DocCopyBlock><<EOF>> {
+ warn(yyextra->yyFileName,yyextra->yyLineNr,
+ "reached end of file while inside a '%s' block!\n"
+ "The command that should end the block seems to be missing!\n",
+ yyextra->docBlockName.data());
+ yyterminate();
+ }
/* ------------- Prototype parser -------------- */
-<Prototype>"operator"{B}*"("{B}*")" {
- yyextra->current->name+=yytext;
- }
-<Prototype>"(" {
- yyextra->current->args+=*yytext;
- yyextra->currentArgumentContext = PrototypeQual;
- yyextra->fullArgString = yyextra->current->args.copy();
- yyextra->copyArgString = &yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- }
-<Prototype>"("({ID}"::")*({B}*[&*])+ {
- if (yyextra->insidePHP) // reference parameter
- {
- REJECT;
- }
- else
- {
- yyextra->current->type+=yyextra->current->name+yytext;
- yyextra->current->name.resize(0);
- BEGIN( PrototypePtr );
- }
- }
-<PrototypePtr>{SCOPENAME} {
- yyextra->current->name+=yytext;
- }
-<PrototypePtr>"(" {
- yyextra->current->args+=*yytext;
- yyextra->currentArgumentContext = PrototypeQual;
- yyextra->fullArgString = yyextra->current->args.copy();
- yyextra->copyArgString = &yyextra->current->args;
- BEGIN( ReadFuncArgType ) ;
- }
-<PrototypePtr>")" {
- yyextra->current->type+=')';
- BEGIN( Prototype );
- }
-<PrototypePtr>. {
- yyextra->current->name+=yytext;
- }
-<PrototypeQual>"{" {
- BEGIN( PrototypeSkipLine);
- }
-<PrototypeQual>{B}*"const"{B}* {
- yyextra->current->args += " const ";
- yyextra->current->argList.setConstSpecifier(TRUE);
- }
-<PrototypeQual>{B}*"volatile"{B}* {
- yyextra->current->args += " volatile ";
- yyextra->current->argList.setVolatileSpecifier(TRUE);
- }
-<PrototypeQual>{B}*"="{B}*"0"{B}* {
- yyextra->current->args += " = 0";
- yyextra->current->virt = Pure;
- yyextra->current->argList.setPureSpecifier(TRUE);
- }
-<PrototypeQual>"throw"{B}*"(" {
- yyextra->current->exception = "throw(";
- BEGIN(PrototypeExc);
- }
-<PrototypeExc>")" {
- yyextra->current->exception += ')';
- BEGIN(PrototypeQual);
- }
-<PrototypeExc>. {
- yyextra->current->exception += *yytext;
- }
-<PrototypeQual>. {
- yyextra->current->args += *yytext;
- }
-<Prototype>. {
- yyextra->current->name += *yytext;
- }
-<PrototypeSkipLine>. {
- }
-
-
-
-
-<SkipCxxComment>.*"\\\n" { // line continuation
- if (yyextra->insideCS)
- {
- REJECT;
- }
- else
- {
+<Prototype>"operator"{B}*"("{B}*")" {
+ yyextra->current->name+=yytext;
+ }
+<Prototype>"(" {
+ yyextra->current->args+=*yytext;
+ yyextra->currentArgumentContext = PrototypeQual;
+ yyextra->fullArgString = yyextra->current->args.copy();
+ yyextra->copyArgString = &yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ }
+<Prototype>"("({ID}"::")*({B}*[&*])+ {
+ if (yyextra->insidePHP) // reference parameter
+ {
+ REJECT;
+ }
+ else
+ {
+ yyextra->current->type+=yyextra->current->name+yytext;
+ yyextra->current->name.resize(0);
+ BEGIN( PrototypePtr );
+ }
+ }
+<PrototypePtr>{SCOPENAME} {
+ yyextra->current->name+=yytext;
+ }
+<PrototypePtr>"(" {
+ yyextra->current->args+=*yytext;
+ yyextra->currentArgumentContext = PrototypeQual;
+ yyextra->fullArgString = yyextra->current->args.copy();
+ yyextra->copyArgString = &yyextra->current->args;
+ BEGIN( ReadFuncArgType ) ;
+ }
+<PrototypePtr>")" {
+ yyextra->current->type+=')';
+ BEGIN( Prototype );
+ }
+<PrototypePtr>. {
+ yyextra->current->name+=yytext;
+ }
+<PrototypeQual>"{" {
+ BEGIN( PrototypeSkipLine);
+ }
+<PrototypeQual>{B}*"const"{B}* {
+ yyextra->current->args += " const ";
+ yyextra->current->argList.setConstSpecifier(TRUE);
+ }
+<PrototypeQual>{B}*"volatile"{B}* {
+ yyextra->current->args += " volatile ";
+ yyextra->current->argList.setVolatileSpecifier(TRUE);
+ }
+<PrototypeQual>{B}*"="{B}*"0"{B}* {
+ yyextra->current->args += " = 0";
+ yyextra->current->virt = Pure;
+ yyextra->current->argList.setPureSpecifier(TRUE);
+ }
+<PrototypeQual>"throw"{B}*"(" {
+ yyextra->current->exception = "throw(";
+ BEGIN(PrototypeExc);
+ }
+<PrototypeExc>")" {
+ yyextra->current->exception += ')';
+ BEGIN(PrototypeQual);
+ }
+<PrototypeExc>. {
+ yyextra->current->exception += *yytext;
+ }
+<PrototypeQual>. {
+ yyextra->current->args += *yytext;
+ }
+<Prototype>. {
+ yyextra->current->name += *yytext;
+ }
+<PrototypeSkipLine>. {
+ }
+
+
+
+
+<SkipCxxComment>.*"\\\n" { // line continuation
+ if (yyextra->insideCS)
+ {
+ REJECT;
+ }
+ else
+ {
lineCount(yyscanner);
- }
- }
-<SkipCxxComment>.*/\n {
- BEGIN( yyextra->lastCContext ) ;
- }
+ }
+ }
+<SkipCxxComment>.*/\n {
+ BEGIN( yyextra->lastCContext ) ;
+ }
<SkipComment>[^\*\n]+
/* ------------ Generic rules -------------- */
@@ -6597,59 +6618,59 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
BEGIN( SkipC11Attribute );
}
-<*>\n { lineCount(yyscanner); }
-<*>\" {
- if (yyextra->insideIDL && yyextra->insideCppQuote)
- {
- BEGIN(EndCppQuote);
- }
- }
-<*>"#" {
- if (!yyextra->insidePHP)
- REJECT;
- yyextra->lastCContext = YY_START ;
- BEGIN( SkipCxxComment ) ;
- }
-<*>\' {
- if (yyextra->insidePHP)
- {
- yyextra->lastStringContext=YY_START;
- BEGIN(SkipPHPString);
- }
- }
-<*>\" {
- if (yyextra->insidePHP)
- {
- yyextra->lastStringContext=YY_START;
- BEGIN(SkipString);
- }
- }
+<*>\n { lineCount(yyscanner); }
+<*>\" {
+ if (yyextra->insideIDL && yyextra->insideCppQuote)
+ {
+ BEGIN(EndCppQuote);
+ }
+ }
+<*>"#" {
+ if (!yyextra->insidePHP)
+ REJECT;
+ yyextra->lastCContext = YY_START ;
+ BEGIN( SkipCxxComment ) ;
+ }
+<*>\' {
+ if (yyextra->insidePHP)
+ {
+ yyextra->lastStringContext=YY_START;
+ BEGIN(SkipPHPString);
+ }
+ }
+<*>\" {
+ if (yyextra->insidePHP)
+ {
+ yyextra->lastStringContext=YY_START;
+ BEGIN(SkipString);
+ }
+ }
<*>\? {
- if (yyextra->insideCS && (YY_START != SkipRound))
- {
- if (yyextra->current->type.isEmpty())
- {
- if (yyextra->current->name.isEmpty())
- yyextra->current->name="?";
- else
- yyextra->current->name+="?";
- }
- else
- {
- yyextra->current->type+="?";
- }
- }
- }
+ if (yyextra->insideCS && (YY_START != SkipRound))
+ {
+ if (yyextra->current->type.isEmpty())
+ {
+ if (yyextra->current->name.isEmpty())
+ yyextra->current->name="?";
+ else
+ yyextra->current->name+="?";
+ }
+ else
+ {
+ yyextra->current->type+="?";
+ }
+ }
+ }
<*>.
<SkipComment>"//"|"/*"
-<*>"/*" { yyextra->lastCContext = YY_START ;
- BEGIN( SkipComment ) ;
- }
-<SkipComment>{B}*"*/" { BEGIN( yyextra->lastCContext ) ; }
-<*>"//" {
- yyextra->lastCContext = YY_START ;
- BEGIN( SkipCxxComment ) ;
- }
+<*>"/*" { yyextra->lastCContext = YY_START ;
+ BEGIN( SkipComment ) ;
+ }
+<SkipComment>{B}*"*/" { BEGIN( yyextra->lastCContext ) ; }
+<*>"//" {
+ yyextra->lastCContext = YY_START ;
+ BEGIN( SkipCxxComment ) ;
+ }
%%
//----------------------------------------------------------------------------
@@ -6694,7 +6715,7 @@ static void initParser(yyscan_t yyscanner)
static void initEntry(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->insideJava)
+ if (yyextra->insideJava)
{
yyextra->protection = (yyextra->current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package;
}
@@ -6718,15 +6739,15 @@ static void lineCount(yyscan_t yyscanner)
const char *p;
for (p = yytext ; *p ; ++p )
{
- if (*p=='\n')
+ if (*p=='\n')
{
yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1;
}
- else if (*p=='\t')
+ else if (*p=='\t')
{
yyextra->column+=tabSize - (yyextra->column%tabSize);
}
- else
+ else
{
yyextra->column++,yyextra->yyColNr++;
}
@@ -6753,14 +6774,14 @@ static void addType(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
uint tl=yyextra->current->type.length();
- if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
+ if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
{
yyextra->current->type += ' ' ;
}
yyextra->current->type += yyextra->current->name ;
yyextra->current->name.resize(0) ;
tl=yyextra->current->type.length();
- if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
+ if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
{
yyextra->current->type += ' ' ;
}
@@ -6801,7 +6822,7 @@ static void setContext(yyscan_t yyscanner)
yyextra->language = getLanguageFromFileName(yyextra->yyFileName);
yyextra->insideIDL = yyextra->language==SrcLangExt_IDL;
yyextra->insideJava = yyextra->language==SrcLangExt_Java;
- yyextra->insideCS = yyextra->language==SrcLangExt_CSharp;
+ yyextra->insideCS = yyextra->language==SrcLangExt_CSharp;
yyextra->insideD = yyextra->language==SrcLangExt_D;
yyextra->insidePHP = yyextra->language==SrcLangExt_PHP;
yyextra->insideObjC = yyextra->language==SrcLangExt_ObjC;
@@ -6811,7 +6832,7 @@ static void setContext(yyscan_t yyscanner)
//printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
// "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
// yyextra->yyFileName.data(),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
- // );
+ // );
}
//-----------------------------------------------------------------------------
@@ -6858,7 +6879,7 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol
{
static QRegExp re("([^)]*)");
int bi1 = yyextra->current->args.findRev(re);
- int bi2 = bi1!=-1 ? yyextra->current->args.findRev(re,bi1-1) : -1;
+ int bi2 = bi1!=-1 ? yyextra->current->args.findRev(re,bi1-1) : -1;
char c;
if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
{
@@ -6895,13 +6916,13 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol
i++;
if (i!=l)
{
- yyextra->oldStyleArgType=yyextra->current->args.left(i);
- oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
- oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
+ yyextra->oldStyleArgType=yyextra->current->args.left(i);
+ oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
+ oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
}
else
{
- oldStyleArgName=yyextra->current->args.copy().stripWhiteSpace();
+ oldStyleArgName=yyextra->current->args.copy().stripWhiteSpace();
}
}
}
@@ -6939,7 +6960,7 @@ static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString
a.type=type.stripWhiteSpace();
if (a.type.left(9)=="register ") // strip keyword
{
- a.type=a.type.mid(9);
+ a.type=a.type.mid(9);
}
a.name=name.stripWhiteSpace();
if (!brief.isEmpty() && !docs.isEmpty())
@@ -6952,7 +6973,7 @@ static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString
}
else
{
- a.docs=docs;
+ a.docs=docs;
}
}
}
@@ -6988,15 +7009,15 @@ static void startCommentBlock(yyscan_t yyscanner,bool brief)
yyextra->current->docLine = yyextra->yyLineNr;
}
}
-
+
//----------------------------------------------------------------------------
static void newEntry(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
- // and yyextra->current is actually replaced by yyextra->previous which was
- // already added to yyextra->current_root, so we should not add it again
+ if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
+ // and yyextra->current is actually replaced by yyextra->previous which was
+ // already added to yyextra->current_root, so we should not add it again
// (see bug723314)
{
yyextra->previous = yyextra->current;
@@ -7033,15 +7054,15 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
QCString strippedDoc = stripIndentation(doc);
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
while (yyextra->commentScanner.parseCommentBlock(
- yyextra->thisParser,
- yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
- processedDoc, // text
- yyextra->yyFileName, // file
- lineNr, // line of block start
- yyextra->docBlockInBody ? FALSE : brief, // isBrief
- yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
- yyextra->docBlockInBody, // isInBody
- yyextra->protection,
+ yyextra->thisParser,
+ yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
+ processedDoc, // text
+ yyextra->yyFileName, // file
+ lineNr, // line of block start
+ yyextra->docBlockInBody ? FALSE : brief, // isBrief
+ yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
+ yyextra->docBlockInBody, // isInBody
+ yyextra->protection,
position,
needsEntry,
Config_getBool(MARKDOWN_SUPPORT)
@@ -7049,7 +7070,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
)
{
//printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
- if (needsEntry)
+ if (needsEntry)
{
QCString docFile = yyextra->current->docFile;
newEntry(yyscanner);
@@ -7093,27 +7114,27 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al)
//printf("handleParametersCommentBlock [%s]\n",doc.data());
while (yyextra->commentScanner.parseCommentBlock(
- yyextra->thisParser,
- yyextra->current.get(),
- a.docs, // text
- yyextra->yyFileName, // file
- yyextra->current->docLine, // line of block start
- FALSE,
- FALSE,
- FALSE,
- yyextra->protection,
- position,
- needsEntry,
+ yyextra->thisParser,
+ yyextra->current.get(),
+ a.docs, // text
+ yyextra->yyFileName, // file
+ yyextra->current->docLine, // line of block start
+ FALSE,
+ FALSE,
+ FALSE,
+ yyextra->protection,
+ position,
+ needsEntry,
Config_getBool(MARKDOWN_SUPPORT)
- )
- )
+ )
+ )
{
- //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position);
- if (needsEntry) newEntry(yyscanner);
+ //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position);
+ if (needsEntry) newEntry(yyscanner);
}
if (needsEntry)
{
- newEntry(yyscanner);
+ newEntry(yyscanner);
}
a.docs = yyextra->current->doc;
@@ -7146,9 +7167,9 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
yyextra->inputString = ce->program;
yyextra->inputPosition = 0;
if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum))
- BEGIN( FindFields ) ;
+ BEGIN( FindFields ) ;
else
- BEGIN( FindMembers ) ;
+ BEGIN( FindMembers ) ;
yyextra->current_root = ce;
yyextra->yyFileName = ce->fileName;
//setContext();
@@ -7172,44 +7193,44 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
if( ce->section==Entry::CLASS_SEC ) // class
{
if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
- {
- yyextra->current->protection = yyextra->protection = Public ;
- }
- else if (yyextra->insideJava)
- {
+ {
+ yyextra->current->protection = yyextra->protection = Public ;
+ }
+ else if (yyextra->insideJava)
+ {
yyextra->current->protection = yyextra->protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package;
- }
- else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union))
- {
- if (ce->lang==SrcLangExt_ObjC)
- {
- yyextra->current->protection = yyextra->protection = Protected ;
- }
- else
- {
- yyextra->current->protection = yyextra->protection = Public ;
- }
- }
- else
- {
+ }
+ else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union))
+ {
+ if (ce->lang==SrcLangExt_ObjC)
+ {
+ yyextra->current->protection = yyextra->protection = Protected ;
+ }
+ else
+ {
+ yyextra->current->protection = yyextra->protection = Public ;
+ }
+ }
+ else
+ {
yyextra->current->protection = yyextra->protection = Private ;
- }
+ }
}
else if (ce->section == Entry::ENUM_SEC ) // enum
{
- yyextra->current->protection = yyextra->protection = ce->protection;
+ yyextra->current->protection = yyextra->protection = ce->protection;
}
else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
{
- if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace
- {
+ if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace
+ {
yyextra->current->stat = yyextra->stat = TRUE;
- }
- yyextra->current->protection = yyextra->protection = ce->protection;
+ }
+ yyextra->current->protection = yyextra->protection = ce->protection;
}
else // named struct, union, protocol, category
{
- yyextra->current->protection = yyextra->protection = Public ;
+ yyextra->current->protection = yyextra->protection = Public ;
}
yyextra->mtype = Method;
yyextra->virt = Normal;
@@ -7220,19 +7241,19 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
//memberGroupInside.resize(0);
QCString name = ce->name;
yyextra->commentScanner.enterCompound(yyextra->yyFileName,yyextra->yyLineNr,name);
-
+
scannerYYlex(yyscanner);
yyextra->lexInit=TRUE;
//forceEndGroup();
yyextra->commentScanner.leaveCompound(yyextra->yyFileName,yyextra->yyLineNr,name);
-
+
ce->program.resize(0);
//if (depthIf>0)
//{
- // warn(yyextra->yyFileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
+ // warn(yyextra->yyFileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
//}
}
parseCompounds(yyscanner,ce);
@@ -7326,7 +7347,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("**** parsePrototype(%s) begin\n",text.data());
- if (text.isEmpty())
+ if (text.isEmpty())
{
warn(yyextra->yyFileName,yyextra->yyLineNr,"Empty prototype found!");
return;
@@ -7339,11 +7360,11 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text)
const char *orgInputString;
int orgInputPosition;
YY_BUFFER_STATE orgState;
-
+
// save scanner state
orgState = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE, yyscanner), yyscanner);
- orgInputString = yyextra->inputString;
+ orgInputString = yyextra->inputString;
orgInputPosition = yyextra->inputPosition;
// set new string
@@ -7363,7 +7384,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text)
YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER;
yy_switch_to_buffer(orgState, yyscanner);
yy_delete_buffer(tmpState, yyscanner);
- yyextra->inputString = orgInputString;
+ yyextra->inputString = orgInputString;
yyextra->inputPosition = orgInputPosition;
@@ -7424,7 +7445,7 @@ bool COutlineParser::needsPreprocessing(const QCString &extension) const
QCString fe=extension.lower();
SrcLangExt lang = getLanguageFromFileName(extension);
return (SrcLangExt_Cpp == lang) ||
- !( fe==".java" || fe==".as" || fe==".d" || fe==".php" ||
+ !( fe==".java" || fe==".as" || fe==".d" || fe==".php" ||
fe==".php4" || fe==".inc" || fe==".phtml"|| fe==".php5"
);
}
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index ec7f7d6..d9e5c99 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -956,7 +956,7 @@ void writeJavaScriptSearchIndex()
QCString baseName;
baseName.sprintf("%s_%x",g_searchIndexInfo[i].name.data(),p);
- QCString fileName = searchDirName + "/"+baseName+".html";
+ QCString fileName = searchDirName + "/"+baseName+Doxygen::htmlFileExtension;
QCString dataFileName = searchDirName + "/"+baseName+".js";
QFile outFile(fileName);
@@ -1268,7 +1268,7 @@ void writeJavaScriptSearchIndex()
ResourceMgr::instance().copyResource("search.js",searchDirName);
}
{
- QFile f(searchDirName+"/nomatches.html");
+ QFile f(searchDirName+"/nomatches"+Doxygen::htmlFileExtension);
if (f.open(IO_WriteOnly))
{
FTextStream t(&f);
diff --git a/src/sqlcode.h b/src/sqlcode.h
index 20e20f7..aa465d7 100644
--- a/src/sqlcode.h
+++ b/src/sqlcode.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2014 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -32,6 +30,8 @@ class Definition;
class SQLCodeParser : public CodeParserInterface
{
public:
+ SQLCodeParser();
+ virtual ~SQLCodeParser();
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
@@ -48,6 +48,9 @@ class SQLCodeParser : public CodeParserInterface
bool collectXRefs=TRUE
);
void resetCodeParserState();
+ private:
+ struct Private;
+ std::unique_ptr<Private> p;
};
diff --git a/src/sqlcode.l b/src/sqlcode.l
index 22a5e17..1ca9204 100644
--- a/src/sqlcode.l
+++ b/src/sqlcode.l
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * Copyright (C) 1997-2014 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -60,9 +60,9 @@ struct sqlcodeYY_state
QCString exampleName;
QCString classScope;
- FileDef *sourceFileDef;
- Definition *currentDefinition;
- MemberDef *currentMemberDef;
+ const FileDef *sourceFileDef;
+ const Definition *currentDefinition;
+ const MemberDef *currentMemberDef;
bool includeCodeFragment;
const char *currentFontClass;
};
@@ -71,18 +71,18 @@ struct sqlcodeYY_state
static const char *stateToString(int state);
#endif
-static void setCurrentDoc(const QCString &anchor,yyscan_t yyscanner);
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor);
static void startCodeLine(yyscan_t yyscanner);
static void endFontClass(yyscan_t yyscanner);
static void endCodeLine(yyscan_t yyscanner);
static void nextCodeLine(yyscan_t yyscanner);
-static void codifyLines(char *text,yyscan_t yyscanner);
-static void startFontClass(const char *s,yyscan_t yyscanner);
+static void codifyLines(yyscan_t yyscanner,const char *text);
+static void startFontClass(yyscan_t yyscanner,const char *s);
static int countLines(yyscan_t yyscanner);
-static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner);
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner);
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
%}
@@ -110,7 +110,7 @@ typekeyword (?i:"ARRAY"|"BIGINT"|"BINARY"|"BLOB"|"BOOLEAN"|"CHAR"|"CHARACTER
flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
-literalkeyword (?i:"FALSE"|"TRUE"|"NULL"|"UNKNOWN")
+literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
stringliteral (\"[^"]*\")|('[^']*')
number [0-9]+
literals ({literalkeyword}|{stringliteral}|{number})
@@ -126,107 +126,107 @@ commentclose "\*/"
%%
{literals} {
- startFontClass("stringliteral",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"stringliteral");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
-
+
{keyword} {
- startFontClass("keyword",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"keyword");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
{flowkeyword} {
- startFontClass("keywordflow",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"keywordflow");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
{typekeyword} {
- startFontClass("keywordtype",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"keywordtype");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
{variable} {
- startFontClass("preprocessor",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"preprocessor");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
{simplecomment} {
- startFontClass("comment",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
}
{commentopen} {
- startFontClass("comment",yyscanner);
- codifyLines(yytext,yyscanner);
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
BEGIN(COMMENT);
}
<COMMENT>. {
- codifyLines(yytext,yyscanner);
-
+ codifyLines(yyscanner,yytext);
+
}
<COMMENT>{nl} {
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
}
<COMMENT>{commentclose} {
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
endFontClass(yyscanner);
BEGIN(INITIAL);
}
-
+
{idchar} {
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
}
{nl} {
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
}
[\x80-\xFF]* { // keep utf8 characters together...
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
}
. {
- codifyLines(yytext,yyscanner);
+ codifyLines(yyscanner,yytext);
}
%%
-static void setCurrentDoc(const QCString &anchor, yyscan_t yyscanner)
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
if (yyextra->searchCtx)
{
- Doxygen::searchIndex->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),FALSE);
+ yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),false);
}
else
{
- Doxygen::searchIndex->setCurrentDoc(yyextra->sourceFileDef,anchor,TRUE);
+ yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,true);
}
}
}
/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
- * is TRUE. If a definition starts at the current line, then the line
+ * is true. If a definition starts at the current line, then the line
* number is linked to the documentation of that definition.
*/
static void startCodeLine(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->sourceFileDef)
- {
- Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
-
+ {
+ const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
+
if (!yyextra->includeCodeFragment && d && d->isLinkableInProject())
{
yyextra->currentDefinition = d;
@@ -239,14 +239,14 @@ static void startCodeLine(yyscan_t yyscanner)
yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
yyextra->currentMemberDef->getOutputFileBase(),
yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
- setCurrentDoc(lineAnchor,yyscanner);
+ setCurrentDoc(yyscanner,lineAnchor);
}
else
{
yyextra->code->writeLineNumber(d->getReference(),
d->getOutputFileBase(),
0,yyextra->yyLineNr);
- setCurrentDoc(lineAnchor,yyscanner);
+ setCurrentDoc(yyscanner,lineAnchor);
}
}
else
@@ -254,9 +254,9 @@ static void startCodeLine(yyscan_t yyscanner)
yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr);
}
}
-
+
yyextra->code->startCodeLine(yyextra->sourceFileDef);
-
+
if (yyextra->currentFontClass)
{
yyextra->code->startFontClass(yyextra->currentFontClass);
@@ -285,42 +285,43 @@ static void nextCodeLine(yyscan_t yyscanner)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
const char *fc = yyextra->currentFontClass;
endCodeLine(yyscanner);
- if (yyextra->yyLineNr<yyextra->inputLines)
+ if (yyextra->yyLineNr<yyextra->inputLines)
{
yyextra->currentFontClass = fc;
startCodeLine(yyscanner);
}
}
-static void codifyLines(char *text,yyscan_t yyscanner)
+static void codifyLines(yyscan_t yyscanner,const char *text)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- char *p=text,*sp=p;
+ const char *p=text,*sp=p;
char c;
- bool done=FALSE;
-
+ bool done=false;
while (!done)
{
sp=p;
-
while ((c=*p++) && c!='\n') { }
-
if (c=='\n')
{
yyextra->yyLineNr++;
- *(p-1)='\0';
- yyextra->code->codify(sp);
+ int l = (int)(p-sp-1);
+ char *tmp = (char*)malloc(l+1);
+ memcpy(tmp,sp,l);
+ tmp[l]='\0';
+ yyextra->code->codify(tmp);
+ free(tmp);
nextCodeLine(yyscanner);
}
else
{
yyextra->code->codify(sp);
- done=TRUE;
+ done=true;
}
}
}
-static void startFontClass(const char *s,yyscan_t yyscanner)
+static void startFontClass(yyscan_t yyscanner,const char *s)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
endFontClass(yyscanner);
@@ -335,103 +336,128 @@ static int countLines(yyscan_t yyscanner)
const char *p=yyextra->inputString;
char c;
int count=1;
- while ((c=*p))
- {
- p++ ;
- if (c=='\n') count++;
+ while ((c=*p))
+ {
+ p++ ;
+ if (c=='\n') count++;
}
- if (p>yyextra->inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
- count++,
- yyextra->needsTermination=TRUE;
- }
+ count++,
+ yyextra->needsTermination=true;
+ }
return count;
}
-static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner)
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yy_size_t inputPosition = yyextra->inputPosition;
+ const char *s = yyextra->inputString + inputPosition;
yy_size_t c=0;
- while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
+ while( c < max_size && *s )
{
- *buf = yyextra->inputString[yyextra->inputPosition++] ;
- c++; buf++;
+ *buf++ = *s++;
+ c++;
}
+ yyextra->inputPosition += c;
return c;
}
// public interface -----------------------------------------------------------
-static yyscan_t yyscanner;
-static struct sqlcodeYY_state sqlcode_extra;
-
-void parseSqlCode(
- CodeOutputInterface &od,
- const char * /*className*/,
- const QCString &s,
- bool exBlock,
- const char *exName,
- FileDef *fd,
- int startLine,
- int endLine,
- bool inlineFragment,
- const MemberDef *,
- bool,const Definition *searchCtx,
- bool /*collectXRefs*/
- )
-{
- if (s.isEmpty()) return;
-
- sqlcodeYYlex_init_extra(&sqlcode_extra, &yyscanner);
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+struct SQLCodeParser::Private
+{
+ yyscan_t yyscanner;
+ sqlcodeYY_state state;
+};
+
+SQLCodeParser::SQLCodeParser() : p(std::make_unique<Private>())
+{
+ sqlcodeYYlex_init_extra(&p->state, &p->yyscanner);
#ifdef FLEX_DEBUG
sqlcodeYYset_debug(1,yyscanner);
#endif
+ resetCodeParserState();
+}
- printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
-
- yyextra->code = &od;
- yyextra->inputString = s;
+SQLCodeParser::~SQLCodeParser()
+{
+ sqlcodeYYlex_destroy(p->yyscanner);
+}
+
+void SQLCodeParser::resetCodeParserState()
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+}
+
+void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
+ const char *scopeName,
+ const QCString &input,
+ SrcLangExt,
+ bool isExampleBlock,
+ const char *exampleName,
+ FileDef *fileDef,
+ int startLine,
+ int endLine,
+ bool inlineFragment,
+ const MemberDef *memberDef,
+ bool showLineNumbers,
+ const Definition *searchCtx,
+ bool collectXRefs
+ )
+{
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+
+ if (input.isEmpty()) return;
+
+ printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
+
+ yyextra->code = &codeOutIntf;
+ yyextra->inputString = input;
yyextra->inputPosition = 0;
yyextra->currentFontClass = 0;
- yyextra->needsTermination = FALSE;
+ yyextra->needsTermination = false;
yyextra->searchCtx=searchCtx;
-
+
if (startLine!=-1)
yyextra->yyLineNr = startLine;
else
yyextra->yyLineNr = 1;
-
+
if (endLine!=-1)
yyextra->inputLines = endLine+1;
else
yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
-
- yyextra->exampleBlock = exBlock;
- yyextra->exampleName = exName;
- yyextra->sourceFileDef = fd;
-
- bool cleanupSourceDef = FALSE;
-
- if (exBlock && fd==0)
+
+ yyextra->exampleBlock = isExampleBlock;
+ yyextra->exampleName = exampleName;
+ yyextra->sourceFileDef = fileDef;
+
+ bool cleanupSourceDef = false;
+
+ if (isExampleBlock && fileDef==0)
{
// create a dummy filedef for the example
- yyextra->sourceFileDef = createFileDef("",(exName?exName:"generated"));
- cleanupSourceDef = TRUE;
+ yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated"));
+ cleanupSourceDef = true;
}
-
- if (yyextra->sourceFileDef)
+
+ if (yyextra->sourceFileDef)
{
- setCurrentDoc("l00001",yyscanner);
+ setCurrentDoc(yyscanner,"l00001");
}
yyextra->includeCodeFragment = inlineFragment;
- // Starts line 1 on the output
+ // Starts line 1 on the output
startCodeLine(yyscanner);
- sqlcodeYYrestart( yyin,yyscanner );
+ sqlcodeYYrestart( 0, yyscanner );
sqlcodeYYlex(yyscanner);
@@ -445,45 +471,8 @@ void parseSqlCode(
delete yyextra->sourceFileDef;
yyextra->sourceFileDef=0;
}
-
- printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
- sqlcodeYYlex_destroy(yyscanner);
- return;
-}
-
-void resetSqlCodeParserState()
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yyextra->currentDefinition = 0;
- yyextra->currentMemberDef = 0;
-}
-
-//---------------------------------------------------------------------------------
-void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
- const char *scopeName,
- const QCString &input,
- SrcLangExt,
- bool isExampleBlock,
- const char *exampleName,
- FileDef *fileDef,
- int startLine,
- int endLine,
- bool inlineFragment,
- const MemberDef *memberDef,
- bool showLineNumbers,
- const Definition *searchCtx,
- bool collectXRefs
- )
-{
- parseSqlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
- fileDef,startLine,endLine,inlineFragment,memberDef,
- showLineNumbers,searchCtx,collectXRefs);
-}
-
-void SQLCodeParser::resetCodeParserState()
-{
- resetSqlCodeParserState();
+ printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
}
//---------------------------------------------------------------------------------
diff --git a/src/util.cpp b/src/util.cpp
index acc6098..8310862 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -31,7 +31,6 @@
#include <qfileinfo.h>
#include <qdir.h>
#include <qdatetime.h>
-#include <qcache.h>
#include "util.h"
#include "message.h"
@@ -1028,7 +1027,6 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi
}
done:
accessStack.pop();
- //Doxygen::lookupCache.insert(key,new int(result));
return result;
}
@@ -1196,7 +1194,6 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop
done:
//printf(" > result=%d\n",result);
accessStack.pop();
- //Doxygen::lookupCache.insert(key,new int(result));
return result;
}
@@ -1208,7 +1205,7 @@ int computeQualifiedIndex(const QCString &name)
static void getResolvedSymbol(const Definition *scope,
const FileDef *fileScope,
- Definition *d,
+ const Definition *d,
const QCString &explicitScopePart,
const std::unique_ptr<ArgumentList> &actTemplParams,
int &minDistance,
@@ -1224,7 +1221,7 @@ static void getResolvedSymbol(const Definition *scope,
// only look at classes and members that are enums or typedefs
if (d->definitionType()==Definition::TypeClass ||
(d->definitionType()==Definition::TypeMember &&
- ((dynamic_cast<MemberDef*>(d))->isTypedef() || (dynamic_cast<MemberDef*>(d))->isEnumerate())
+ ((dynamic_cast<const MemberDef*>(d))->isTypedef() || (dynamic_cast<const MemberDef*>(d))->isEnumerate())
)
)
{
@@ -1237,7 +1234,7 @@ static void getResolvedSymbol(const Definition *scope,
// see if we are dealing with a class or a typedef
if (d->definitionType()==Definition::TypeClass) // d is a class
{
- ClassDef *cd = dynamic_cast<ClassDef *>(d);
+ const ClassDef *cd = dynamic_cast<const ClassDef *>(d);
//printf("cd=%s\n",cd->name().data());
if (!cd->isTemplateArgument()) // skip classes that
// are only there to
@@ -1282,7 +1279,7 @@ static void getResolvedSymbol(const Definition *scope,
}
else if (d->definitionType()==Definition::TypeMember)
{
- MemberDef *md = dynamic_cast<MemberDef *>(d);
+ const MemberDef *md = dynamic_cast<const MemberDef *>(d);
//printf(" member isTypedef()=%d\n",md->isTypedef());
if (md->isTypedef()) // d is a typedef
{
@@ -1365,6 +1362,8 @@ static void getResolvedSymbol(const Definition *scope,
//printf(" bestMatch=%p bestResolvedType=%s\n",bestMatch,bestResolvedType.data());
}
+static std::mutex g_cacheMutex;
+
/* Find the fully qualified class name referred to by the input class
* or typedef name against the input scope.
* Loops through scope and each of its parent scopes looking for a
@@ -1411,7 +1410,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope,
}
//printf("Looking for symbol %s\n",name.data());
- DefinitionIntf *di = Doxygen::symbolMap->find(name);
+ const DefinitionIntf *di = Doxygen::symbolMap->find(name);
// the -g (for C# generics) and -p (for ObjC protocols) are now already
// stripped from the key used in the symbolMap, so that is not needed here.
if (di==0)
@@ -1468,26 +1467,30 @@ static const ClassDef *getResolvedClassRec(const Definition *scope,
}
*p='\0';
- LookupInfo *pval=Doxygen::lookupCache->find(key);
- //printf("Searching for %s result=%p\n",key.data(),pval);
- if (pval)
- {
- //printf("LookupInfo %p %p '%s' %p\n",
- // pval->classDef, pval->typeDef, pval->templSpec.data(),
- // pval->resolvedType.data());
- if (pTemplSpec) *pTemplSpec=pval->templSpec;
- if (pTypeDef) *pTypeDef=pval->typeDef;
- if (pResolvedType) *pResolvedType=pval->resolvedType;
- //printf("] cachedMatch=%s\n",
- // pval->classDef?pval->classDef->name().data():"<none>");
- //if (pTemplSpec)
- // printf("templSpec=%s\n",pTemplSpec->data());
- return pval->classDef;
- }
- else // not found yet; we already add a 0 to avoid the possibility of
- // endless recursion.
+ LookupInfo *pval = 0;
{
- Doxygen::lookupCache->insert(key,new LookupInfo);
+ std::lock_guard<std::mutex> lock(g_cacheMutex);
+ pval=Doxygen::lookupCache->find(key.str());
+ //printf("Searching for %s result=%p\n",key.data(),pval);
+ if (pval)
+ {
+ //printf("LookupInfo %p %p '%s' %p\n",
+ // pval->classDef, pval->typeDef, pval->templSpec.data(),
+ // pval->resolvedType.data());
+ if (pTemplSpec) *pTemplSpec=pval->templSpec;
+ if (pTypeDef) *pTypeDef=pval->typeDef;
+ if (pResolvedType) *pResolvedType=pval->resolvedType;
+ //printf("] cachedMatch=%s\n",
+ // pval->classDef?pval->classDef->name().data():"<none>");
+ //if (pTemplSpec)
+ // printf("templSpec=%s\n",pTemplSpec->data());
+ return pval->classDef;
+ }
+ else // not found yet; we already add a 0 to avoid the possibility of
+ // endless recursion.
+ {
+ pval = Doxygen::lookupCache->insert(key.str(),LookupInfo());
+ }
}
const ClassDef *bestMatch=0;
@@ -1533,18 +1536,14 @@ static const ClassDef *getResolvedClassRec(const Definition *scope,
//printf("getResolvedClassRec: bestMatch=%p pval->resolvedType=%s\n",
// bestMatch,bestResolvedType.data());
- pval=Doxygen::lookupCache->find(key);
if (pval)
{
+ std::lock_guard<std::mutex> lock(g_cacheMutex);
pval->classDef = bestMatch;
pval->typeDef = bestTypedef;
pval->templSpec = bestTemplSpec;
pval->resolvedType = bestResolvedType;
}
- else
- {
- Doxygen::lookupCache->insert(key,new LookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType));
- }
//printf("] bestMatch=%s distance=%d\n",
// bestMatch?bestMatch->name().data():"<none>",minDistance);
//if (pTemplSpec)
@@ -1828,7 +1827,7 @@ QCString removeRedundantWhiteSpace(const QCString &s)
{
if (nc != '=')
// avoid splitting operator&=
- {
+ {
*dst++=' ';
}
}
@@ -2263,7 +2262,7 @@ QCString argListToString(const ArgumentList &al,bool useCanonicalType,bool showD
if (al.volatileSpecifier()) result+=" volatile";
if (al.refQualifier()==RefQualifierLValue) result+=" &";
else if (al.refQualifier()==RefQualifierRValue) result+=" &&";
- if (!al.trailingReturnType().isEmpty()) result+=" -> "+al.trailingReturnType();
+ if (!al.trailingReturnType().isEmpty()) result+=al.trailingReturnType();
if (al.pureSpecifier()) result+=" =0";
return removeRedundantWhiteSpace(result);
}
@@ -4487,7 +4486,7 @@ struct FindFileCacheElem
bool isAmbig;
};
-static QCache<FindFileCacheElem> g_findFileDefCache(5000);
+static Cache<std::string,FindFileCacheElem> g_findFileDefCache(5000);
static std::mutex g_findFileDefMutex;
@@ -4504,8 +4503,7 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig)
QCString key = addr;
key+=n;
- g_findFileDefCache.setAutoDelete(TRUE);
- FindFileCacheElem *cachedResult = g_findFileDefCache.find(key);
+ FindFileCacheElem *cachedResult = g_findFileDefCache.find(key.str());
//printf("key=%s cachedResult=%p\n",key.data(),cachedResult);
if (cachedResult)
{
@@ -4515,7 +4513,7 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig)
}
else
{
- cachedResult = new FindFileCacheElem(0,FALSE);
+ cachedResult = g_findFileDefCache.insert(key.str(),FindFileCacheElem(0,FALSE));
}
QCString name=QDir::cleanDirPath(n).utf8();
@@ -4543,8 +4541,6 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig)
if (path.isEmpty() || isSamePath)
{
cachedResult->fileDef = fd.get();
- g_findFileDefCache.insert(key,cachedResult);
- //printf("=1 ===> add to cache %p\n",fd);
return fd.get();
}
}
@@ -4563,12 +4559,10 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig)
lastMatch=fd;
}
}
- //printf(">1 ===> add to cache %p\n",fd);
ambig=(count>1);
cachedResult->isAmbig = ambig;
cachedResult->fileDef = lastMatch;
- g_findFileDefCache.insert(key,cachedResult);
return lastMatch;
}
}
@@ -4577,8 +4571,6 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig)
//printf("not found!\n");
}
exit:
- //printf("0 ===> add to cache %p: %s\n",cachedResult,n);
- g_findFileDefCache.insert(key,cachedResult);
//delete cachedResult;
return 0;
}
@@ -4732,11 +4724,10 @@ bool hasVisibleRoot(const BaseClassList *bcl)
// note that this function is not reentrant due to the use of static growBuf!
QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore)
{
- static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES);
- static bool allowUnicodeNames = Config_getBool(ALLOW_UNICODE_NAMES);
- static GrowBuf growBuf;
- growBuf.clear();
+ bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES);
+ bool allowUnicodeNames = Config_getBool(ALLOW_UNICODE_NAMES);
if (name==0) return "";
+ GrowBuf growBuf;
signed char c;
const signed char *p=(const signed char*)name;
while ((c=*p++)!=0)
@@ -5230,9 +5221,8 @@ QCString stripScope(const char *name)
QCString convertToId(const char *s)
{
static const char hex[] = "0123456789ABCDEF";
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
const char *p=s;
char c;
bool first=TRUE;
@@ -5271,9 +5261,8 @@ QCString correctId(QCString s)
/*! Converts a string to an XML-encoded string */
QCString convertToXML(const char *s, bool keepEntities)
{
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
const char *p=s;
char c;
while ((c=*p++))
@@ -5323,9 +5312,8 @@ QCString convertToXML(const char *s, bool keepEntities)
/*! Converts a string to an DocBook-encoded string */
QCString convertToDocBook(const char *s)
{
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
const unsigned char *q;
int cnt;
const unsigned char *p=(const unsigned char *)s;
@@ -5383,9 +5371,8 @@ QCString convertToDocBook(const char *s)
/*! Converts a string to a HTML-encoded string */
QCString convertToHtml(const char *s,bool keepEntities)
{
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
growBuf.addStr(getHtmlDirEmbeddingChar(getTextDirByConfig(s)));
const char *p=s;
char c;
@@ -5430,9 +5417,8 @@ QCString convertToHtml(const char *s,bool keepEntities)
QCString convertToJSString(const char *s, bool applyTextDir)
{
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
if (applyTextDir)
growBuf.addStr(getJsDirEmbeddingChar(getTextDirByConfig(s)));
const char *p=s;
@@ -5452,9 +5438,8 @@ QCString convertToJSString(const char *s, bool applyTextDir)
QCString convertToPSString(const char *s)
{
- static GrowBuf growBuf;
- growBuf.clear();
if (s==0) return "";
+ GrowBuf growBuf;
const char *p=s;
char c;
while ((c=*p++))
@@ -5474,7 +5459,7 @@ QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces)
{
QGString result;
FTextStream t(&result);
- filterLatexString(t,s,insideTabbing,FALSE,FALSE,keepSpaces);
+ filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
return result.data();
}
@@ -5486,8 +5471,7 @@ QCString convertCharEntitiesToUTF8(const QCString &s)
static QRegExp entityPat("&[a-zA-Z]+[0-9]*;");
if (s.length()==0) return result;
- static GrowBuf growBuf;
- growBuf.clear();
+ GrowBuf growBuf;
int p,i=0,l;
while ((p=entityPat.match(s,i,&l))!=-1)
{
@@ -5714,7 +5698,7 @@ QCString normalizeNonTemplateArgumentsInString(
result += name.mid(p,i-p);
QCString n = name.mid(i,l);
bool found=FALSE;
- for (const Argument formArg : formalArgs)
+ for (const Argument &formArg : formalArgs)
{
if (formArg.name == n)
{
@@ -6166,7 +6150,7 @@ void addGroupListToTitle(OutputList &ol,const Definition *d)
}
void filterLatexString(FTextStream &t,const char *str,
- bool insideTabbing,bool insidePre,bool insideItem,bool keepSpaces)
+ bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces)
{
if (str==0) return;
//if (strlen(str)<2) stackTrace();
@@ -6203,7 +6187,7 @@ void filterLatexString(FTextStream &t,const char *str,
case '$': t << "\\$"; break;
case '"': t << "\"{}"; break;
case '-': t << "-\\/"; break;
- case '^': (usedTableLevels()>0) ? t << "\\string^" : t << (char)c; break;
+ case '^': insideTable ? t << "\\string^" : t << (char)c; break;
case '~': t << "\\string~"; break;
case ' ': if (keepSpaces) t << "~"; else t << ' ';
break;
@@ -6297,7 +6281,7 @@ void filterLatexString(FTextStream &t,const char *str,
default:
//if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
if (!insideTabbing &&
- ((c>='A' && c<='Z' && pc!=' ' && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c)))
+ ((c>='A' && c<='Z' && pc!=' ' && !(pc>='A' && pc <= 'Z') && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c)))
)
{
t << "\\+";
@@ -6340,7 +6324,13 @@ QCString latexEscapeLabelName(const char *s)
p++;
}
tmp[i]=0;
- filterLatexString(t,tmp,TRUE);
+ filterLatexString(t,tmp,
+ true, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ false, // insideTable
+ false // keepSpaces
+ );
break;
}
}
@@ -6379,7 +6369,13 @@ QCString latexEscapeIndexChars(const char *s)
p++;
}
tmp[i]=0;
- filterLatexString(t,tmp.data(),TRUE);
+ filterLatexString(t,tmp.data(),
+ true, // insideTabbing
+ false, // insidePre
+ false, // insideItem
+ false, // insideTable
+ false // keepSpaces
+ );
break;
}
}
@@ -8457,20 +8453,56 @@ void writeLatexSpecialFormulaChars(FTextStream &t)
}
//------------------------------------------------------
+// simplified way to know if this is fixed form
+bool recognizeFixedForm(const char* contents, FortranFormat format)
+{
+ int column=0;
+ bool skipLine=FALSE;
-static int g_usedTableLevels = 0;
+ if (format == FortranFormat_Fixed) return TRUE;
+ if (format == FortranFormat_Free) return FALSE;
-void incUsedTableLevels()
-{
- g_usedTableLevels++;
-}
-void decUsedTableLevels()
-{
- g_usedTableLevels--;
+ for(int i=0;;i++) {
+ column++;
+
+ switch(contents[i]) {
+ case '\n':
+ column=0;
+ skipLine=FALSE;
+ break;
+ case ' ':
+ break;
+ case '\000':
+ return FALSE;
+ case '#':
+ skipLine=TRUE;
+ break;
+ case 'C':
+ case 'c':
+ case '*':
+ if (column==1) return TRUE;
+ if (skipLine) break;
+ return FALSE;
+ case '!':
+ if (column>1 && column<7) return FALSE;
+ skipLine=TRUE;
+ break;
+ default:
+ if (skipLine) break;
+ if (column>=7) return TRUE;
+ return FALSE;
+ }
+ }
+ return FALSE;
}
-int usedTableLevels()
+
+FortranFormat convertFileNameFortranParserCode(QCString fn)
{
- return g_usedTableLevels;
-}
+ QCString ext = getFileNameExtension(fn);
+ QCString parserName = Doxygen::parserManager->getParserName(ext.data());
-//------------------------------------------------------
+ if (parserName == "fortranfixed") return FortranFormat_Fixed;
+ else if (parserName == "fortranfree") return FortranFormat_Free;
+
+ return FortranFormat_Unknown;
+}
diff --git a/src/util.h b/src/util.h
index 7de25ee..76a9a6c 100644
--- a/src/util.h
+++ b/src/util.h
@@ -351,10 +351,11 @@ QCString unescapeCharsInString(const char *s);
void addGroupListToTitle(OutputList &ol,const Definition *d);
void filterLatexString(FTextStream &t,const char *str,
- bool insideTabbing=FALSE,
- bool insidePre=FALSE,
- bool insideItem=FALSE,
- bool keepSpaces=FALSE);
+ bool insideTabbing,
+ bool insidePre,
+ bool insideItem,
+ bool insideTable,
+ bool keepSpaces);
QCString latexEscapeLabelName(const char *s);
QCString latexEscapeIndexChars(const char *s);
@@ -498,8 +499,7 @@ bool openOutputFile(const char *outFile,QFile &f);
void writeExtraLatexPackages(FTextStream &t);
void writeLatexSpecialFormulaChars(FTextStream &t);
-int usedTableLevels();
-void incUsedTableLevels();
-void decUsedTableLevels();
+bool recognizeFixedForm(const char* contents, FortranFormat format);
+FortranFormat convertFileNameFortranParserCode(QCString fn);
#endif
diff --git a/src/vhdlcode.h b/src/vhdlcode.h
index b79e2ab..48c15bb 100644
--- a/src/vhdlcode.h
+++ b/src/vhdlcode.h
@@ -1,3 +1,17 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
#ifndef VHDLCODE_H
#define VHDLCODE_H
@@ -12,7 +26,8 @@ void codeFreeVhdlScanner();
class VHDLCodeParser : public CodeParserInterface
{
public:
- virtual ~VHDLCodeParser() {}
+ VHDLCodeParser();
+ virtual ~VHDLCodeParser();
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
@@ -28,8 +43,10 @@ class VHDLCodeParser : public CodeParserInterface
const Definition *searchCtx=0,
bool collectXRefs=TRUE
);
- void resetCodeParserState() {}
+ void resetCodeParserState();
+ private:
+ struct Private;
+ std::unique_ptr<Private> p;
};
-
-#endif
+#endif
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index dcace05..cecf9fb 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -20,12 +20,17 @@
%option never-interactive
%option case-insensitive
%option prefix="vhdlcodeYY"
+%option reentrant
+%option extra-type="struct vhdlcodeYY_state *"
%top{
#include <stdint.h>
}
%{
+#include <unordered_set>
+#include <string>
+
/*
* includes
*/
@@ -55,11 +60,11 @@
#define YY_NO_UNISTD_H 1
#define USE_STATE2STRING 0
-
+
// Toggle for some debugging info
//#define DBG_CTX(x) fprintf x
#define DBG_CTX(x) do { } while(0)
-
+
/* -----------------------------------------------------------------
* statics
@@ -67,57 +72,70 @@
// ----------------- <vhdl> ----------------------------------
-//static bool isPackBody=FALSE;
-//static bool isStartMap;
-static bool isFuncProto=FALSE;
-static bool isComponent=FALSE;
-static bool isPackageBody=FALSE;
-static bool isProto = FALSE;
-static bool g_startCode = FALSE;
-static QCString g_PrevString;
-static QCString g_CurrClass;
-static QDict<QCString>g_vhdlKeyDict;
-static QCString g_tempComp;
-static QCString g_PortMapComp;
-static MemberDef *g_vhdlMember;
-static QCString g_FuncProto;
-
-//-----------------------------------------------------------
-
-static CodeOutputInterface * g_code;
-static QCString g_parmType;
-static QCString g_parmName;
-static const char * g_inputString; //!< the code fragment as text
-static int g_inputPosition; //!< read offset during parsing
-static int g_inputLines; //!< number of line in the code fragment
-static int g_yyLineNr; //!< current line number
-static bool g_needsTermination;
-static const Definition *g_searchCtx;
-
-static bool g_exampleBlock;
-static QCString g_exampleName;
-static QCString g_exampleFile;
-
-static QCString g_classScope;
-
-static bool g_CurrARCH = FALSE;
-
-static FileDef * g_sourceFileDef;
-static Definition * g_currentDefinition;
-static MemberDef * g_currentMemberDef;
-static bool g_includeCodeFragment;
-static const char * g_currentFontClass;
-
-static bool g_lexInit = FALSE;
-static int g_braceCount=0;
-
-
-static void writeFont(const char *s,const char* text);
-static void generateMemLink(CodeOutputInterface &ol,QCString &clName,QCString& memberName);
-static bool writeColoredWord(QCString& word );
-static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, bool typeOnly=FALSE, const char *curr_class=0);
-static void endFontClass();
-static void startFontClass(const char *s);
+struct vhdlcodeYY_state
+{
+ bool isFuncProto = false;
+ bool isComponent = false;
+ bool isPackageBody = false;
+ bool isProto = false;
+ bool startCode = false;
+ QCString prevString;
+ QCString currClass;
+ std::unordered_set<std::string> vhdlKeyDict;
+ QCString tempComp;
+ QCString PortMapComp;
+ const MemberDef * vhdlMember = 0;
+ QCString funcProto;
+
+ CodeOutputInterface * code = 0;
+ const char * inputString = 0; //!< the code fragment as text
+ int inputPosition = 0; //!< read offset during parsing
+ int inputLines = 0; //!< number of line in the code fragment
+ int yyLineNr = 0; //!< current line number
+ bool needsTermination = false;
+ const Definition *searchCtx = 0;
+
+ bool exampleBlock = false;
+ QCString exampleName;
+ QCString exampleFile;
+
+ bool currArch = false;
+
+ const FileDef * sourceFileDef = 0;
+ const Definition * currentDefinition = 0;
+ const MemberDef * currentMemberDef = 0;
+ bool includeCodeFragment = false;
+ const char * currentFontClass = 0;
+
+ bool lexInit = false;
+ int braceCount = 0;
+};
+
+
+static void writeFont(yyscan_t yyscanner,const char *s,const char* text);
+static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString &clName,QCString& memberName);
+static bool writeColoredWord(yyscan_t yyscanner,QCString& word );
+static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, bool typeOnly=false, const char *curr_class=0);
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor);
+static bool checkVhdlString(yyscan_t yyscanner,QCString &name);
+static void addToSearchIndex(yyscan_t yyscanner,const char *text);
+static void startCodeLine(yyscan_t yyscanner);
+static void endCodeLine(yyscan_t yyscanner);
+static void nextCodeLine(yyscan_t yyscanner);
+static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class=0,bool classLink=false);
+static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl=0,bool classlink=false,bool comment=false);
+static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
+ Definition *d,
+ const char *text);
+static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef* mdef);
+static int countLines(yyscan_t yyscanner);
+static void endFontClass(yyscan_t yyscanner);
+static void startFontClass(yyscan_t yyscanner,const char *s);
+static void appStringLower(QCString& qcs,const char* text);
+static void codifyMapLines(yyscan_t yyscanner,const char *text);
+static void writeFuncProto(yyscan_t yyscanner);
+static void writeProcessProto(yyscan_t yyscanner);
+static int yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
#if USE_STATE2STRING
static const char *stateToString(int state);
@@ -125,24 +143,818 @@ static const char *stateToString(int state);
//-------------------------------------------------------------------
-static void setCurrentDoc(const QCString &anchor)
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+
+%}
+
+
+B [ \t]
+BN [ \t\n\r]
+STRING ["][^"\n]*["]
+NAME [a-z_A-Z][ a-z_A-Z0-9]*
+FUNCNAME [a-z_A-Z"][a-z_A-Z0-9+*"/=<>-]*
+ID "$"?[a-z_A-Z][a-z_A-Z0-9]*
+SPECSIGN [:;, +*&\/=<>'\t]*
+DIGITSS [0-9]+|[0-9]+("#")*[0-9_a-fA-F\+\.\-]+("#")*
+ALLTYPESMAP {B}*[_a-zA-Z0-9. ]+{BN}*
+ALLTYPESMAP1 {BN}*[_a-zA-Z0-9.() ]+{BN}*
+
+ARCHITECTURE ^{B}*("architecture"){BN}+{FUNCNAME}{BN}+("of"){BN}+{FUNCNAME}{BN}+("is")
+PROCESS ({BN}*{FUNCNAME}{BN}*[:]+{BN}*("process"){BN}*[(]*)|[^a-zA-Z]("process "|"process("){BN}*[ (]*|[^a-zA-Z]("process"){BN}+
+
+END1 {B}*("end "){BN}+("if"|"case"|"loop"|"generate"|"for")
+END2 [^a-zA-Z_]("end"){BN}*[;]
+END3 {BN}*[^a-zA-Z]("end"){BN}+{FUNCNAME}{BN}*[;]
+END4 {B}*("end"){BN}+"function"{BN}+{FUNCNAME}{BN}*[;]
+ENDEFUNC {END3}|{END4}|{END2}
+
+KEYWORD ("of"|"new"|"event"|"break"|"case"|"end"|"loop"|"else"|"for"|"goto"|"if"|"return"|"generate"|"is"|"while"|"in")
+TYPEKW ^{B}*("type"|"subtype"|"constant"|"attribute"|"signal"|"variable","alias","configuration")
+FUNC ^{B}*("function"|"procedure"){BN}*{FUNCNAME}{BN}*("(")
+
+ARITHOP "+"|"-"|"/"|"*"|"%"|"/="|":="
+ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
+LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"
+BITOP "&"|"|"|"^"|"<<"|">>"|"~"
+OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
+
+PORT {B}*("port"){BN}*("(")
+GENERIC {B}*("generic"){BN}*("(")
+
+BRACEOPEN [(]{1}
+BRACECLOSE [)]{1}
+
+TEXTT {B}*"--"[^\n]*
+
+MAPCOMPONENT1 ({ALLTYPESMAP}[:]{ALLTYPESMAP}{TEXTT}*{BN}+("port"|"generic"){BN}+("map"){BN}*("("){1})
+MAPCOMPONENT2 {BN}*("port"|"generic"){BN}+("map"){BN}*("("){1}
+MAPCOMPONENT3 ({ALLTYPESMAP}[:]{BN}*{ALLTYPESMAP1}{TEXTT}*{BN}+("port"|"generic"){BN}+("map"){BN}*("("){1})
+MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{ALLTYPESMAP1}{TEXTT}*{BN}*("port"|"generic"){BN}*("map"){BN}*("("){1})
+
+XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFIG"|"CONFIG_MODE"|"COOL_CLK"|"DATA_GATE"|"DCI_VALUE"|"DISABLE"|"DRIVE"|"DROP_SPEC"|"ENABLE"|"FAST"|"FEEDBACK"|"FILE"|"FLOAT"|"FROM-THRU-TO"|"FROM-TO"|"HBLKNM"|"HU_SET"|"INREG"|"IOB"|"IOBDELAY"|"IOSTANDARD"|"KEEP"|"KEEPER"|"LOC"|"LOCATE"|"LOCK_PINS"|"MAP"|"MAXDELAY"|"MAXPT"|"MAXSKEW"|"NODELAY"|"NOREDUCE"|"OFFSET"|"OPEN_DRAIN"|"OPT_EFFORT"|"OPTIMIZE"|"PERIOD"|"PIN"|"PRIORITY"|"PROHIBIT"|"PULLDOWN"|"PULLUP"|"PWR_MODE"|"REG"|"RLOC"|"RLOC_ORIGIN"|"RLOC_RANGE"|"SAVE NET"|"FLAG"|"SYSTEM_JITTER"|"TEMPERATURE"|"TIMEGRP"|"TIMESPEC"|"VOLTAGE"
+
+%option noyywrap
+%option nounput
+
+%x Bases
+%x ParseType
+%x ParseFuncProto
+%x ParseComponent
+%x ParsePackage
+%x ParseProcessProto
+%x ClassName
+%x PackageName
+%x ClassVar
+%x ClassesName
+%x Map
+%x End
+%x Body
+
+%%
+
+. {
+ BEGIN(Bases);
+ }
+
+<Map>{BRACEOPEN} {
+ yyextra->braceCount++;
+ writeFont(yyscanner,"vhdlchar",yytext);
+ BEGIN(Map);
+ }
+
+<Map>[^()\n,--]* { /* write and link a port map lines */
+ QCString tt(yytext);
+ VhdlDocGen::deleteAllChars(tt,',');
+ QRegExp r("=>");
+ QCStringList ql=QCStringList::split(r,tt);
+ if (ql.count()>=2)
+ {
+ unsigned int index=0;
+ QCString t1=ql[0];
+ char cc=t1.at(index);
+ while (cc==' ' || cc=='\t')
+ {
+ char c2[2];
+ c2[0]=cc;
+ c2[1]=0;
+ yyextra->code->codify(c2);
+ index++;
+ if (index>=t1.size()) break;
+ cc=t1.at(index);
+ }
+
+ QCString s1=t1;
+ s1=s1.stripWhiteSpace();
+
+ // if (!yyextra->PortMapComp.isEmpty())
+ generateMemLink(yyscanner,*yyextra->code,yyextra->PortMapComp,s1);
+ while (index++<t1.size())
+ {
+ cc=t1.at(index);
+ if (cc==' ' || cc=='\t')
+ {
+ char c2[2];
+ c2[0]=cc;
+ c2[1]=0;
+ yyextra->code->codify(c2);
+ }
+ }
+ codifyLines(yyscanner,"=>");
+ index=0;
+ QCString s2=ql[1];
+ t1=s2;
+ cc=t1.at(index);
+ while (cc==' ' || cc=='\t')
+ {
+ char c2[2];
+ c2[0]=cc;
+ c2[1]=0;
+ yyextra->code->codify(c2);
+ index++;
+ if (index>=t1.size()) break;
+ cc=t1.at(index);
+ }
+ s2=s2.stripWhiteSpace();
+ if (!checkVhdlString(yyscanner,s2))
+ {
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,s2);
+ }
+ while (index++<t1.size())
+ {
+ if (t1.at(index)==' ')
+ {
+ yyextra->code->codify(" ");
+ }
+ }
+ }
+ else
+ {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ }
+ BEGIN(Map);
+ }
+
+<Map>"\n"|"," {
+ codifyLines(yyscanner,yytext);
+ BEGIN(Map);
+ }
+
+<Map>{BRACECLOSE} {
+ yyextra->braceCount--;
+ writeFont(yyscanner,"vhdlchar",yytext);
+ if (yyextra->braceCount==0)
+ {
+ BEGIN(Bases);
+ }
+ }
+
+<ParseFuncProto>{NAME} {
+ QCString tmp(yytext);
+ tmp=tmp.stripWhiteSpace();
+ appStringLower(yyextra->prevString,yytext);
+ yyextra->vhdlKeyDict.insert(yyextra->prevString.str());
+ if (!writeColoredWord(yyscanner,tmp))
+ {
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,tmp);
+ }
+ BEGIN(Bases);
+ }
+
+<ParseType>{STRING} {
+ QCString qcs(yytext);
+ VhdlDocGen::deleteAllChars(qcs,'"');
+ VhdlDocGen::deleteAllChars(qcs,' ');
+ if (VhdlDocGen::isNumber(qcs))
+ {
+ writeFont(yyscanner,"vhdllogic",yytext);
+ }
+ else
+ {
+ writeFont(yyscanner,"keyword",yytext);
+ }
+ }
+
+<ParseType>"\n" {
+ yyextra->funcProto.append(yytext);
+ if (yyextra->isProto)
+ {
+ codifyLines(yyscanner,yytext);
+ }
+ BEGIN(ParseType);
+ }
+
+
+<ParseType>{TEXTT} {
+ yyextra->funcProto.append(yytext);
+ if (yyextra->isProto)
+ {
+ writeFont(yyscanner,"keyword",yytext);
+ }
+ BEGIN(ParseType);
+ }
+
+<ParseType>{ENDEFUNC} {
+ QRegExp regg("[\\s]");
+ QCString tt(yytext);
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ tt=tt.lower();
+ VhdlDocGen::deleteAllChars(tt,';');
+ tt.stripWhiteSpace();
+ QCStringList ql=QCStringList::split(regg,tt);
+ int index=ql.findIndex(QCString("if"))+1;
+ index+=ql.findIndex(QCString("case"))+1;
+ index+=ql.findIndex(QCString("loop"))+1;
+ index+=ql.findIndex(QCString("generate"))+1;
+ if (index==0)
+ {
+ BEGIN(Bases);
+ }
+ else
+ {
+ BEGIN(ParseType);
+ }
+ }
+
+<ParseType>{END1} {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ yyextra->vhdlKeyDict.clear();
+ }
+
+<ParseType>^{B}*("begin "|"begin") {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ yyextra->isFuncProto=false;
+ }
+
+<ParseType>{SPECSIGN} {
+ yyextra->funcProto.append(yytext);
+ if (yyextra->isProto)
+ {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ }
+ }
+
+<ParseType>["_a-zA-Z0-9]* {
+ QCString val(yytext);
+ yyextra->funcProto.append(yytext);
+ appStringLower(yyextra->prevString,yytext);
+
+ if (yyextra->isFuncProto && yyextra->braceCount==0)
+ {
+ yyextra->vhdlKeyDict.insert(yyextra->prevString.str());
+ }
+
+ if (yyextra->isProto)
+ {
+ if (!writeColoredWord(yyscanner,val))
+ {
+ if (!yyextra->isFuncProto &&
+ yyextra->vhdlKeyDict.find(yyextra->prevString.str())==yyextra->vhdlKeyDict.end())
+ {
+ val=val.stripWhiteSpace();
+ if (VhdlDocGen::isNumber(val))
+ {
+ startFontClass(yyscanner,"vhdllogic");
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ endFontClass(yyscanner);
+ }
+ else
+ {
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,val);
+ }
+ }
+ else
+ {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data());
+ }
+ }
+ }
+ BEGIN(ParseType);
+ }
+
+<ParseType>{BRACEOPEN} {
+ yyextra->braceCount++;
+ yyextra->funcProto+='(';
+ if (yyextra->isProto)
+ {
+ writeFont(yyscanner,"vhdlchar",yytext);
+ }
+ BEGIN(ParseType);
+ }
+
+<ParseType>{BRACECLOSE} {
+ yyextra->braceCount--;
+ yyextra->funcProto+=')';
+ if (yyextra->isProto)
+ {
+ writeFont(yyscanner,"vhdlchar",yytext);
+ }
+ if (yyextra->braceCount==0 && !yyextra->isProto)// && !yyextra->isPackageBody)
+ {
+ yyextra->isProto=true;
+ appStringLower(yyextra->prevString,yytext);
+ writeFuncProto(yyscanner);
+ BEGIN(Bases);
+ }
+ if (yyextra->isPackageBody)
+ {
+ BEGIN(ParseType);
+ }
+ }
+
+
+<ClassesName>{FUNCNAME} {
+ appStringLower(yyextra->prevString,yytext);
+ yyextra->currClass.resize(0);
+ yyextra->currClass.append(yytext);
+ yyextra->currClass=yyextra->currClass.stripWhiteSpace();
+
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
+ BEGIN(Bases);
+ }
+
+
+<ParseComponent>{BRACEOPEN} {
+ yyextra->braceCount++;
+ yyextra->code->codify(yytext);
+ }
+
+
+<ParseComponent>{BRACECLOSE} {
+ yyextra->braceCount--;
+ yyextra->code->codify(yytext);
+ if (yyextra->braceCount==0 && !yyextra->isComponent)
+ {
+ yyextra->tempComp.resize(0);
+ BEGIN(Bases);
+ }
+ else
+ {
+ BEGIN(ParseComponent);
+ }
+ }
+
+<ParseComponent>{B}*"-" {
+ if (strlen(yytext)>=2) // found text ?
+ {
+ writeFont(yyscanner,"keyword",yytext);
+ }
+ else
+ {
+ writeFont(yyscanner,"vhdlchar",yytext);
+ }
+ }
+
+<ParseComponent>{SPECSIGN} {
+ codifyLines(yyscanner,yytext);
+ }
+
+
+
+<ParseComponent>"\n"|" " {
+ codifyLines(yyscanner,yytext);
+ }
+
+<ParseComponent>{DIGITSS} {
+ startFontClass(yyscanner,"vhdllogic");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+<ParseComponent>{PORT} {
+ codifyLines(yyscanner,yytext);
+ yyextra->braceCount=1;
+ yyextra->isComponent=false;
+ }
+
+<ParseComponent>{GENERIC} {
+ codifyLines(yyscanner,yytext);
+ yyextra->braceCount=1;
+ }
+
+<ParseComponent>[_a-zA_Z][_a-zA-Z0-9]* {
+ QCString temp(yytext);
+ appStringLower(yyextra->prevString,yytext);
+ if (!checkVhdlString(yyscanner,temp))
+ {
+ if (!writeColoredWord(yyscanner,yyextra->prevString))
+ {
+ generateMemLink(yyscanner,*yyextra->code,yyextra->tempComp,temp);
+ }
+ }
+ }
+
+<ParseComponent>{STRING} {
+ QCString temp(yytext);
+ if (!checkVhdlString(yyscanner,temp))
+ {
+ codifyLines(yyscanner,yytext);
+ }
+ }
+
+
+<ParseProcessProto>[^()]* {
+ yyextra->funcProto.append(yytext);
+ }
+
+
+
+<ParseProcessProto>{BRACEOPEN} {
+ yyextra->funcProto.append(yytext);
+ yyextra->braceCount++;
+ }
+
+<ParseProcessProto>{BRACECLOSE} {
+ yyextra->funcProto.append(yytext);
+ yyextra->braceCount--;
+ if (yyextra->braceCount==0)
+ {
+ writeProcessProto(yyscanner);
+ BEGIN(Bases);
+ }
+ }
+
+<ParsePackage>[^:;]* { //found package
+ QCString temp(yytext);
+ QCStringList strl=QCStringList::split(".",temp);
+ if (strl.count()>2)
+ {
+ QCString s1=strl[0];
+ QCString s2=strl[1];
+ QCString s3=strl[2];
+ s1.append(".");
+ s3.prepend(".");
+ codifyLines(yyscanner,s1.data(),yyextra->currClass.data());
+ ClassDef *cd=VhdlDocGen::getPackageName(s2);
+ if (cd)
+ {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,s2.data());
+ }
+ else
+ {
+ codifyLines(yyscanner,s2.data());
+ }
+ codifyLines(yyscanner,s3.data());
+ }
+ else
+ {
+ writeFont(yyscanner,"keywordflow",yytext);
+ }
+ BEGIN(Bases);
+ }
+
+<Bases>{MAPCOMPONENT1}|{MAPCOMPONENT2}|{MAPCOMPONENT3}|{MAPCOMPONENT4} { // found port or generic map
+ QCString tt(yytext);
+ int j=tt.find('.');
+
+ if (j>0)
+ {
+ QCString left=tt.left(j+1);
+ codifyLines(yyscanner,left.data());
+ tt=tt.right(tt.length()-j-1);
+ left=VhdlDocGen::getIndexWord(tt.data(),0);
+ if (!left.isEmpty())
+ {
+ if (left.contains('('))
+ {
+ j=left.find('(',false);
+ QCString name=left.left(j);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,name.data());
+ yyextra->PortMapComp=name;
+ name=tt.right(tt.length()-name.length());
+ codifyLines(yyscanner,name.data());
+ }
+ else
+ {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,left.data());
+ tt.stripPrefix(left.data()); //=tt.right(tt.length()-left.length()-1);
+
+ yyextra->PortMapComp=left;
+ codifyLines(yyscanner,tt.data());
+ }
+ }
+ }
+ else
+ {
+ if (tt.contains(':',false))
+ {
+ codifyMapLines(yyscanner,tt.data());
+ }
+ else
+ {
+ codifyLines(yyscanner,tt.data());
+ }
+ }
+ yyextra->braceCount=1;
+ BEGIN(Map);
+ }
+
+<Bases>^{B}*("component"){BN}+{FUNCNAME} { // found component
+ appStringLower(yyextra->prevString,yytext);
+ QCString temp=VhdlDocGen::getIndexWord(yytext,1);
+ temp=temp.stripWhiteSpace();
+ VhdlDocGen::deleteAllChars(temp,'\n');
+ yyextra->tempComp=temp;
+ codifyLines(yyscanner,yytext,temp.data(),true);
+ yyextra->braceCount=0;
+ yyextra->isComponent=true;
+ BEGIN(ParseComponent);
+ }
+
+
+
+<Bases>{ARCHITECTURE} { // found architecture
+ yyextra->PortMapComp.resize(0);
+ QCString temp = VhdlDocGen::getIndexWord(yytext,3);
+ yyextra->currArch = true;
+ temp+="::";
+ temp+=VhdlDocGen::getIndexWord(yytext,1);
+ yyextra->currClass=temp;
+ VhdlDocGen::deleteAllChars(temp,'\n');
+ codifyLines(yyscanner,yytext,temp.data(),true);
+ yyextra->isPackageBody=false;
+ }
+
+
+<Bases>^{B}*("package "){BN}*("body"){BN}*{FUNCNAME} { // found package body
+ QCString ss(yytext);
+ QCString temp=VhdlDocGen::getIndexWord(yytext,2);
+ QCStringList ql=QCStringList::split(temp,ss);
+ QCString ll=ql[0];
+ codifyLines(yyscanner,ll.data(),yyextra->currClass.data());
+ temp=temp.stripWhiteSpace();
+ temp.prepend("_");
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,temp.data());
+ yyextra->currClass.resize(0);
+ yyextra->currClass=temp;
+ yyextra->isProto=false;
+ yyextra->isPackageBody=true;
+ }
+
+<Bases>{PROCESS} { // found process
+ yyextra->isFuncProto=true;
+ yyextra->funcProto.resize(0);
+ yyextra->funcProto.append(yytext);
+ yyextra->vhdlKeyDict.clear();
+ appStringLower(yyextra->prevString,yytext);
+ if (yyextra->prevString.contains('('))
+ {
+ yyextra->braceCount=1;
+ BEGIN(ParseProcessProto);
+ }
+ else
+ {
+ writeProcessProto(yyscanner);
+ }
+ }
+
+<Bases>("end"){BN}+("process") { // end of process
+ yyextra->isFuncProto=false;
+ codifyLines(yyscanner,yytext);
+ BEGIN(Bases);
+ }
+
+
+<Bases>^{B}*("begin "|"begin") {
+ yyextra->isFuncProto=false;
+ writeFont(yyscanner,"vhdlkeyword",yytext);
+ }
+
+<Bases>^{B}*("use"|"library"){BN}+ { //found package or library
+ writeFont(yyscanner,"vhdlkeyword",yytext);
+ BEGIN(ParsePackage);
+ }
+
+
+<Bases>^{B}*("use"){BN}+("configuration")[^\n]* {
+ codifyLines(yyscanner,yytext);
+ }
+
+<Bases>{FUNC} { // found function|procedure
+ yyextra->vhdlKeyDict.clear();
+ yyextra->funcProto.resize(0);
+ yyextra->isProto=false;
+ yyextra->funcProto.append(yytext);
+ yyextra->braceCount=1;
+ BEGIN(ParseType);
+ }
+
+<Bases>^{B}*("entity"|"package"){BN}+ {
+ appStringLower(yyextra->prevString,yytext);
+ writeFont(yyscanner,"keywordflow",yytext);
+ yyextra->isPackageBody=false;
+ BEGIN(ClassesName);
+ }
+
+<Bases>"end"{BN}+"architecture"{BN}+{FUNCNAME} {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data(),true);
+ yyextra->currArch = false;
+ }
+<Bases>"end"{BN}+{FUNCNAME} {
+ if (yyextra->currArch)
+ {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data(),true);
+ yyextra->currArch = false;
+ }
+ else
+ {
+ REJECT;
+ }
+ }
+<Bases>"end" {
+ appStringLower(yyextra->prevString,yytext);
+ QCString temp(yytext);
+ temp=temp.stripWhiteSpace();
+
+ writeColoredWord(yyscanner,temp);
+ BEGIN(End);
+ }
+<End>{ID} {
+ appStringLower(yyextra->prevString,yytext);
+ QCString temp(yytext);
+ temp=temp.stripWhiteSpace();
+
+ if (!writeColoredWord(yyscanner,temp))
+ {
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,temp.data());
+ }
+ }
+<End>";" {
+ codifyLines(yyscanner,yytext);
+ BEGIN(Bases);
+ }
+<Bases>{KEYWORD} { // found keyword
+ QCString qcs(yytext);
+ if (!writeColoredWord(yyscanner,qcs))
+ {
+ startFontClass(yyscanner,"vhdlchar");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+ }
+
+
+<Bases>{ID} {
+ appStringLower(yyextra->prevString,yytext);
+ QCString temp(yytext);
+ temp=temp.stripWhiteSpace();
+
+ if (!writeColoredWord(yyscanner,temp))
+ {
+ startFontClass(yyscanner,"vhdlchar");
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
+ endFontClass(yyscanner);
+ }
+ }
+
+<Bases,ParseComponent>{DIGITSS} {
+ startFontClass(yyscanner,"vhdllogic");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+<Bases>^{B}*("use"){BN}+("entity"|"component")[^\n]* {
+ codifyLines(yyscanner,yytext,yyextra->currClass.data(),true);
+ }
+
+
+<Bases>{TYPEKW} {
+ codifyLines(yyscanner,yytext);
+ if (yyextra->isFuncProto)
+ {
+ BEGIN(ParseFuncProto);
+ }
+ else
+ {
+ BEGIN(Bases);
+ }
+ }
+
+<Bases>{OPERATOR} {
+ startFontClass(yyscanner,"vhdlchar");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+
+<Bases>","|"."|":"|"'"|"("|")" {
+ startFontClass(yyscanner,"vhdlchar");
+ yyextra->code->codify(yytext);
+ endFontClass(yyscanner);
+ }
+
+<Bases>{STRING} {
+ QCString qcs(yytext);
+ VhdlDocGen::deleteAllChars(qcs,'"');
+ VhdlDocGen::deleteAllChars(qcs,' ');
+
+ if (VhdlDocGen::isNumber(qcs))
+ {
+ writeFont(yyscanner,"vhdllogic",yytext);
+ }
+ else
+ {
+ writeFont(yyscanner,"keyword",yytext);
+ }
+ }
+
+<Bases>{B}*"#"[^\n]* {
+ writeFont(yyscanner,"keyword",yytext);
+ }
+
+<Bases>^{B}*{XILINX}/[^a-zA-Z0-9_] {
+ writeWord(yyscanner,yytext);
+ //codifyLines(yyscanner,yytext,yyextra->currClass.data(),true);
+ }
+
+<Bases>^{B}*"set_"[^\n]* {
+ writeWord(yyscanner,yytext);
+ }
+
+<*>\n {
+ codifyLines(yyscanner,yytext);
+ BEGIN(Bases);
+ }
+
+<*>[\x80-\xFF]* { // keep utf8 characters together...
+ yyextra->code->codify(yytext);
+ }
+<*>. {
+ yyextra->code->codify(yytext);
+ }
+
+<*>\n{TEXTT} { // found normal or special comment on its own line
+ QCString text(yytext);
+ int i=text.find("--");
+ if (text.mid(i,3)=="--!") // && // hide special comment
+ {
+ if (!Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ codifyLines(yyscanner,text,0,false,true);
+ }
+ else yyextra->yyLineNr++; // skip complete line, but count line
+ }
+ else // normal comment
+ {
+ codifyLines(yyscanner,text,0,false,true);
+ }
+ }
+<*>{TEXTT} { // found normal or special comment after something
+ QCString text(yytext);
+ int i=text.find("--");
+ if (text.mid(i,3)=="--!")
+ {
+ // hide special comment
+ if (!Config_getBool(STRIP_CODE_COMMENTS))
+ {
+ codifyLines(yyscanner,text,0,false,true);
+ }
+ }
+ else // normal comment
+ {
+ codifyLines(yyscanner,text,0,false,true);
+ }
+ }
+
+%%
+
+/*@ ----------------------------------------------------------------------------
+ */
+
+static int yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yy_size_t inputPosition = yyextra->inputPosition;
+ const char *s = yyextra->inputString + inputPosition;
+ yy_size_t c=0;
+ while( c < max_size && *s)
+ {
+ *buf++ = *s++;
+ c++;
+ }
+ yyextra->inputPosition += c;
+ return c;
+}
+
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- if (g_searchCtx)
+ if (yyextra->searchCtx)
{
- Doxygen::searchIndex->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE);
+ yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),false);
}
else
{
- Doxygen::searchIndex->setCurrentDoc(g_sourceFileDef,anchor,TRUE);
+ yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,true);
}
}
}
-static bool checkVhdlString(QCString &name)
+static bool checkVhdlString(yyscan_t yyscanner,QCString &name)
{
- if (name.isEmpty()) return FALSE;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (name.isEmpty()) return false;
static QRegExp regg("[\\s\"]");
int len=name.length();
@@ -151,121 +963,123 @@ static bool checkVhdlString(QCString &name)
QCStringList qrl=QCStringList::split(regg,name);
if (VhdlDocGen::isNumber(qrl[0]))
{
- g_code->codify("\"");
- startFontClass("vhdllogic");
+ yyextra->code->codify("\"");
+ startFontClass(yyscanner,"vhdllogic");
QCString mid=name.mid(1,len-2); //" 1223 "
- g_code->codify(mid.data());
- endFontClass();
- g_code->codify("\"");
+ yyextra->code->codify(mid.data());
+ endFontClass(yyscanner);
+ yyextra->code->codify("\"");
}
else
{
- startFontClass("keyword");
- g_code->codify(name.data());
- endFontClass();
+ startFontClass(yyscanner,"keyword");
+ yyextra->code->codify(name.data());
+ endFontClass(yyscanner);
}
- return TRUE;
+ return true;
}
if (VhdlDocGen::isNumber(name))
{
- startFontClass("vhdllogic");
- g_code->codify(name.data());
- endFontClass();
- return TRUE;
+ startFontClass(yyscanner,"vhdllogic");
+ yyextra->code->codify(name.data());
+ endFontClass(yyscanner);
+ return true;
}
- return FALSE;
+ return false;
}
-static void addToSearchIndex(const char *text)
+static void addToSearchIndex(yyscan_t yyscanner,const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- Doxygen::searchIndex->addWord(text,FALSE);
+ yyextra->code->addWord(text,false);
}
}
-/*! start a new line of code, inserting a line number if g_sourceFileDef
- * is TRUE. If a definition starts at the current line, then the line
+/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
+ * is true. If a definition starts at the current line, then the line
* number is linked to the documentation of that definition.
*/
-static void startCodeLine()
+static void startCodeLine(yyscan_t yyscanner)
{
- //if (g_currentFontClass) { g_code->endFontClass(); }
- if (g_sourceFileDef)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //if (yyextra->currentFontClass) { yyextra->code->endFontClass(); }
+ if (yyextra->sourceFileDef)
{
//QCString lineNumber,lineAnchor;
- //lineNumber.sprintf("%05d",g_yyLineNr);
- //lineAnchor.sprintf("l%05d",g_yyLineNr);
- // if ((g_yyLineNr % 500) == 0)
- // fprintf(stderr,"\n starting Line %d:",g_yyLineNr);
- Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr);
- //printf("startCodeLine %d d=%s\n", g_yyLineNr,d ? d->name().data() : "<null>");
- if (!g_includeCodeFragment && d)
+ //lineNumber.sprintf("%05d",yyextra->yyLineNr);
+ //lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+ // if ((yyextra->yyLineNr % 500) == 0)
+ // fprintf(stderr,"\n starting Line %d:",yyextra->yyLineNr);
+ Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
+ //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,d ? d->name().data() : "<null>");
+ if (!yyextra->includeCodeFragment && d)
{
- g_currentDefinition = d;
- g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr);
- if (!g_tempComp.isEmpty() && g_currentMemberDef )
+ yyextra->currentDefinition = d;
+ yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
+ if (!yyextra->tempComp.isEmpty() && yyextra->currentMemberDef )
{
- //ClassDef *cf=VhdlDocGen::getClass(g_tempComp.data());
- QCString nn=g_currentMemberDef->name();
- MemberDef* mdeff=VhdlDocGen::findMember(g_tempComp,nn);
+ //ClassDef *cf=VhdlDocGen::getClass(yyextra->tempComp.data());
+ QCString nn=yyextra->currentMemberDef->name();
+ MemberDef* mdeff=VhdlDocGen::findMember(yyextra->tempComp,nn);
if (mdeff)
{
- g_currentMemberDef=mdeff;
+ yyextra->currentMemberDef=mdeff;
}
}
- g_parmType.resize(0);
- g_parmName.resize(0);
QCString lineAnchor;
- lineAnchor.sprintf("l%05d",g_yyLineNr);
- if (g_currentMemberDef)
+ lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+ if (yyextra->currentMemberDef)
{
- g_code->writeLineNumber(g_currentMemberDef->getReference(),
- g_currentMemberDef->getOutputFileBase(),
- g_currentMemberDef->anchor(),g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
+ yyextra->currentMemberDef->getOutputFileBase(),
+ yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
else if (d->isLinkableInProject())
{
- g_code->writeLineNumber(d->getReference(),
+ yyextra->code->writeLineNumber(d->getReference(),
d->getOutputFileBase(),
- 0,g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ 0,yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
}
else
{
- g_code->writeLineNumber(0,0,0,g_yyLineNr);
+ yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr);
}
}
- g_code->startCodeLine(g_sourceFileDef);
- g_startCode=TRUE;
- if (g_currentFontClass)
+ yyextra->code->startCodeLine(yyextra->sourceFileDef);
+ yyextra->startCode=true;
+ if (yyextra->currentFontClass)
{
- g_code->startFontClass(g_currentFontClass);
+ yyextra->code->startFontClass(yyextra->currentFontClass);
}
}
-static void endCodeLine()
+static void endCodeLine(yyscan_t yyscanner)
{
- endFontClass();
- g_code->endCodeLine();
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endFontClass(yyscanner);
+ yyextra->code->endCodeLine();
}
-static void nextCodeLine()
+static void nextCodeLine(yyscan_t yyscanner)
{
- if (g_startCode)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->startCode)
{
- endCodeLine(); // </div>
+ endCodeLine(yyscanner); // </div>
}
- const char *fc = g_currentFontClass;
- if (g_yyLineNr<g_inputLines)
+ const char *fc = yyextra->currentFontClass;
+ if (yyextra->yyLineNr<yyextra->inputLines)
{
- g_currentFontClass = fc;
- startCodeLine(); //<div>
+ yyextra->currentFontClass = fc;
+ startCodeLine(yyscanner); //<div>
}
}
@@ -274,10 +1088,11 @@ static void nextCodeLine()
* and will be linked.
*/
-static void writeWord(const char *word,const char* curr_class=0,bool classLink=FALSE)
+static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class,bool classLink)
{
- bool found=FALSE;
- QCString temp;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool found=false;
+ QCString temp;
QCString tclass(curr_class);
QCString ttt(word);
if (ttt.isEmpty()) return;
@@ -288,69 +1103,71 @@ static void writeWord(const char *word,const char* curr_class=0,bool classLink=F
{
if (found)
{
- if (!writeColoredWord(temp)) // is it a keyword ?
+ if (!writeColoredWord(yyscanner,temp)) // is it a keyword ?
{
//if (VhdlDocGen::findKeyWord(temp))
- // writeFont("vhdlkeyword",temp.data());
- //printf("writeWord: %s\n",temp.data());
+ // writeFont(yyscanner,"vhdlkeyword",temp.data());
+ //printf("writeWord: %s\n",temp.data());
if (!tclass.isEmpty())
{
if (!classLink)
- {
- generateMemLink(*g_code,tclass,temp);
- }
+ {
+ generateMemLink(yyscanner,*yyextra->code,tclass,temp);
+ }
else
{
- generateClassOrGlobalLink(*g_code,temp,FALSE,curr_class);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,temp,false,curr_class);
+ }
+ }
+ else
+ {
+ if (!checkVhdlString(yyscanner,temp))
+ {
+ yyextra->code->codify(temp.data());
}
}
- else
- {
- if (!checkVhdlString(temp))
- g_code->codify(temp.data());
- }
}
temp.resize(0);
- found=FALSE;
+ found=false;
}
char cc[2];
cc[0]=c;
cc[1]=0;
- g_code->codify(cc);
+ yyextra->code->codify(cc);
}
else
{
- found=TRUE;
+ found=true;
temp+=c;
}
} // for
if (!temp.isEmpty())
{
- if (!writeColoredWord(temp))
+ if (!writeColoredWord(yyscanner,temp))
{
if (!tclass.isEmpty())
{
if (!classLink)
{
- generateMemLink(*g_code,tclass,temp); // generateMemLink(*g_code,g_CurrClass,left);
+ generateMemLink(yyscanner,*yyextra->code,tclass,temp); // generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,left);
}
else
{
- generateClassOrGlobalLink(*g_code,temp,FALSE,curr_class);
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,temp,false,curr_class);
}
}
- else
+ else
{
QCString qc(temp.data());
if (VhdlDocGen::isNumber(qc)){
- startFontClass("vhdllogic");
- g_code->codify(temp.data());
- endFontClass();
+ startFontClass(yyscanner,"vhdllogic");
+ yyextra->code->codify(temp.data());
+ endFontClass(yyscanner);
}
- else
- g_code->codify(temp.data());
+ else
+ yyextra->code->codify(temp.data());
}
}
}
@@ -360,64 +1177,68 @@ static void writeWord(const char *word,const char* curr_class=0,bool classLink=F
/*! write a code fragment 'text' that may span multiple lines, inserting
* line numbers for each line.
*/
-static void codifyLines(const char *text,const char *cl=0,bool classlink=FALSE,bool comment=FALSE)
+static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl,bool classlink,bool comment)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (text==0) return;
- //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text);
+ //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text);
const char *p=text,*sp=p;
char c;
- bool done=FALSE;
+ bool done=false;
while (!done)
{
sp=p;
while ((c=*p++) && c!='\n') {}
if (c=='\n')
{
- g_yyLineNr++;
+ yyextra->yyLineNr++;
QCString line = sp;
line = line.left((int)(p-sp)-1);
- //*(p-1)='\0';
- //g_code->codify(sp);
if (comment)
{
- writeFont("comment",line.data());
+ writeFont(yyscanner,"comment",line.data());
}
else
{
- writeWord(line,cl,classlink);
+ writeWord(yyscanner,line,cl,classlink);
}
- nextCodeLine();
+ nextCodeLine(yyscanner);
}
else
{
if (comment)
- writeFont("comment",sp);
+ {
+ writeFont(yyscanner,"comment",sp);
+ }
else
- writeWord(sp,cl,classlink);
- done=TRUE;
+ {
+ writeWord(yyscanner,sp,cl,classlink);
+ }
+ done=true;
}
}
}
/*! writes a link to a fragment \a text that may span multiple lines, inserting
- * line numbers for each line. If \a text contains newlines, the link will be
+ * line numbers for each line. If \a text contains newlines, the link will be
* split into multiple links with the same destination, one for each line.
*/
-static void writeMultiLineCodeLink(CodeOutputInterface &ol,
+static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
Definition *d,
const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
TooltipManager::instance()->addTooltip(d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
- QCString tooltip;
+ QCString tooltip;
if (!sourceTooltips) // fall back to simple "title" tooltips
{
tooltip = d->briefDescriptionAsTooltip();
}
- bool done=FALSE;
+ bool done=false;
char *p=(char *)text;
while (!done)
{
@@ -426,78 +1247,58 @@ static void writeMultiLineCodeLink(CodeOutputInterface &ol,
while ((c=*p++) && c!='\n') {}
if (c=='\n')
{
- g_yyLineNr++;
+ yyextra->yyLineNr++;
*(p-1)='\0';
// printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
- nextCodeLine();
+ nextCodeLine(yyscanner);
}
else
{
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
- done=TRUE;
+ done=true;
}
}
}
-static void setParameterList(const MemberDef *md)
-{
- g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : "";
- for (const Argument &a: md->argumentList())
- {
- g_parmName = a.name.copy();
- g_parmType = a.type.copy();
- int i = g_parmType.find('*');
- if (i!=-1) g_parmType = g_parmType.left(i);
- i = g_parmType.find('&');
- if (i!=-1) g_parmType = g_parmType.left(i);
- g_parmType.stripPrefix("const ");
- g_parmType=g_parmType.stripWhiteSpace();
- // g_theVarContext.addVariable(g_parmType,g_parmName);
- }
-}
-
-
/*! writes a link to a function or procedure
*/
-
-static void generateFuncLink(CodeOutputInterface &ol,MemberDef* mdef)
+static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef* mdef)
{
-
//printf("generateFuncLink(FuncName=%s)\n",mdef->name().data());
QCString memberName=mdef->name();
if (mdef && mdef->isLinkable()) // is it a linkable class
{
- writeMultiLineCodeLink(ol,mdef,mdef->name());
- addToSearchIndex(memberName);
+ writeMultiLineCodeLink(yyscanner,ol,mdef,mdef->name());
+ addToSearchIndex(yyscanner,memberName);
return;
}
- codifyLines(memberName.data());
- addToSearchIndex(memberName);
+ codifyLines(yyscanner,memberName.data());
+ addToSearchIndex(yyscanner,memberName);
} // generateFuncLink
-static void generateMemLink(CodeOutputInterface &ol,QCString &clName,QCString& memberName)
+static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString &clName,QCString& memberName)
{
- if (memberName.isEmpty()) return;
+ if (memberName.isEmpty()) return;
if (clName.isEmpty())
{
- codifyLines(memberName.data());
+ codifyLines(yyscanner,memberName.data());
return;
}
-
+
QCString className=clName;
MemberDef *md=0;
//MemberDef *comp=0;
- //bool isLocal=FALSE;
+ //bool isLocal=false;
md=VhdlDocGen::findMember(className,memberName);
ClassDef *po=VhdlDocGen::getClass(className.data());
- if (md==0 && po && (VhdlDocGen::VhdlClasses)po->protection()==VhdlDocGen::PACKBODYCLASS)
+ if (md==0 && po && (VhdlDocGen::VhdlClasses)po->protection()==VhdlDocGen::PACKBODYCLASS)
{
QCString temp=className;//.stripPrefix("_");
temp.stripPrefix("_");
@@ -506,17 +1307,17 @@ static void generateMemLink(CodeOutputInterface &ol,QCString &clName,QCString& m
if (md && md->isLinkable()) // is it a linkable class
{
- writeMultiLineCodeLink(ol,md,memberName);
- addToSearchIndex(memberName);
+ writeMultiLineCodeLink(yyscanner,ol,md,memberName);
+ addToSearchIndex(yyscanner,memberName);
return;
}
// nothing found, just write out the word
- codifyLines(memberName.data());
- addToSearchIndex(memberName);
+ codifyLines(yyscanner,memberName.data());
+ addToSearchIndex(yyscanner,memberName);
}// generateMemLink
-static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, bool /*typeOnly*/, const char *curr_class)
+static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, bool /*typeOnly*/, const char *curr_class)
{
QCString className=clName;
@@ -524,9 +1325,9 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
ClassDef *cd=0;
//MemberDef *md=0;
- //bool isLocal=FALSE;
+ //bool isLocal=false;
className.stripPrefix("_");
- cd = getClass(className.data());
+ cd = getClass(className.data());
if (!cd && curr_class)
{
if (QCString(curr_class).contains(QRegExp("::"+QCString(clName)+"$"))) cd = getClass(curr_class);
@@ -543,8 +1344,8 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
//{
// temp=VhdlDocGen::getClassName(cd);
//}
- writeMultiLineCodeLink(ol,cd,temp);
- addToSearchIndex(className);
+ writeMultiLineCodeLink(yyscanner,ol,cd,temp);
+ addToSearchIndex(yyscanner,className);
return;
}
Definition *d = cd->getOuterScope();
@@ -559,55 +1360,59 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName
}
// nothing found, just write out the word
- codifyLines(clName);
- addToSearchIndex(clName);
+ codifyLines(yyscanner,clName);
+ addToSearchIndex(yyscanner,clName);
}// generateClasss or global link
/*! counts the number of lines in the input */
-static int countLines()
+static int countLines(yyscan_t yyscanner)
{
- const char *p=g_inputString;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *p=yyextra->inputString;
char c;
int count=1;
- while ((c=*p))
- {
- p++ ;
- if (c=='\n') count++;
+ while ((c=*p))
+ {
+ p++ ;
+ if (c=='\n') count++;
}
- if (p>g_inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
- count++,
- g_needsTermination=TRUE;
- }
+ count++,
+ yyextra->needsTermination=true;
+ }
return count;
}
-static void endFontClass()
+static void endFontClass(yyscan_t yyscanner)
{
- if (g_currentFontClass)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->currentFontClass)
{
- g_code->endFontClass();
- g_currentFontClass=0;
+ yyextra->code->endFontClass();
+ yyextra->currentFontClass=0;
}
}
-static void startFontClass(const char *s)
+static void startFontClass(yyscan_t yyscanner,const char *s)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (s==0) return;
- endFontClass();
- g_code->startFontClass(s);
- g_currentFontClass=s;
+ endFontClass(yyscanner);
+ yyextra->code->startFontClass(s);
+ yyextra->currentFontClass=s;
}
-static void writeFont(const char *s,const char* text)
+static void writeFont(yyscan_t yyscanner,const char *s,const char* text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (s==0 || text==0) return;
- //printf("writeFont(%d,\"%s\")\n",g_yyLineNr,text);
- g_code->startFontClass(s);
- g_code->codify(text);
- g_code->endFontClass();
+ //printf("writeFont(yyscanner,%d,\"%s\")\n",yyextra->yyLineNr,text);
+ yyextra->code->startFontClass(s);
+ yyextra->code->codify(text);
+ yyextra->code->endFontClass();
}
//----------------------------------------------------------------------------
@@ -616,42 +1421,34 @@ static void appStringLower(QCString& qcs,const char* text)
{
qcs.resize(0);
qcs.append(text);
- //qcs=qcs.lower();
qcs=qcs.stripWhiteSpace();
}
-//static void appString(QCString& qcs,const char* text)
-//{
-// qcs.resize(0);
-// qcs.append(text);
-//}
-
-static QCString g_temp;
-
/* writes and links a port map statement */
-static void codifyMapLines(const char *text)
+static void codifyMapLines(yyscan_t yyscanner,const char *text)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (text==0) return;
- g_temp.resize(0);
- //bool dot=FALSE;
+ QCString temp;
+ //bool dot=false;
int wordCounter=0;
QCString ctemp;
- //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text);
+ //printf("codifyMapLines(%d,\"%s\")\n",yyextra->yyLineNr,text);
const char *p=text; //,*sp=p;
char c;
- bool done=FALSE;
+ bool done=false;
while (!done)
{
//sp=p;
while ((c=*p++) && c!='\n' && c!=':' && c != ' ' && c != '(' && c!='\0' && c!='\t')
- {
+ {
if (c!=0x9)
- g_temp+=c;
+ temp+=c;
}
if (c=='\0') return;
- if (!g_temp.isEmpty()) wordCounter++;
+ if (!temp.isEmpty()) wordCounter++;
- if (!g_temp.isEmpty())
+ if (!temp.isEmpty())
{
// different kinds of component instantiations
// xxx:yyy (generic/port) map(
@@ -659,50 +1456,51 @@ static void codifyMapLines(const char *text)
// xxx: entity yyy(zzz) (generic/port) map(
if (wordCounter==2 || wordCounter==3)
{
- QCString q=g_temp.lower(); // consider (upper/lower) cases
- if (q=="entity" || q=="component" || q=="configuration" || q=="port" || q=="generic")
- {
- generateMemLink(*g_code,g_CurrClass,g_temp);
- }
- else
- {
- g_PortMapComp=g_temp;
- generateClassOrGlobalLink(*g_code,g_temp);
- }
+ QCString q=temp.lower(); // consider (upper/lower) cases
+ if (q=="entity" || q=="component" || q=="configuration" || q=="port" || q=="generic")
+ {
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
+ }
+ else
+ {
+ yyextra->PortMapComp=temp;
+ generateClassOrGlobalLink(yyscanner,*yyextra->code,temp);
+ }
}
- else
+ else
{
- generateMemLink(*g_code,g_CurrClass,g_temp);
+ generateMemLink(yyscanner,*yyextra->code,yyextra->currClass,temp);
}
}
ctemp.fill(c,1);
- codifyLines(ctemp.data());
+ codifyLines(yyscanner,ctemp.data());
ctemp.resize(0);
- g_temp.resize(0);
+ temp.resize(0);
}//while
-}//codifymaplines
+}//codifyMapLines
/*
-* writes a function|procedure prototype and links the function|procedure name
+* writes a function|procedure prototype and links the function|procedure name
*/
-static void writeFuncProto()
+static void writeFuncProto(yyscan_t yyscanner)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString name,ret;
- VhdlDocGen::parseFuncProto(g_FuncProto,name,ret,FALSE);
+ VhdlDocGen::parseFuncProto(yyextra->funcProto,name,ret,false);
if (name.isEmpty())
{
- codifyLines(g_FuncProto.data(),g_CurrClass.data());
+ codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data());
return;
}
- QCStringList qlist=QCStringList::split(name,g_FuncProto);
+ QCStringList qlist=QCStringList::split(name,yyextra->funcProto);
QCString temp=qlist[0];
- codifyLines(temp.data(),g_CurrClass.data());
- g_FuncProto.stripPrefix(temp.data());
+ codifyLines(yyscanner,temp.data(),yyextra->currClass.data());
+ yyextra->funcProto.stripPrefix(temp.data());
temp.resize(0);
- temp=g_CurrClass;
- if (isPackageBody)
+ temp=yyextra->currClass;
+ if (yyextra->isPackageBody)
{
temp.stripPrefix("_");// _{package body name}
}
@@ -710,847 +1508,69 @@ static void writeFuncProto()
if (mdef)
{
- generateFuncLink(*g_code,mdef);
- g_FuncProto.stripPrefix(name.data());
- codifyLines(g_FuncProto.data(),g_CurrClass.data());
+ generateFuncLink(yyscanner,*yyextra->code,mdef);
+ yyextra->funcProto.stripPrefix(name.data());
+ codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data());
}
else
{
- codifyLines(g_FuncProto.data(),g_CurrClass.data());
+ codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data());
}
}// writeFuncProto
/* writes a process prototype to the output */
- static void writeProcessProto(){
- codifyLines(g_FuncProto.data(),g_CurrClass.data());
- g_vhdlKeyDict.clear();
+static void writeProcessProto(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data());
+ yyextra->vhdlKeyDict.clear();
}// writeProcessProto
/* writes a keyword */
-static bool writeColoredWord(QCString& word )
+static bool writeColoredWord(yyscan_t yyscanner,QCString& word )
{
QCString qcs=word.lower();
QCString *ss=VhdlDocGen::findKeyWord(qcs);
- if (ss)
+ if (ss)
{
- writeFont(ss->data(),word.data());
- return TRUE;
+ writeFont(yyscanner,ss->data(),word.data());
+ return true;
}
- return FALSE;
+ return false;
}
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
+//-----------------------------------------------------------------------------------
-static int yyread(char *buf,int max_size)
+struct VHDLCodeParser::Private
{
- int c=0;
- while( c < max_size && g_inputString[g_inputPosition] )
- {
- *buf = g_inputString[g_inputPosition++] ;
- c++; buf++;
- }
- return c;
-}
-
-%}
-
-
-B [ \t]
-BN [ \t\n\r]
-STRING ["][^"\n]*["]
-NAME [a-z_A-Z][ a-z_A-Z0-9]*
-FUNCNAME [a-z_A-Z"][a-z_A-Z0-9+*"/=<>-]*
-ID "$"?[a-z_A-Z][a-z_A-Z0-9]*
-SPECSIGN [:;, +*&\/=<>'\t]*
-DIGITSS [0-9]+|[0-9]+("#")*[0-9_a-fA-F\+\.\-]+("#")*
-ALLTYPESMAP {B}*[_a-zA-Z0-9. ]+{BN}*
-ALLTYPESMAP1 {BN}*[_a-zA-Z0-9.() ]+{BN}*
-
-ARCHITECTURE ^{B}*("architecture"){BN}+{FUNCNAME}{BN}+("of"){BN}+{FUNCNAME}{BN}+("is")
-PROCESS ({BN}*{FUNCNAME}{BN}*[:]+{BN}*("process"){BN}*[(]*)|[^a-zA-Z]("process "|"process("){BN}*[ (]*|[^a-zA-Z]("process"){BN}+
-
-END1 {B}*("end "){BN}+("if"|"case"|"loop"|"generate"|"for")
-END2 [^a-zA-Z_]("end"){BN}*[;]
-END3 {BN}*[^a-zA-Z]("end"){BN}+{FUNCNAME}{BN}*[;]
-END4 {B}*("end"){BN}+"function"{BN}+{FUNCNAME}{BN}*[;]
-ENDEFUNC {END3}|{END4}|{END2}
-
-KEYWORD ("of"|"new"|"event"|"break"|"case"|"end"|"loop"|"else"|"for"|"goto"|"if"|"return"|"generate"|"is"|"while"|"in")
-TYPEKW ^{B}*("type"|"subtype"|"constant"|"attribute"|"signal"|"variable","alias","configuration")
-FUNC ^{B}*("function"|"procedure"){BN}*{FUNCNAME}{BN}*("(")
+ yyscan_t yyscanner;
+ vhdlcodeYY_state state;
+};
-ARITHOP "+"|"-"|"/"|"*"|"%"|"/="|":="
-ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
-LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"
-BITOP "&"|"|"|"^"|"<<"|">>"|"~"
-OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
-
-PORT {B}*("port"){BN}*("(")
-GENERIC {B}*("generic"){BN}*("(")
-
-BRACEOPEN [(]{1}
-BRACECLOSE [)]{1}
-
-TEXTT {B}*"--"[^\n]*
-
-MAPCOMPONENT1 ({ALLTYPESMAP}[:]{ALLTYPESMAP}{TEXTT}*{BN}+("port"|"generic"){BN}+("map"){BN}*("("){1})
-MAPCOMPONENT2 {BN}*("port"|"generic"){BN}+("map"){BN}*("("){1}
-MAPCOMPONENT3 ({ALLTYPESMAP}[:]{BN}*{ALLTYPESMAP1}{TEXTT}*{BN}+("port"|"generic"){BN}+("map"){BN}*("("){1})
-MAPCOMPONENT4 ({ALLTYPESMAP}[:]{BN}*("entity"|"component"|"configuration"){BN}+{ALLTYPESMAP1}{TEXTT}*{BN}*("port"|"generic"){BN}*("map"){BN}*("("){1})
-
-XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFIG"|"CONFIG_MODE"|"COOL_CLK"|"DATA_GATE"|"DCI_VALUE"|"DISABLE"|"DRIVE"|"DROP_SPEC"|"ENABLE"|"FAST"|"FEEDBACK"|"FILE"|"FLOAT"|"FROM-THRU-TO"|"FROM-TO"|"HBLKNM"|"HU_SET"|"INREG"|"IOB"|"IOBDELAY"|"IOSTANDARD"|"KEEP"|"KEEPER"|"LOC"|"LOCATE"|"LOCK_PINS"|"MAP"|"MAXDELAY"|"MAXPT"|"MAXSKEW"|"NODELAY"|"NOREDUCE"|"OFFSET"|"OPEN_DRAIN"|"OPT_EFFORT"|"OPTIMIZE"|"PERIOD"|"PIN"|"PRIORITY"|"PROHIBIT"|"PULLDOWN"|"PULLUP"|"PWR_MODE"|"REG"|"RLOC"|"RLOC_ORIGIN"|"RLOC_RANGE"|"SAVE NET"|"FLAG"|"SYSTEM_JITTER"|"TEMPERATURE"|"TIMEGRP"|"TIMESPEC"|"VOLTAGE"
-
-%option noyywrap
-%option nounput
-
-%x Bases
-%x ParseType
-%x ParseFuncProto
-%x ParseComponent
-%x ParsePackage
-%x ParseProcessProto
-%x ClassName
-%x PackageName
-%x ClassVar
-%x ClassesName
-%x Map
-%x End
-%x Body
-
-%%
-
-. {
- BEGIN(Bases);
- }
-
-<Map>{BRACEOPEN} {
- g_braceCount++;
- writeFont("vhdlchar",vhdlcodeYYtext);
- BEGIN(Map);
- }
-
-<Map>[^()\n,--]* { /* write and link a port map lines */
- QCString tt(vhdlcodeYYtext);
- VhdlDocGen::deleteAllChars(tt,',');
- QRegExp r("=>");
- QCStringList ql=QCStringList::split(r,tt);
- if (ql.count()>=2)
- {
- unsigned int index=0;
- QCString t1=ql[0];
- char cc=t1.at(index);
- while (cc==' ' || cc=='\t')
- {
- char c2[2];
- c2[0]=cc;
- c2[1]=0;
- g_code->codify(c2);
- index++;
- if (index>=t1.size()) break;
- cc=t1.at(index);
- }
-
- QCString s1=t1;
- s1=s1.stripWhiteSpace();
-
- // if (!g_PortMapComp.isEmpty())
- generateMemLink(*g_code,g_PortMapComp,s1);
- while (index++<t1.size())
- {
- cc=t1.at(index);
- if (cc==' ' || cc=='\t')
- {
- char c2[2];
- c2[0]=cc;
- c2[1]=0;
- g_code->codify(c2);
- }
- }
- codifyLines("=>");
- index=0;
- QCString s2=ql[1];
- t1=s2;
- cc=t1.at(index);
- while (cc==' ' || cc=='\t')
- {
- char c2[2];
- c2[0]=cc;
- c2[1]=0;
- g_code->codify(c2);
- index++;
- if (index>=t1.size()) break;
- cc=t1.at(index);
- }
- s2=s2.stripWhiteSpace();
- if (!checkVhdlString(s2))
- generateMemLink(*g_code,g_CurrClass,s2);
- while (index++<t1.size())
- {
- if (t1.at(index)==' ')
- {
- g_code->codify(" ");
- }
- }
- }
- else
- {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- }
- BEGIN(Map);
- }
-
-<Map>"\n"|"," {
- codifyLines(vhdlcodeYYtext);
- BEGIN(Map);
- }
-
-<Map>{BRACECLOSE} {
- g_braceCount--;
- writeFont("vhdlchar",vhdlcodeYYtext);
- if (g_braceCount==0)
- {
- BEGIN(Bases);
- }
- }
-
-<ParseFuncProto>{NAME} {
- QCString tmp(vhdlcodeYYtext);
- tmp=tmp.stripWhiteSpace();
- appStringLower(g_PrevString,vhdlcodeYYtext);
- g_vhdlKeyDict.insert(g_PrevString,new QCString(g_PrevString.data()));
- if (!writeColoredWord(tmp))
- {
- generateMemLink(*g_code,g_CurrClass,tmp);
- }
- BEGIN(Bases);
- }
-
-<ParseType>{STRING} {
- QCString qcs(vhdlcodeYYtext);
- VhdlDocGen::deleteAllChars(qcs,'"');
- VhdlDocGen::deleteAllChars(qcs,' ');
- if (VhdlDocGen::isNumber(qcs))
- writeFont("vhdllogic",vhdlcodeYYtext);
- else
- writeFont("keyword",vhdlcodeYYtext);
- }
-
-<ParseType>"\n" {
- g_FuncProto.append(vhdlcodeYYtext);
- if (isProto)
- {
- codifyLines(vhdlcodeYYtext);
- }
- BEGIN(ParseType);
- }
-
-
-<ParseType>{TEXTT} {
- g_FuncProto.append(vhdlcodeYYtext);
- if (isProto)
- {
- writeFont("keyword",vhdlcodeYYtext);
- }
- BEGIN(ParseType);
- }
-
-<ParseType>{ENDEFUNC} {
- QRegExp regg("[\\s]");
- QCString tt(vhdlcodeYYtext);
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- tt=tt.lower();
- VhdlDocGen::deleteAllChars(tt,';');
- tt.stripWhiteSpace();
- QCStringList ql=QCStringList::split(regg,tt);
- int index=ql.findIndex(QCString("if"))+1;
- index+=ql.findIndex(QCString("case"))+1;
- index+=ql.findIndex(QCString("loop"))+1;
- index+=ql.findIndex(QCString("generate"))+1;
- if (index==0)
- {
- BEGIN(Bases);
- }
- else
- {
- BEGIN(ParseType);
- }
- }
-
-<ParseType>{END1} {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- g_vhdlKeyDict.clear();
- }
-
-<ParseType>^{B}*("begin "|"begin") {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- isFuncProto=FALSE;
- }
-
-<ParseType>{SPECSIGN} {
- g_FuncProto.append(vhdlcodeYYtext);
- if (isProto)
- {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- }
- }
-
-<ParseType>["_a-zA-Z0-9]* {
- QCString val(vhdlcodeYYtext);
- g_FuncProto.append(vhdlcodeYYtext);
- appStringLower(g_PrevString,vhdlcodeYYtext);
-
- if (isFuncProto && g_braceCount==0)
- {
- g_vhdlKeyDict.insert(g_PrevString,new QCString(g_PrevString.data()));
- }
-
- if (isProto)
- {
- if (!writeColoredWord(val))
- {
- if (!isFuncProto && !g_vhdlKeyDict.find(g_PrevString))
- {
- val=val.stripWhiteSpace();
- if (VhdlDocGen::isNumber(val))
- {
- startFontClass("vhdllogic");
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- endFontClass();
- }
- else
- generateMemLink(*g_code,g_CurrClass,val);
- }
- else
- {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data());
- }
- }
- }
- BEGIN(ParseType);
- }
-
-<ParseType>{BRACEOPEN} {
- g_braceCount++;
- g_FuncProto+='(';
- if (isProto)
- {
- writeFont("vhdlchar",vhdlcodeYYtext);
- }
- BEGIN(ParseType);
- }
-
-<ParseType>{BRACECLOSE} {
- g_braceCount--;
- g_FuncProto+=')';
- if (isProto)
- {
- writeFont("vhdlchar",vhdlcodeYYtext);
- }
- if (g_braceCount==0 && !isProto)// && !isPackageBody)
- {
- isProto=TRUE;
- appStringLower(g_PrevString,vhdlcodeYYtext);
- writeFuncProto();
- BEGIN(Bases);
- }
- if (isPackageBody)
- {
- BEGIN(ParseType);
- }
- }
-
-
-<ClassesName>{FUNCNAME} {
- appStringLower(g_PrevString,vhdlcodeYYtext);
- g_CurrClass.resize(0);
- g_CurrClass.append(vhdlcodeYYtext);
- g_CurrClass=g_CurrClass.stripWhiteSpace();
-
- generateClassOrGlobalLink(*g_code,vhdlcodeYYtext);
- BEGIN(Bases);
- }
-
-
-<ParseComponent>{BRACEOPEN} {
- g_braceCount++;
- g_code->codify(vhdlcodeYYtext);
- }
-
-
-<ParseComponent>{BRACECLOSE} {
- g_braceCount--;
- g_code->codify(vhdlcodeYYtext);
- if (g_braceCount==0 && !isComponent)
- {
- g_tempComp.resize(0);
- BEGIN(Bases);
- }
- else
- {
- BEGIN(ParseComponent);
- }
- }
-
-<ParseComponent>{B}*"-" {
- if (strlen(vhdlcodeYYtext)>=2) // found text ?
- {
- writeFont("keyword",vhdlcodeYYtext);
- }
- else
- {
- writeFont("vhdlchar",vhdlcodeYYtext);
- }
- }
-
-<ParseComponent>{SPECSIGN} {
- codifyLines(vhdlcodeYYtext);
- }
-
-
-
-<ParseComponent>"\n"|" " {
- codifyLines(vhdlcodeYYtext);
- }
-
-<ParseComponent>{DIGITSS} {
- startFontClass("vhdllogic");
- codifyLines(vhdlcodeYYtext);
- endFontClass();
- }
-
-<ParseComponent>{PORT} {
- codifyLines(vhdlcodeYYtext);
- g_braceCount=1;
- isComponent=FALSE;
- }
-
-<ParseComponent>{GENERIC} {
- codifyLines(vhdlcodeYYtext);
- g_braceCount=1;
- }
-
-<ParseComponent>[_a-zA_Z][_a-zA-Z0-9]* {
- QCString temp(vhdlcodeYYtext);
- appStringLower(g_PrevString,vhdlcodeYYtext);
- if (!checkVhdlString(temp)){
- if (!writeColoredWord(g_PrevString))
- {
- generateMemLink(*g_code,g_tempComp,temp);
- }
- }
- }
-
-<ParseComponent>{STRING} {
- QCString temp(vhdlcodeYYtext);
- if (!checkVhdlString(temp))
- codifyLines(vhdlcodeYYtext);
- }
-
-
-<ParseProcessProto>[^()]* {
- g_FuncProto.append(vhdlcodeYYtext);
- }
-
-
-
-<ParseProcessProto>{BRACEOPEN} {
- g_FuncProto.append(vhdlcodeYYtext);
- g_braceCount++;
- }
-
-<ParseProcessProto>{BRACECLOSE} {
- g_FuncProto.append(vhdlcodeYYtext);
- g_braceCount--;
- if (g_braceCount==0)
- {
- writeProcessProto();
- BEGIN(Bases);
- }
- }
-
-<ParsePackage>[^:;]* { //found package
- QCString temp(vhdlcodeYYtext);
- QCStringList strl=QCStringList::split(".",temp);
- if (strl.count()>2)
- {
- QCString s1=strl[0];
- QCString s2=strl[1];
- QCString s3=strl[2];
- s1.append(".");
- s3.prepend(".");
- codifyLines(s1.data(),g_CurrClass.data());
- ClassDef *cd=VhdlDocGen::getPackageName(s2);
- if (cd)
- {
- generateClassOrGlobalLink(*g_code,s2.data());
- }
- else
- {
- codifyLines(s2.data());
- }
- codifyLines(s3.data());
- }
- else
- {
- writeFont("keywordflow",vhdlcodeYYtext);
- }
- BEGIN(Bases);
- }
-
-<Bases>{MAPCOMPONENT1}|{MAPCOMPONENT2}|{MAPCOMPONENT3}|{MAPCOMPONENT4} { // found port or generic map
- QCString tt(vhdlcodeYYtext);
- /*
- if (tt.contains(':',FALSE))
- {
- isStartMap=TRUE;
- }
- else
- {
- isStartMap=FALSE;
- }
- */
- int j=tt.find('.');
-
- if (j>0)
- {
- QCString left=tt.left(j+1);
- codifyLines(left.data());
- tt=tt.right(tt.length()-j-1);
- left=VhdlDocGen::getIndexWord(tt.data(),0);
- if (!left.isEmpty())
- {
- if (left.contains('('))
- {
- j=left.find('(',FALSE);
- QCString name=left.left(j);
- generateClassOrGlobalLink(*g_code,name.data());
- g_PortMapComp=name;
- name=tt.right(tt.length()-name.length());
- codifyLines(name.data());
- }
- else
- {
- generateClassOrGlobalLink(*g_code,left.data());
- tt.stripPrefix(left.data()); //=tt.right(tt.length()-left.length()-1);
-
- g_PortMapComp=left;
- codifyLines(tt.data());
- }
- }
- }
- else
- {
- if (tt.contains(':',FALSE))
- codifyMapLines(tt.data());
- else
- codifyLines(tt.data());
- }
- g_braceCount=1;
- BEGIN(Map);
- }
-
-<Bases>^{B}*("component"){BN}+{FUNCNAME} { // found component
- appStringLower(g_PrevString,vhdlcodeYYtext);
- // writeFont("keywordflow",VhdlDocGen::getIndexWord(vhdlcodeYYtext,0).data());
- // writeFont("vhdlkeyword"," ");
- QCString temp=VhdlDocGen::getIndexWord(vhdlcodeYYtext,1);
- temp=temp.stripWhiteSpace();
- VhdlDocGen::deleteAllChars(temp,'\n');
- g_tempComp=temp;
- codifyLines(vhdlcodeYYtext,temp.data(),TRUE);
- g_braceCount=0;
-
- //if (getClass(temp.data()))
- // generateClassOrGlobalLink(*g_code,temp.data());
- //else
- // generateMemLink(*g_code,g_CurrClass,temp);
-
- isComponent=TRUE;
- BEGIN(ParseComponent);
- }
-
-
-
-<Bases>{ARCHITECTURE} { // found architecture
- g_PortMapComp.resize(0);
- // writeFont("vhdlkeyword",VhdlDocGen::getIndexWord(vhdlcodeYYtext,0).data());
- // writeFont("vhdlkeyword"," ");
- // writeFont("vhdlchar",VhdlDocGen::getIndexWord(vhdlcodeYYtext,1).data());
- // writeFont("vhdlkeyword"," ");
- // writeFont("vhdlkeyword",VhdlDocGen::getIndexWord(vhdlcodeYYtext,2).data());
- // writeFont("vhdlkeyword"," ");
- //QCString temp=VhdlDocGen::getIndexWord(vhdlcodeYYtext,1);
- //temp=temp.stripWhiteSpace();
- //temp+=("-");
- //temp+=VhdlDocGen::getIndexWord(vhdlcodeYYtext,3);
- QCString temp = VhdlDocGen::getIndexWord(vhdlcodeYYtext,3);
- g_CurrARCH = TRUE;
- temp+="::";
- temp+=VhdlDocGen::getIndexWord(vhdlcodeYYtext,1);
- g_CurrClass=temp;
- VhdlDocGen::deleteAllChars(temp,'\n');
- codifyLines(vhdlcodeYYtext,temp.data(),TRUE);
- //generateClassOrGlobalLink(*g_code,temp.data());
- isPackageBody=FALSE;
- }
-
-
-<Bases>^{B}*("package "){BN}*("body"){BN}*{FUNCNAME} { // found package body
- QCString ss(vhdlcodeYYtext);
- QCString temp=VhdlDocGen::getIndexWord(vhdlcodeYYtext,2);
- QCStringList ql=QCStringList::split(temp,ss);
- QCString ll=ql[0];
- codifyLines(ll.data(),g_CurrClass.data());
- temp=temp.stripWhiteSpace();
- temp.prepend("_");
- generateClassOrGlobalLink(*g_code,temp.data());
- g_CurrClass.resize(0);
- g_CurrClass=temp;
- isProto=FALSE;
- isPackageBody=TRUE;
- // BEGIN(ClassesName);
- }
-
-<Bases>{PROCESS} { // found process
- isFuncProto=TRUE;
- g_FuncProto.resize(0);
- g_FuncProto.append(vhdlcodeYYtext);
- g_vhdlKeyDict.clear();
- appStringLower(g_PrevString,vhdlcodeYYtext);
- if (g_PrevString.contains('('))
- {
- g_braceCount=1;
- BEGIN(ParseProcessProto);
- }
- else
- {
- writeProcessProto();
- }
- }
-
-<Bases>("end"){BN}+("process") { // end of process
- isFuncProto=FALSE;
- codifyLines(vhdlcodeYYtext);
- BEGIN(Bases);
- }
-
-
-<Bases>^{B}*("begin "|"begin") {
- isFuncProto=FALSE;
- writeFont("vhdlkeyword",vhdlcodeYYtext);
- }
-
-<Bases>^{B}*("use"|"library"){BN}+ { //found package or library
- writeFont("vhdlkeyword",vhdlcodeYYtext);
- BEGIN(ParsePackage);
- }
-
-
-<Bases>^{B}*("use"){BN}+("configuration")[^\n]* {
- codifyLines(vhdlcodeYYtext);
- }
-
-
-
-<Bases>{FUNC} { // found function|procedure
- g_vhdlKeyDict.clear();
- g_FuncProto.resize(0);
- isProto=FALSE;
- g_FuncProto.append(vhdlcodeYYtext);
- g_braceCount=1;
- BEGIN(ParseType);
- }
-
-
-
-<Bases>^{B}*("entity"|"package"){BN}+ {
- appStringLower(g_PrevString,vhdlcodeYYtext);
- writeFont("keywordflow",vhdlcodeYYtext);
- isPackageBody=FALSE;
- BEGIN(ClassesName);
- }
-
-
-<Bases>"end"{BN}+"architecture"{BN}+{FUNCNAME} {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data(),TRUE);
- g_CurrARCH = FALSE;
- }
-<Bases>"end"{BN}+{FUNCNAME} {
- if (g_CurrARCH)
- {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data(),TRUE);
- g_CurrARCH = FALSE;
- }
- else
- REJECT;
- }
-<Bases>"end" {
- appStringLower(g_PrevString,vhdlcodeYYtext);
- QCString temp(vhdlcodeYYtext);
- temp=temp.stripWhiteSpace();
-
- writeColoredWord(temp);
- BEGIN(End);
- }
-<End>{ID} {
- appStringLower(g_PrevString,vhdlcodeYYtext);
- QCString temp(vhdlcodeYYtext);
- temp=temp.stripWhiteSpace();
-
- if (!writeColoredWord(temp))
- {
- generateClassOrGlobalLink(*g_code,temp.data());
- }
- }
-<End>";" {
- codifyLines(vhdlcodeYYtext);
- BEGIN(Bases);
- }
-<Bases>{KEYWORD} { // found keyword
- QCString qcs(vhdlcodeYYtext);
- if (!writeColoredWord(qcs))
- {
- startFontClass("vhdlchar");
- g_code->codify(vhdlcodeYYtext);
- endFontClass();
- }
- }
-
-
-<Bases>{ID} {
- appStringLower(g_PrevString,vhdlcodeYYtext);
- QCString temp(vhdlcodeYYtext);
- temp=temp.stripWhiteSpace();
-
- if (!writeColoredWord(temp))
- {
- startFontClass("vhdlchar");
- generateMemLink(*g_code,g_CurrClass,temp);
- endFontClass();
- }
- }
-
-<Bases,ParseComponent>{DIGITSS} {
- startFontClass("vhdllogic");
- codifyLines(vhdlcodeYYtext);
- endFontClass();
- }
-
-<Bases>^{B}*("use"){BN}+("entity"|"component")[^\n]* {
- codifyLines(vhdlcodeYYtext,g_CurrClass.data(),TRUE);
- }
-
-
-<Bases>{TYPEKW} {
- codifyLines(vhdlcodeYYtext);
- if (isFuncProto)
- {
- BEGIN(ParseFuncProto);
- }
- else
- {
- BEGIN(Bases);
- }
- }
-
-<Bases>{OPERATOR} {
- startFontClass("vhdlchar");
- g_code->codify(vhdlcodeYYtext);
- endFontClass();
- }
-
-<Bases>","|"."|":"|"'"|"("|")" {
- startFontClass("vhdlchar");
- g_code->codify(vhdlcodeYYtext);
- endFontClass();
- }
-
-<Bases>{STRING} {
- QCString qcs(vhdlcodeYYtext);
- VhdlDocGen::deleteAllChars(qcs,'"');
- VhdlDocGen::deleteAllChars(qcs,' ');
-
- if (VhdlDocGen::isNumber(qcs))
- writeFont("vhdllogic",vhdlcodeYYtext);
- else
- writeFont("keyword",vhdlcodeYYtext);
- }
-
-<Bases>{B}*"#"[^\n]* {
- writeFont("keyword",vhdlcodeYYtext);
- }
-
-<Bases>^{B}*{XILINX}/[^a-zA-Z0-9_] {
- writeWord(yytext);
- //codifyLines(vhdlcodeYYtext,g_CurrClass.data(),TRUE);
- }
-
-<Bases>^{B}*"set_"[^\n]* {
- writeWord(yytext);
- }
-
-<*>\n {
- codifyLines(vhdlcodeYYtext);
- BEGIN(Bases);
- }
-
-<*>[\x80-\xFF]* { // keep utf8 characters together...
- g_code->codify(vhdlcodeYYtext);
- }
-<*>. {
- g_code->codify(vhdlcodeYYtext);
- }
-
-<*>\n{TEXTT} { // found normal or special comment on its own line
- QCString text(vhdlcodeYYtext);
- int i=text.find("--");
- if (text.mid(i,3)=="--!") // && // hide special comment
- {
- if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- codifyLines(text,0,FALSE,TRUE);
- }
- else g_yyLineNr++; // skip complete line, but count line
- }
- else // normal comment
- {
- codifyLines(text,0,FALSE,TRUE);
- }
- }
-<*>{TEXTT} { // found normal or special comment after something
- QCString text(vhdlcodeYYtext);
- int i=text.find("--");
- if (text.mid(i,3)=="--!")
- {
- // hide special comment
- if (!Config_getBool(STRIP_CODE_COMMENTS))
- {
- codifyLines(text,0,FALSE,TRUE);
- }
- }
- else // normal comment
- {
- codifyLines(text,0,FALSE,TRUE);
- }
- }
-
-%%
+VHDLCodeParser::VHDLCodeParser() : p(std::make_unique<Private>())
+{
+ vhdlcodeYYlex_init_extra(&p->state,&p->yyscanner);
+#ifdef FLEX_DEBUG
+ vhdlcodeYYset_debug(1,p->yyscanner);
+#endif
+ resetCodeParserState();
+}
-/*@ ----------------------------------------------------------------------------
- */
+VHDLCodeParser::~VHDLCodeParser()
+{
+ vhdlcodeYYlex_destroy(p->yyscanner);
+}
-static void resetVhdlCodeParserState()
+void VHDLCodeParser::resetCodeParserState()
{
- g_vhdlKeyDict.setAutoDelete(TRUE);
- g_vhdlKeyDict.clear();
+ p->state.vhdlKeyDict.clear();
}
void VHDLCodeParser::parseCode(CodeOutputInterface &od,
const char *className,
- const QCString &s,
+ const QCString &s,
SrcLangExt,
bool exBlock,
const char *exName,
@@ -1563,96 +1583,80 @@ void VHDLCodeParser::parseCode(CodeOutputInterface &od,
const Definition *searchCtx,
bool /* collectXRefs */)
{
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
if (s.isEmpty()) return;
- printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
+ printlex(yy_flex_debug, true, __FILE__, fd ? fd->fileName().data(): NULL);
if (memberDef)
{
const ClassDef *dd=memberDef->getClassDef();
- if (dd) g_CurrClass=dd->name();
+ if (dd) yyextra->currClass=dd->name();
}
- resetVhdlCodeParserState();
- g_code = &od;
- g_inputString = s;
- g_inputPosition = 0;
- g_currentFontClass = 0;
- g_needsTermination = FALSE;
- g_searchCtx = searchCtx;
+ resetCodeParserState();
+ yyextra->code = &od;
+ yyextra->inputString = s;
+ yyextra->inputPosition = 0;
+ yyextra->currentFontClass = 0;
+ yyextra->needsTermination = false;
+ yyextra->searchCtx = searchCtx;
if (startLine!=-1)
- g_yyLineNr = startLine;
+ yyextra->yyLineNr = startLine;
else
- g_yyLineNr = 1;
+ yyextra->yyLineNr = 1;
if (endLine!=-1)
- g_inputLines = endLine+1;
+ yyextra->inputLines = endLine+1;
else
- g_inputLines = g_yyLineNr + countLines() - 1;
+ yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
- // g_theCallContext.clear();
- g_classScope = className;
- g_exampleBlock = exBlock;
- g_exampleName = exName;
- g_sourceFileDef = fd;
- bool cleanupSourceDef = FALSE;
+ // yyextra->theCallContext.clear();
+ yyextra->exampleBlock = exBlock;
+ yyextra->exampleName = exName;
+ yyextra->sourceFileDef = fd;
+ bool cleanupSourceDef = false;
if (exBlock && fd==0)
{
// create a dummy filedef for the example
- g_sourceFileDef = createFileDef("",exName);
- cleanupSourceDef = TRUE;
+ yyextra->sourceFileDef = createFileDef("",exName);
+ cleanupSourceDef = true;
}
- if (g_sourceFileDef)
+ if (yyextra->sourceFileDef)
{
- setCurrentDoc("l00001");
+ setCurrentDoc(yyscanner,"l00001");
}
- g_currentDefinition = 0;
- g_currentMemberDef = 0;
- g_vhdlMember=0;
- if (!g_exampleName.isEmpty())
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+ yyextra->vhdlMember=0;
+ if (!yyextra->exampleName.isEmpty())
{
- g_exampleFile = convertNameToFile(g_exampleName+"-example");
+ yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example");
}
- g_includeCodeFragment = inlineFragment;
- startCodeLine();
- // g_type.resize(0);
- // g_name.resize(0);
- // g_args.resize(0);
- g_parmName.resize(0);
- g_parmType.resize(0);
- if(!g_lexInit)
- VhdlDocGen::init();
- if (memberDef)
+ yyextra->includeCodeFragment = inlineFragment;
+ startCodeLine(yyscanner);
+ if (!yyextra->lexInit)
{
- setParameterList(memberDef);
+ VhdlDocGen::init();
+ yyextra->lexInit=true;
}
- /*int iLine=*/countLines();
- vhdlcodeYYrestart( vhdlcodeYYin );
+ /*int iLine=*/countLines(yyscanner);
+ vhdlcodeYYrestart( 0, yyscanner );
BEGIN( Bases );
- vhdlcodeYYlex();
- g_lexInit=TRUE;
- if (g_needsTermination)
+ vhdlcodeYYlex(yyscanner);
+ if (yyextra->needsTermination)
{
- endCodeLine();
+ endCodeLine(yyscanner);
}
if (cleanupSourceDef)
{
// delete the temporary file definition used for this example
- delete g_sourceFileDef;
- g_sourceFileDef=0;
+ delete yyextra->sourceFileDef;
+ yyextra->sourceFileDef=0;
}
- g_startCode=FALSE;
- printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
-}
-
-void codeFreeVhdlScanner()
-{
-#if defined(YY_FLEX_SUBMINOR_VERSION)
- if (g_lexInit)
- {
- vhdlcodeYYlex_destroy();
- }
-#endif
+ yyextra->startCode=false;
+ printlex(yy_flex_debug, false, __FILE__, fd ? fd->fileName().data(): NULL);
}
#if USE_STATE2STRING
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index 8e311b7..12cab2d 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -55,6 +55,7 @@
#include "filename.h"
#include "membergroup.h"
#include "memberdef.h"
+#include "membername.h"
#include "plantuml.h"
#include "vhdljjparser.h"
#include "VhdlParser.h"
@@ -2356,7 +2357,7 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
void VhdlDocGen::writeSource(const MemberDef *mdef,OutputList& ol,const QCString & cname)
{
- CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(".vhd");
+ auto intf = Doxygen::parserManager->getCodeParser(".vhd");
// pIntf->resetCodeParserState();
QCString codeFragment=mdef->documentation();
@@ -2381,8 +2382,8 @@ void VhdlDocGen::writeSource(const MemberDef *mdef,OutputList& ol,const QCString
codeFragment.prepend("\n");
ol.pushGeneratorState();
- ol.startCodeFragment();
- intf.parseCode( ol, // codeOutIntf
+ ol.startCodeFragment("DoxyCode");
+ intf->parseCode( ol, // codeOutIntf
0, // scope
codeFragment, // input
SrcLangExt_VHDL, // lang
@@ -2396,7 +2397,7 @@ void VhdlDocGen::writeSource(const MemberDef *mdef,OutputList& ol,const QCString
TRUE // show line numbers
);
- ol.endCodeFragment();
+ ol.endCodeFragment("DoxyCode");
ol.popGeneratorState();
if (cname.isEmpty()) return;
@@ -2739,14 +2740,14 @@ static void addInstance(ClassDef* classEntity, ClassDef* ar,
ferr:
QCString uu=cur->name;
- MemberDef *md=createMemberDef(
+ std::unique_ptr<MemberDef> md { createMemberDef(
ar->getDefFileName(), cur->startLine,cur->startColumn,
n1,uu,uu, 0,
Public, Normal, cur->stat,Member,
MemberType_Variable,
ArgumentList(),
ArgumentList(),
- "");
+ "") };
if (ar->getOutputFileBase())
{
@@ -2774,7 +2775,9 @@ ferr:
//label.replace(epr,":");
//info+=label;
//fprintf(stderr,"\n[%s:%d:%s]\n",fd->fileName().data(),cur->startLine,info.data());
- ar->insertMember(md);
+ ar->insertMember(md.get());
+ MemberName *mn = Doxygen::functionNameLinkedMap->add(uu);
+ mn->push_back(std::move(md));
}
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index 7c83d52..4ca4bbe 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -114,7 +114,10 @@ void VHDLOutlineParser::Private::parseVhdlfile(const char *fileName,
catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
// fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
// fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
+ //
delete vhdlParser;
+ delete tokenManager;
+ delete stream;
}
VHDLOutlineParser::VHDLOutlineParser() : p(std::make_unique<Private>())
diff --git a/src/xmlcode.h b/src/xmlcode.h
index 4cada9b..5a35506 100644
--- a/src/xmlcode.h
+++ b/src/xmlcode.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2014 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -32,6 +30,8 @@ class Definition;
class XMLCodeParser : public CodeParserInterface
{
public:
+ XMLCodeParser();
+ virtual ~XMLCodeParser();
void parseCode(CodeOutputInterface &codeOutIntf,
const char *scopeName,
const QCString &input,
@@ -48,6 +48,9 @@ class XMLCodeParser : public CodeParserInterface
bool collectXRefs=TRUE
);
void resetCodeParserState();
+ private:
+ struct Private;
+ std::unique_ptr<Private> p;
};
diff --git a/src/xmlcode.l b/src/xmlcode.l
index b583bf5..c91a00e 100644
--- a/src/xmlcode.l
+++ b/src/xmlcode.l
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * Copyright (C) 1997-2014 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -19,6 +19,11 @@
%option never-interactive
%option prefix="xmlcodeYY"
+%option reentrant
+%option extra-type="struct xmlcodeYY_state *"
+%option noyy_top_state
+%option nounput
+%option noyywrap
%top{
#include <stdint.h>
}
@@ -44,401 +49,430 @@
#define YY_NO_INPUT 1
#define YY_NO_UNISTD_H 1
-static CodeOutputInterface * g_code;
-static QCString g_curClassName;
-static QCString g_parmType;
-static QCString g_parmName;
-static const char * g_inputString; //!< the code fragment as text
-static int g_inputPosition; //!< read offset during parsing
-static int g_inputLines; //!< number of line in the code fragment
-static int g_yyLineNr; //!< current line number
-static bool g_needsTermination;
-static const Definition *g_searchCtx;
-
-static bool g_exampleBlock;
-static QCString g_exampleName;
-static QCString g_exampleFile;
-
-static QCString g_type;
-static QCString g_name;
-static QCString g_args;
-static QCString g_classScope;
-
-static QCString g_CurrScope;
-
-static FileDef * g_sourceFileDef;
-static Definition * g_currentDefinition;
-static MemberDef * g_currentMemberDef;
-static bool g_includeCodeFragment;
-static const char * g_currentFontClass;
+struct xmlcodeYY_state
+{
+ CodeOutputInterface * code;
+ QCString curClassName;
+ QCString parmType;
+ QCString parmName;
+ const char * inputString = 0; //!< the code fragment as text
+ int inputPosition = 0; //!< read offset during parsing
+ int inputLines = 0; //!< number of line in the code fragment
+ int yyLineNr = 0; //!< current line number
+ bool needsTermination = false;
+ const Definition *searchCtx = 0;
+
+ bool exampleBlock = false;
+ QCString exampleName;
+ QCString exampleFile;
+
+ QCString type;
+ QCString name;
+ QCString args;
+ QCString classScope;
+
+ QCString CurrScope;
+
+ const FileDef * sourceFileDef = 0;
+ const Definition * currentDefinition = 0;
+ const MemberDef * currentMemberDef = 0;
+ bool includeCodeFragment = false;
+ const char * currentFontClass = 0;
+};
#if USE_STATE2STRING
static const char *stateToString(int state);
#endif
-static void codify(const char* text)
-{
- g_code->codify(text);
+static void codify(yyscan_t yyscanner,const char* text);
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor);
+static void startCodeLine(yyscan_t yyscanner);
+static void endFontClass(yyscan_t yyscanner);
+static void endCodeLine(yyscan_t yyscanner);
+static void nextCodeLine(yyscan_t yyscanner);
+static void codifyLines(yyscan_t yyscanner,const char *text);
+static void startFontClass(yyscan_t yyscanner,const char *s);
+static int countLines(yyscan_t yyscanner);
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
+
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+
+%}
+
+nl (\r\n|\r|\n)
+ws [ \t]+
+open "<"
+close ">"
+namestart [A-Za-z\200-\377_]
+namechar [:A-Za-z\200-\377_0-9.-]
+esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
+name {namestart}{namechar}*
+comment {open}"!--"([^-]|"-"[^-])*"--"{close}
+data "random string"
+string \"([^"&]|{esc})*\"|\'([^'&]|{esc})*\'
+
+%option noyywrap
+%option nounput
+
+%%
+
+<INITIAL>{ws} {
+ codifyLines(yyscanner,yytext);
+ }
+<INITIAL>"/" {
+ endFontClass(yyscanner);
+ codify(yyscanner,yytext);
+ }
+<INITIAL>"=" {
+ endFontClass(yyscanner);
+ codify(yyscanner,yytext);
+ }
+<INITIAL>{close} {
+ endFontClass(yyscanner);
+ codify(yyscanner,yytext);
+ }
+<INITIAL>{name} {
+ startFontClass(yyscanner,"keyword");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+<INITIAL>{string} {
+ startFontClass(yyscanner,"stringliteral");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+
+{open}{ws}?{name} {
+ // Write the < in a different color
+ char openBracket[] = { yytext[0], '\0' };
+ codify(yyscanner,openBracket);
+
+ // Then write the rest
+ yytext++;
+ startFontClass(yyscanner,"keywordtype");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+
+ BEGIN(INITIAL);
+ }
+{open}{ws}?"/"{name} {
+ // Write the "</" in a different color
+ char closeBracket[] = { yytext[0], yytext[1], '\0' };
+ endFontClass(yyscanner);
+ codify(yyscanner,closeBracket);
+
+ // Then write the rest
+ yytext++; // skip the '<'
+ yytext++; // skip the '/'
+ startFontClass(yyscanner,"keywordtype");
+ codify(yyscanner,yytext);
+ endFontClass(yyscanner);
+
+ BEGIN(INITIAL);
+ }
+{comment} {
+ // Strip off the extra '!'
+ // yytext++; // <
+ // *yytext = '<'; // replace '!' with '<'
+
+ startFontClass(yyscanner,"comment");
+ codifyLines(yyscanner,yytext);
+ endFontClass(yyscanner);
+ }
+{nl} {
+ codifyLines(yyscanner,yytext);
+ }
+
+. {
+ //printf("!ERROR(%c)\n", *yytext);
+ codifyLines(yyscanner,yytext);
+ }
+
+%%
+
+//----------------------------------------------------------------------------------------
+
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,size_t max_size)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yy_size_t inputPosition = yyextra->inputPosition;
+ const char *s = yyextra->inputString + inputPosition;
+ yy_size_t c=0;
+ while( c < max_size && *s)
+ {
+ *buf++ = *s++;
+ c++;
+ }
+ yyextra->inputPosition += c;
+ return c;
+}
+
+static void codify(yyscan_t yyscanner,const char* text)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->code->codify(text);
}
-static void setCurrentDoc(const QCString &anchor)
+static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (Doxygen::searchIndex)
{
- if (g_searchCtx)
+ if (yyextra->searchCtx)
{
- Doxygen::searchIndex->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE);
+ yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),false);
}
else
{
- Doxygen::searchIndex->setCurrentDoc(g_sourceFileDef,anchor,TRUE);
+ yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,true);
}
}
}
-/*! start a new line of code, inserting a line number if g_sourceFileDef
- * is TRUE. If a definition starts at the current line, then the line
+/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
+ * is true. If a definition starts at the current line, then the line
* number is linked to the documentation of that definition.
*/
-static void startCodeLine()
+static void startCodeLine(yyscan_t yyscanner)
{
- if (g_sourceFileDef)
- {
- Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr);
-
- if (!g_includeCodeFragment && d && d->isLinkableInProject())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->sourceFileDef)
+ {
+ Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
+
+ if (!yyextra->includeCodeFragment && d && d->isLinkableInProject())
{
- g_currentDefinition = d;
- g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr);
- //g_insideBody = FALSE;
- g_classScope = d->name().copy();
+ yyextra->currentDefinition = d;
+ yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
+ //yyextra->insideBody = false;
+ yyextra->classScope = d->name().copy();
QCString lineAnchor;
- lineAnchor.sprintf("l%05d",g_yyLineNr);
- if (g_currentMemberDef)
+ lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
+ if (yyextra->currentMemberDef)
{
- g_code->writeLineNumber(g_currentMemberDef->getReference(),
- g_currentMemberDef->getOutputFileBase(),
- g_currentMemberDef->anchor(),g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
+ yyextra->currentMemberDef->getOutputFileBase(),
+ yyextra->currentMemberDef->anchor(),yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
else
{
- g_code->writeLineNumber(d->getReference(),
+ yyextra->code->writeLineNumber(d->getReference(),
d->getOutputFileBase(),
- 0,g_yyLineNr);
- setCurrentDoc(lineAnchor);
+ 0,yyextra->yyLineNr);
+ setCurrentDoc(yyscanner,lineAnchor);
}
}
else
{
- g_code->writeLineNumber(0,0,0,g_yyLineNr);
+ yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr);
}
}
-
- g_code->startCodeLine(g_sourceFileDef);
-
- if (g_currentFontClass)
+
+ yyextra->code->startCodeLine(yyextra->sourceFileDef);
+
+ if (yyextra->currentFontClass)
{
- g_code->startFontClass(g_currentFontClass);
+ yyextra->code->startFontClass(yyextra->currentFontClass);
}
}
-static void endFontClass()
+static void endFontClass(yyscan_t yyscanner)
{
- if (g_currentFontClass)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->currentFontClass)
{
- g_code->endFontClass();
- g_currentFontClass=0;
+ yyextra->code->endFontClass();
+ yyextra->currentFontClass=0;
}
}
-static void endCodeLine()
+static void endCodeLine(yyscan_t yyscanner)
{
- endFontClass();
- g_code->endCodeLine();
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endFontClass(yyscanner);
+ yyextra->code->endCodeLine();
}
-static void nextCodeLine()
+static void nextCodeLine(yyscan_t yyscanner)
{
- const char *fc = g_currentFontClass;
- endCodeLine();
- if (g_yyLineNr<g_inputLines)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *fc = yyextra->currentFontClass;
+ endCodeLine(yyscanner);
+ if (yyextra->yyLineNr<yyextra->inputLines)
{
- g_currentFontClass = fc;
- startCodeLine();
+ yyextra->currentFontClass = fc;
+ startCodeLine(yyscanner);
}
}
-static void codifyLines(char *text)
+static void codifyLines(yyscan_t yyscanner,const char *text)
{
- char *p=text,*sp=p;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *p=text,*sp=p;
char c;
- bool done=FALSE;
-
+ bool done=false;
while (!done)
{
sp=p;
-
while ((c=*p++) && c!='\n') { }
-
if (c=='\n')
{
- g_yyLineNr++;
- *(p-1)='\0';
- g_code->codify(sp);
- nextCodeLine();
+ yyextra->yyLineNr++;
+ int l = (int)(p-sp-1);
+ char *tmp = (char*)malloc(l+1);
+ tmp[l]='\0';
+ yyextra->code->codify(tmp);
+ free(tmp);
+ nextCodeLine(yyscanner);
}
else
{
- g_code->codify(sp);
- done=TRUE;
+ yyextra->code->codify(sp);
+ done=true;
}
}
}
-static void startFontClass(const char *s)
+static void startFontClass(yyscan_t yyscanner,const char *s)
{
- endFontClass();
- g_code->startFontClass(s);
- g_currentFontClass=s;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endFontClass(yyscanner);
+ yyextra->code->startFontClass(s);
+ yyextra->currentFontClass=s;
}
/*! counts the number of lines in the input */
-static int countLines()
+static int countLines(yyscan_t yyscanner)
{
- const char *p=g_inputString;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ const char *p=yyextra->inputString;
char c;
int count=1;
- while ((c=*p))
- {
- p++ ;
- if (c=='\n') count++;
+ while ((c=*p))
+ {
+ p++ ;
+ if (c=='\n') count++;
}
- if (p>g_inputString && *(p-1)!='\n')
+ if (p>yyextra->inputString && *(p-1)!='\n')
{ // last line does not end with a \n, so we add an extra
// line and explicitly terminate the line after parsing.
- count++,
- g_needsTermination=TRUE;
- }
+ count++,
+ yyextra->needsTermination=true;
+ }
return count;
}
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
+//----------------------------------------------------------------------------------------
-static int yyread(char *buf,int max_size)
+struct XMLCodeParser::Private
{
- int c=0;
- while( c < max_size && g_inputString[g_inputPosition] )
- {
- *buf = g_inputString[g_inputPosition++] ;
- c++; buf++;
- }
- return c;
-}
-
-%}
+ yyscan_t yyscanner;
+ xmlcodeYY_state state;
+};
-nl (\r\n|\r|\n)
-ws [ \t]+
-open "<"
-close ">"
-namestart [A-Za-z\200-\377_]
-namechar [:A-Za-z\200-\377_0-9.-]
-esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
-name {namestart}{namechar}*
-comment {open}"!--"([^-]|"-"[^-])*"--"{close}
-data "random string"
-string \"([^"&]|{esc})*\"|\'([^'&]|{esc})*\'
-
-%option noyywrap
-%option nounput
+XMLCodeParser::XMLCodeParser() : p(std::make_unique<Private>())
+{
+ xmlcodeYYlex_init_extra(&p->state,&p->yyscanner);
+#ifdef FLEX_DEBUG
+ xmlcodeYYset_debug(1,yyscanner);
+#endif
+ resetCodeParserState();
+}
-%%
+XMLCodeParser::~XMLCodeParser()
+{
+ xmlcodeYYlex_destroy(p->yyscanner);
+}
-<INITIAL>{ws} {
- codifyLines(yytext);
- }
-<INITIAL>"/" {
- endFontClass();
- codify(yytext);
- }
-<INITIAL>"=" {
- endFontClass();
- codify(yytext);
- }
-<INITIAL>{close} {
- endFontClass();
- codify(yytext);
- }
-<INITIAL>{name} {
- startFontClass("keyword");
- codify(yytext);
- endFontClass();
- }
-<INITIAL>{string} {
- startFontClass("stringliteral");
- codifyLines(yytext);
- endFontClass();
- }
-
-{open}{ws}?{name} {
- // Write the < in a different color
- char openBracket[] = { yytext[0], '\0' };
- codify(openBracket);
-
- // Then write the rest
- yytext++;
- startFontClass("keywordtype");
- codify(yytext);
- endFontClass();
-
- BEGIN(INITIAL);
- }
-{open}{ws}?"/"{name} {
- // Write the "</" in a different color
- char closeBracket[] = { yytext[0], yytext[1], '\0' };
- endFontClass();
- codify(closeBracket);
-
- // Then write the rest
- yytext++; // skip the '<'
- yytext++; // skip the '/'
- startFontClass("keywordtype");
- codify(yytext);
- endFontClass();
+void XMLCodeParser::resetCodeParserState()
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->currentDefinition = 0;
+ yyextra->currentMemberDef = 0;
+}
- BEGIN(INITIAL);
- }
-{comment} {
- // Strip off the extra '!'
- // yytext++; // <
- // *yytext = '<'; // replace '!' with '<'
+void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
+ const char *scopeName,
+ const QCString &input,
+ SrcLangExt,
+ bool isExampleBlock,
+ const char *exampleName,
+ FileDef *fileDef,
+ int startLine,
+ int endLine,
+ bool inlineFragment,
+ const MemberDef *memberDef,
+ bool showLineNumbers,
+ const Definition *searchCtx,
+ bool collectXRefs
+ )
+{
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- startFontClass("comment");
- codifyLines(yytext);
- endFontClass();
- }
-{nl} {
- codifyLines(yytext);
- }
+ if (input.isEmpty()) return;
-. {
- //printf("!ERROR(%c)\n", *yytext);
- codifyLines(yytext);
- }
+ printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
-%%
+ yyextra->code = &codeOutIntf;
+ yyextra->inputString = input;
+ yyextra->inputPosition = 0;
+ yyextra->currentFontClass = 0;
+ yyextra->needsTermination = false;
+ yyextra->searchCtx = searchCtx;
-void parseXmlCode(
- CodeOutputInterface &od,
- const char * /*className*/,
- const QCString &s,
- bool exBlock,
- const char *exName,
- FileDef *fd,
- int startLine,
- int endLine,
- bool inlineFragment,
- const MemberDef *,
- bool,const Definition *searchCtx,
- bool /*collectXRefs*/
- )
-{
- if (s.isEmpty()) return;
- printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
-
- g_code = &od;
- g_inputString = s;
- g_inputPosition = 0;
- g_currentFontClass = 0;
- g_needsTermination = FALSE;
- g_searchCtx=searchCtx;
-
if (startLine!=-1)
- g_yyLineNr = startLine;
+ yyextra->yyLineNr = startLine;
else
- g_yyLineNr = 1;
-
+ yyextra->yyLineNr = 1;
+
if (endLine!=-1)
- g_inputLines = endLine+1;
+ yyextra->inputLines = endLine+1;
else
- g_inputLines = g_yyLineNr + countLines() - 1;
-
- g_exampleBlock = exBlock;
- g_exampleName = exName;
- g_sourceFileDef = fd;
-
- bool cleanupSourceDef = FALSE;
-
- if (exBlock && fd==0)
+ yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1;
+
+ yyextra->exampleBlock = isExampleBlock;
+ yyextra->exampleName = exampleName;
+ yyextra->sourceFileDef = fileDef;
+
+ bool cleanupSourceDef = false;
+
+ if (isExampleBlock && fileDef==0)
{
// create a dummy filedef for the example
- g_sourceFileDef = createFileDef("",(exName?exName:"generated"));
- cleanupSourceDef = TRUE;
+ yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated"));
+ cleanupSourceDef = true;
}
-
- if (g_sourceFileDef)
+
+ if (yyextra->sourceFileDef)
{
- setCurrentDoc("l00001");
+ setCurrentDoc(yyscanner,"l00001");
}
- g_includeCodeFragment = inlineFragment;
- // Starts line 1 on the output
- startCodeLine();
+ yyextra->includeCodeFragment = inlineFragment;
+ // Starts line 1 on the output
+ startCodeLine(yyscanner);
- xmlcodeYYrestart( xmlcodeYYin );
+ xmlcodeYYrestart( 0, yyscanner );
- xmlcodeYYlex();
+ xmlcodeYYlex(yyscanner);
- if (g_needsTermination)
+ if (yyextra->needsTermination)
{
- endCodeLine();
+ endCodeLine(yyscanner);
}
if (cleanupSourceDef)
{
// delete the temporary file definition used for this example
- delete g_sourceFileDef;
- g_sourceFileDef=0;
+ delete yyextra->sourceFileDef;
+ yyextra->sourceFileDef=0;
}
-
- printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
- return;
-}
-
-void resetXmlCodeParserState()
-{
- g_currentDefinition = 0;
- g_currentMemberDef = 0;
-}
-
-//----------------------------------------------------------------------------
-void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf,
- const char *scopeName,
- const QCString &input,
- SrcLangExt,
- bool isExampleBlock,
- const char *exampleName,
- FileDef *fileDef,
- int startLine,
- int endLine,
- bool inlineFragment,
- const MemberDef *memberDef,
- bool showLineNumbers,
- const Definition *searchCtx,
- bool collectXRefs
- )
-{
- parseXmlCode(codeOutIntf,scopeName,input,isExampleBlock,exampleName,
- fileDef,startLine,endLine,inlineFragment,memberDef,
- showLineNumbers,searchCtx,collectXRefs);
+ printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL);
}
-void XMLCodeParser::resetCodeParserState()
-{
- resetXmlCodeParserState();
-}
#if USE_STATE2STRING
#include "xmlcode.l.h"
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
index 045f87c..73aac7c 100644
--- a/src/xmldocvisitor.cpp
+++ b/src/xmldocvisitor.cpp
@@ -252,9 +252,8 @@ void XmlDocVisitor::visit(DocVerbatim *s)
m_t << " filename=\"" << lang << "\">";
else
m_t << ">";
- Doxygen::parserManager->getCodeParser(lang)
- .parseCode(m_ci,s->context(),s->text(),langExt,
- s->isExample(),s->exampleFile());
+ getCodeParser(lang).parseCode(m_ci,s->context(),s->text(),langExt,
+ s->isExample(),s->exampleFile());
m_t << "</programlisting>";
break;
case DocVerbatim::Verbatim:
@@ -332,8 +331,7 @@ void XmlDocVisitor::visit(DocInclude *inc)
m_t << "<programlisting filename=\"" << inc->file() << "\">";
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -351,8 +349,7 @@ void XmlDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::Include:
m_t << "<programlisting filename=\"" << inc->file() << "\">";
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,inc->context(),
+ getCodeParser(inc->extension()).parseCode(m_ci,inc->context(),
inc->text(),
langExt,
inc->isExample(),
@@ -411,8 +408,7 @@ void XmlDocVisitor::visit(DocInclude *inc)
break;
case DocInclude::Snippet:
m_t << "<programlisting filename=\"" << inc->file() << "\">";
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -426,8 +422,7 @@ void XmlDocVisitor::visit(DocInclude *inc)
m_t << "<programlisting filename=\"" << inc->file() << "\">";
QFileInfo cfi( inc->file() );
FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
- Doxygen::parserManager->getCodeParser(inc->extension())
- .parseCode(m_ci,
+ getCodeParser(inc->extension()).parseCode(m_ci,
inc->context(),
extractBlock(inc->text(),inc->blockId()),
langExt,
@@ -480,17 +475,16 @@ void XmlDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getCodeParser(locLangExt)
- .parseCode(m_ci,op->context(),
- op->text(),langExt,op->isExample(),
- op->exampleFile(),
- fd, // fileDef
- op->line(), // startLine
- -1, // endLine
- FALSE, // inline fragment
- 0, // memberDef
- op->showLineNo() // show line numbers
- );
+ getCodeParser(locLangExt).parseCode(m_ci,op->context(),
+ op->text(),langExt,op->isExample(),
+ op->exampleFile(),
+ fd, // fileDef
+ op->line(), // startLine
+ -1, // endLine
+ FALSE, // inline fragment
+ 0, // memberDef
+ op->showLineNo() // show line numbers
+ );
if (fd) delete fd;
}
pushEnabled();
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 19f1553..5cad4ed 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -226,6 +226,7 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf
FTextStream &m_t;
};
+//-------------------------------------------------------------------------------------------
/** Generator for producing XML formatted source code. */
void XMLCodeGenerator::codify(const char *text)
@@ -340,6 +341,18 @@ void XMLCodeGenerator::finish()
if (m_insideCodeLine) endCodeLine();
}
+void XMLCodeGenerator::startCodeFragment(const char *)
+{
+ m_t << " <programlisting>" << endl;
+}
+
+void XMLCodeGenerator::endCodeFragment(const char *)
+{
+ m_t << " </programlisting>" << endl;
+}
+
+//-------------------------------------------------------------------------------------------
+
static void writeTemplateArgumentList(FTextStream &t,
const ArgumentList &al,
const Definition *scope,
@@ -420,11 +433,12 @@ static void writeXMLDocBlock(FTextStream &t,
void writeXMLCodeBlock(FTextStream &t,FileDef *fd)
{
- CodeParserInterface &intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension());
+ auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension());
SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension());
- intf.resetCodeParserState();
+ intf->resetCodeParserState();
XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t);
- intf.parseCode(*xmlGen, // codeOutIntf
+ xmlGen->startCodeFragment("DoxyCode");
+ intf->parseCode(*xmlGen, // codeOutIntf
0, // scopeName
fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)),
langExt, // lang
@@ -437,6 +451,7 @@ void writeXMLCodeBlock(FTextStream &t,FileDef *fd)
0, // memberDef
TRUE // showLineNumbers
);
+ xmlGen->endCodeFragment("DoxyCode");
xmlGen->finish();
delete xmlGen;
}
@@ -1639,9 +1654,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti)
t << " </detaileddescription>" << endl;
if (Config_getBool(XML_PROGRAMLISTING))
{
- t << " <programlisting>" << endl;
writeXMLCodeBlock(t,fd);
- t << " </programlisting>" << endl;
}
t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>" << endl;
t << " </compounddef>" << endl;
diff --git a/src/xmlgen.h b/src/xmlgen.h
index 4458b9f..27bb10b 100644
--- a/src/xmlgen.h
+++ b/src/xmlgen.h
@@ -1,12 +1,10 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -41,6 +39,8 @@ class XMLCodeGenerator : public CodeOutputInterface
const char *anchorId,int l);
void setCurrentDoc(const Definition *,const char *,bool){}
void addWord(const char *,bool){}
+ void startCodeFragment(const char *);
+ void endCodeFragment(const char *);
void finish();