1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
John Camelon 2004-05-13 18:52:13 +00:00
parent 1549ba8899
commit 87821eb4fc
2 changed files with 16 additions and 9 deletions

View file

@ -1473,15 +1473,6 @@ public class ScannerTestCase extends BaseScannerTest
assertEquals( callback.problems.size(), 1 );
}
// public void testGerman() throws ScannerException
// {
// initializeScanner("\"Lißä\" 'ß' /* Lißä */ Lißä ");
// validateString("Lißä");
// validateChar( 'ß' );
// validateIdentifier( "Lißä");
// validateEOF();
// }
public void test54778() throws ScannerException
{
@ -1563,4 +1554,12 @@ public class ScannerTestCase extends BaseScannerTest
validateString( "ab"); //$NON-NLS-1$
validateEOF();
}
public void testBug62042() throws Exception
{
Callback callback = new Callback(ParserMode.QUICK_PARSE);
initializeScanner( "0x", ParserMode.QUICK_PARSE, callback ); //$NON-NLS-1$
validateEOF();
assertFalse( callback.problems.isEmpty() );
}
}

View file

@ -69,6 +69,7 @@ import org.eclipse.cdt.internal.core.parser.util.TraceUtil;
public class Scanner implements IScanner {
protected static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
private static final ObjectMacroDescriptor CPLUSPLUS_MACRO = new ObjectMacroDescriptor( __CPLUSPLUS, "199711L"); //$NON-NLS-1$
private static final ObjectMacroDescriptor STDC_VERSION_MACRO = new ObjectMacroDescriptor( __STDC_VERSION__, "199001L"); //$NON-NLS-1$
protected static final ObjectMacroDescriptor STDC_HOSTED_MACRO = new ObjectMacroDescriptor( __STDC_HOSTED__, "0"); //$NON-NLS-1$
@ -1131,7 +1132,14 @@ public class Scanner implements IScanner {
int tokenType = floatingPoint ? IToken.tFLOATINGPT : IToken.tINTEGER;
if( tokenType == IToken.tINTEGER && hex )
{
if( result.equals( HEX_PREFIX) )
{
handleProblem( IProblem.SCANNER_BAD_HEX_FORMAT, HEX_PREFIX, beginOffset, false, true );
return null;
}
tokenType = IToken.tHEXINT;
}
return newToken(
tokenType,