diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-10-20 18:23:06 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2002-10-20 18:23:06 (GMT) |
commit | 7c34dd2b1594925d0a012e9ba290bf9c80574db5 (patch) | |
tree | 63a7ba72ad4f8318f818aebfef29beee5811c241 /src/code.l | |
parent | 2c6d31c8bf31028ba2f822c31f4812c2cecab306 (diff) | |
download | Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.zip Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.tar.gz Doxygen-7c34dd2b1594925d0a012e9ba290bf9c80574db5.tar.bz2 |
Release-1.2.18-20021020
Diffstat (limited to 'src/code.l')
-rw-r--r-- | src/code.l | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -65,6 +65,7 @@ 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 bool g_exampleBlock; static QCString g_exampleName; @@ -923,7 +924,17 @@ static int countLines() const char *p=g_inputString; char c; int count=1; - while ((c=*p++)) if (c=='\n') count++; + while ((c=*p)) + { + p++ ; + if (c=='\n') count++; + } + if (p>g_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; + } return count; } @@ -1989,14 +2000,17 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s, g_inputString = s; g_inputPosition = 0; g_currentFontClass = 0; + g_needsTermination = FALSE; if (endLine!=-1) g_inputLines = endLine+1; else g_inputLines = countLines(); + if (startLine!=-1) g_yyLineNr = startLine; else g_yyLineNr = 1; + g_curlyCount = 0; g_bodyCurlyCount = 0; g_bracketCount = 0; @@ -2027,7 +2041,7 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s, codeYYrestart( codeYYin ); BEGIN( Body ); codeYYlex(); - if (g_inputLines==1) + if (g_needsTermination) { endFontClass(); g_code->endCodeLine(); |