1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Fixed 71733 - [Scanner] Comment within multi-line macro definition not scanned properly

- Thanks to David Pickens who pointed me to the right place in Scanner2.
This commit is contained in:
John Camelon 2004-09-21 18:29:36 +00:00
parent 8ec09a9e37
commit 726c0f77b1
2 changed files with 13 additions and 1 deletions

View file

@ -2124,6 +2124,18 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
parse( writer.toString() );
}
public void testBug71733() throws Exception
{
Writer writer = new StringWriter();
writer.write( "void foo( int );\n");
writer.write( "#define BLAH() \\\n");
writer.write( " foo ( /* slash / is misinterpreted as end of comment */ \\\n");
writer.write( " 4 );\n");
writer.write( "int f() { BLAH() }\n");
parse( writer.toString() );
assertEquals( callback.getReferences().size(), 1 );
}
public void testBug69526() throws Exception
{
Writer writer = new StringWriter();

View file

@ -1819,7 +1819,7 @@ public class Scanner2 implements IScanner, IScannerData {
if( text[i] == '/' && ( i+1 < text.length ) && text[i+1] == '*')
{
i += 2;
while( i < text.length && text[i] != '*' && i+1 < text.length && text[i+1] != '/')
while( i < text.length && !(text[i] == '*' && i+1 < text.length && text[i+1] == '/'))
++i;
++i;
}