mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Scanner fix for lost comment character within an #ifdef'ed out block.
This commit is contained in:
parent
cda607e788
commit
92d74a7ca9
2 changed files with 12 additions and 2 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.parser.ParserFactoryError;
|
|||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||
import org.eclipse.cdt.internal.core.parser.scanner.Scanner;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -1645,4 +1646,15 @@ public class ScannerTestCase extends BaseScannerTest
|
|||
validateToken( IToken.tRBRACE);
|
||||
validateEOF();
|
||||
}
|
||||
|
||||
public void testEndif() throws Exception
|
||||
{
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "#ifdef __X__\n" ); //$NON-NLS-1$
|
||||
writer.write( " // comment\n" ); //$NON-NLS-1$
|
||||
writer.write( "#endif\n" ); //$NON-NLS-1$
|
||||
initializeScanner( writer.toString() );
|
||||
validateEOF();
|
||||
assertEquals( ((Scanner)scanner).getBranchTracker().getDepth(), 0 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1662,13 +1662,11 @@ public final class Scanner implements IScanner, IScannerData {
|
|||
if( c == '/' )
|
||||
{
|
||||
skipOverSinglelineComment();
|
||||
c = getChar(false);
|
||||
continue;
|
||||
}
|
||||
else if( c == '*' )
|
||||
{
|
||||
skipOverMultilineComment();
|
||||
c = getChar(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue