mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
org.eclipse.cdt.core
Updated Scanner to allow for invalid identifier names despite C++'s best efforts at maintaining its honour. org.eclipse.cdt.core.tests Added ScannerTestCase::testGerman().
This commit is contained in:
parent
116fc88367
commit
ba9fc2e462
5 changed files with 30 additions and 9 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-02-25 John Camelon
|
||||
Added ScannerTestCase::testGerman().
|
||||
|
||||
2004-02-25 Alain Magloire
|
||||
Added the PathEntry in the AllCoreTests suite
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ public class BaseScannerTest extends TestCase {
|
|||
{
|
||||
try {
|
||||
IToken t= scanner.nextToken();
|
||||
assertTrue(t.getType() == IToken.tIDENTIFIER);
|
||||
assertTrue(t.getImage().equals(expectedImage));
|
||||
assertEquals( t.getType(), IToken.tIDENTIFIER );
|
||||
assertEquals(t.getImage(), expectedImage );
|
||||
} catch (EndOfFileException e) {
|
||||
assertTrue(false);
|
||||
}
|
||||
|
|
|
@ -1555,4 +1555,13 @@ public class ScannerTestCase extends BaseScannerTest
|
|||
scanner.nextToken();
|
||||
assertEquals( callback.problems.size(), 1 );
|
||||
}
|
||||
|
||||
public void testGerman() throws ScannerException
|
||||
{
|
||||
initializeScanner("\"Lißä\" 'ß' /* Lißä */ Lißä ");
|
||||
validateString("Lißä");
|
||||
validateChar( 'ß' );
|
||||
validateIdentifier( "Lißä");
|
||||
validateEOF();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2004-02-25 John Camelon
|
||||
Updated Scanner to allow for invalid identifier names despite C++'s best efforts at maintaining its honour.
|
||||
|
||||
2004-02-24 John Camelon
|
||||
Refactoring Scanner.handleInclusion to be more modular.
|
||||
|
||||
|
|
|
@ -994,8 +994,12 @@ public class Scanner implements IScanner {
|
|||
|
||||
|
||||
} else if (
|
||||
((c >= 'a') && (c <= 'z'))
|
||||
|| ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
|
||||
// JOHNC - Accept non-ASCII Input
|
||||
// ((c >= 'a') && (c <= 'z'))
|
||||
// || ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
|
||||
Character.isLetter((char)c) || ( c == '_')
|
||||
)
|
||||
{
|
||||
|
||||
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
|
||||
|
||||
|
@ -1005,10 +1009,13 @@ public class Scanner implements IScanner {
|
|||
|
||||
c = getChar();
|
||||
|
||||
while (((c >= 'a') && (c <= 'z'))
|
||||
|| ((c >= 'A') && (c <= 'Z'))
|
||||
|| ((c >= '0') && (c <= '9'))
|
||||
|| (c == '_')) {
|
||||
while (
|
||||
Character.isUnicodeIdentifierPart( (char)c)
|
||||
// ((c >= 'a') && (c <= 'z'))
|
||||
// || ((c >= 'A') && (c <= 'Z'))
|
||||
// || ((c >= '0') && (c <= '9'))
|
||||
// || (c == '_')
|
||||
) {
|
||||
buff.append((char) c);
|
||||
c = getChar();
|
||||
}
|
||||
|
@ -2003,7 +2010,6 @@ public class Scanner implements IScanner {
|
|||
if (tokenImage.length() > 0) throw endOfMacroToken;
|
||||
c = getChar();
|
||||
continue;
|
||||
|
||||
} else if (c == '"') {
|
||||
|
||||
if (tokenImage.length() > 0) throw endOfMacroToken;
|
||||
|
|
Loading…
Add table
Reference in a new issue