summaryrefslogtreecommitdiffstats
path: root/src/code.l
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2002-10-20 18:23:06 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2002-10-20 18:23:06 (GMT)
commitdc404b516e366ca10ad325d399ef0bd47d065863 (patch)
tree63a7ba72ad4f8318f818aebfef29beee5811c241 /src/code.l
parent6bc4cd0ea321e784be64022fea5013e1b181a593 (diff)
downloadDoxygen-dc404b516e366ca10ad325d399ef0bd47d065863.zip
Doxygen-dc404b516e366ca10ad325d399ef0bd47d065863.tar.gz
Doxygen-dc404b516e366ca10ad325d399ef0bd47d065863.tar.bz2
Release-1.2.18-20021020
Diffstat (limited to 'src/code.l')
-rw-r--r--src/code.l18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/code.l b/src/code.l
index d6f8930..79fc82a 100644
--- a/src/code.l
+++ b/src/code.l
@@ -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();