summaryrefslogtreecommitdiffstats
path: root/src/fortranscanner.l
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2009-03-04 21:11:18 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2009-03-04 21:11:18 (GMT)
commit2ae3ed6594f3e4814b3b351eecc63b5e0be1bd37 (patch)
treeade91348b3d7d8806a09659790655b697c1f4eea /src/fortranscanner.l
parent5f3d8499c05e9eb512b72d296073041ac4da6f4d (diff)
downloadDoxygen-2ae3ed6594f3e4814b3b351eecc63b5e0be1bd37.zip
Doxygen-2ae3ed6594f3e4814b3b351eecc63b5e0be1bd37.tar.gz
Doxygen-2ae3ed6594f3e4814b3b351eecc63b5e0be1bd37.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