summaryrefslogtreecommitdiffstats
path: root/src/pyscanner.l
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-08-05 07:44:33 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-08-05 07:44:33 (GMT)
commit23c71a3253f41a84a5624863b29fec69f87396d5 (patch)
tree2bd19c2fda3a3f3ec8bb5ae84b18677c769810b9 /src/pyscanner.l
parentc75c38455453c63b82abe2e4b6b1f8842a84f9d9 (diff)
downloadDoxygen-23c71a3253f41a84a5624863b29fec69f87396d5.zip
Doxygen-23c71a3253f41a84a5624863b29fec69f87396d5.tar.gz
Doxygen-23c71a3253f41a84a5624863b29fec69f87396d5.tar.bz2
Moved stripIndentation() to util, make it safe for empty input
Diffstat (limited to 'src/pyscanner.l')
-rw-r--r--src/pyscanner.l50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 701381b..017cc03 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -141,7 +141,6 @@ static void initSpecialBlock(yyscan_t yyscanner);
static void searchFoundDef(yyscan_t yyscanner);
static void searchFoundClass(yyscan_t yyscanner);
static QCString findPackageScope(yyscan_t yyscanner,const char *fileName);
-static void stripIndentation(QCString &doc,const int indentationLevel);
static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
@@ -1528,55 +1527,6 @@ static inline int computeIndent(const char *s)
return col;
}
-// strip up to \a indentationLevel spaces from each line in \a doc (excluding the first line)
-static void stripIndentation(QCString &doc,const int indentationLevel)
-{
- if (indentationLevel <= 0) return; // nothing to strip
-
- // by stripping content the string will only become shorter so we write the results
- // back into the input string and then resize it at the end.
- char c;
- const char *src = doc.data();
- char *dst = doc.rawData();
- bool insideIndent = false; // skip the initial line from stripping
- int cnt = 0;
- while ((c=*src++)!=0)
- {
- // invariant: dst<=src
- switch(c)
- {
- case '\n':
- *dst++ = c;
- insideIndent = true;
- cnt = indentationLevel;
- break;
- case ' ':
- if (insideIndent)
- {
- if (cnt>0) // count down the spacing until the end of the indent
- {
- cnt--;
- }
- else // reached the end of the indent, start of the part of the line to keep
- {
- insideIndent = false;
- *dst++ = c;
- }
- }
- else // part after indent, copy to the output
- {
- *dst++ = c;
- }
- break;
- default:
- insideIndent = false;
- *dst++ = c;
- break;
- }
- }
- doc.resize(dst-doc.data()+1);
-}
-
static QCString findPackageScopeFromPath(yyscan_t yyscanner,const QCString &path)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;