summaryrefslogtreecommitdiffstats
path: root/src/fortranscanner.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2009-03-04 21:11:18 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2009-03-04 21:11:18 (GMT)
commitaa9c531961aea00c8d9c139de3c48844f11dc9f1 (patch)
treeade91348b3d7d8806a09659790655b697c1f4eea /src/fortranscanner.l
parent27b5dd5b526154944bb1997fb7a592343d124595 (diff)
downloadDoxygen-aa9c531961aea00c8d9c139de3c48844f11dc9f1.zip
Doxygen-aa9c531961aea00c8d9c139de3c48844f11dc9f1.tar.gz
Doxygen-aa9c531961aea00c8d9c139de3c48844f11dc9f1.tar.bz2
Release-1.5.8-20090304
Diffstat (limited to 'src/fortranscanner.l')
-rw-r--r--src/fortranscanner.l59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 88ae240..766a261 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -279,10 +279,10 @@ PREFIX (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTA
if(indexEnd<0){ // ----- no ampersand as line continuation
if(YY_START == Prepass) { // last line in "continuation"
- inputStringPrepass+=(const char*)yytext;
- if(indexStart>=0) inputStringPrepass[yyleng-indexStart]=' ';
- // @todo: remove all symbols instead of replacing W blank?
+ // Only take input after initial ampersand
+ inputStringPrepass+=(const char*)(yytext+(indexStart+1));
+
pushBuffer(inputStringPrepass);
yy_pop_state();
} else { // simple line
@@ -296,12 +296,14 @@ PREFIX (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTA
yy_push_state(Prepass);
}
- inputStringPrepass+=(const char*)yytext;
- lineCountPrepass ++;
-
- // replace & with space and remove following comment if present
int length = inputStringPrepass.length();
- truncatePrepass(length-yyleng+indexEnd);
+
+ // Only take input after initial ampersand
+ inputStringPrepass+=(const char*)(yytext+(indexStart+1));
+ lineCountPrepass ++;
+
+ // cut off & and remove following comment if present
+ truncatePrepass(length+indexEnd-(indexStart+1));
}
}
@@ -850,26 +852,39 @@ static int getAmpOrExclAtTheEnd(const char *buf, int length)
for(int i=0; i<length && parseState!=Comment; i++)
{
+ // When in string, skip backslashes
+ // Legacy code, not sure whether this is correct?
if(parseState==String)
{
if(buf[i]=='\\') i++;
- if(buf[i]==quoteSymbol)
- {
- parseState = Start;
- quoteSymbol = 0;
- }
- } else // not in string
+ }
+
+ switch(buf[i])
{
- switch(buf[i])
- {
case '\'':
case '"':
- parseState = String;
- quoteSymbol = buf[i];
+ // Close string, if quote symbol matches.
+ // Quote symbol is set iff parseState==String
+ if(buf[i]==quoteSymbol)
+ {
+ parseState = Start;
+ quoteSymbol = 0;
+ }
+ // Start new string, if not already in string or comment
+ else if(parseState==Start)
+ {
+ parseState = String;
+ quoteSymbol = buf[i];
+ }
+ ampIndex = -1; // invalidate prev ampersand
break;
case '!':
- parseState = Comment;
- commentIndex = i;
+ // When in string or comment, ignore exclamation mark
+ if(parseState==Start)
+ {
+ parseState = Comment;
+ commentIndex = i;
+ }
break;
case ' ': // ignore whitespace
case '\t':
@@ -880,7 +895,6 @@ static int getAmpOrExclAtTheEnd(const char *buf, int length)
break;
default:
ampIndex = -1; // invalidate prev ampersand
- }
}
}
@@ -903,8 +917,7 @@ void truncatePrepass(int index)
comments.append(c);
}
}
- inputStringPrepass[index] = ' ';
- inputStringPrepass.truncate(index+1);
+ inputStringPrepass.truncate(index);
}
// simplified way to know if this is fixed form