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
|
2004-02-25 Alain Magloire
|
||||||
Added the PathEntry in the AllCoreTests suite
|
Added the PathEntry in the AllCoreTests suite
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,8 @@ public class BaseScannerTest extends TestCase {
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
IToken t= scanner.nextToken();
|
IToken t= scanner.nextToken();
|
||||||
assertTrue(t.getType() == IToken.tIDENTIFIER);
|
assertEquals( t.getType(), IToken.tIDENTIFIER );
|
||||||
assertTrue(t.getImage().equals(expectedImage));
|
assertEquals(t.getImage(), expectedImage );
|
||||||
} catch (EndOfFileException e) {
|
} catch (EndOfFileException e) {
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1555,4 +1555,13 @@ public class ScannerTestCase extends BaseScannerTest
|
||||||
scanner.nextToken();
|
scanner.nextToken();
|
||||||
assertEquals( callback.problems.size(), 1 );
|
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
|
2004-02-24 John Camelon
|
||||||
Refactoring Scanner.handleInclusion to be more modular.
|
Refactoring Scanner.handleInclusion to be more modular.
|
||||||
|
|
||||||
|
|
|
@ -994,8 +994,12 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
((c >= 'a') && (c <= 'z'))
|
// JOHNC - Accept non-ASCII Input
|
||||||
|| ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
|
// ((c >= 'a') && (c <= 'z'))
|
||||||
|
// || ((c >= 'A') && (c <= 'Z')) || (c == '_')) {
|
||||||
|
Character.isLetter((char)c) || ( c == '_')
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
|
int baseOffset = lastContext.getOffset() - lastContext.undoStackSize() - 1;
|
||||||
|
|
||||||
|
@ -1005,10 +1009,13 @@ public class Scanner implements IScanner {
|
||||||
|
|
||||||
c = getChar();
|
c = getChar();
|
||||||
|
|
||||||
while (((c >= 'a') && (c <= 'z'))
|
while (
|
||||||
|| ((c >= 'A') && (c <= 'Z'))
|
Character.isUnicodeIdentifierPart( (char)c)
|
||||||
|| ((c >= '0') && (c <= '9'))
|
// ((c >= 'a') && (c <= 'z'))
|
||||||
|| (c == '_')) {
|
// || ((c >= 'A') && (c <= 'Z'))
|
||||||
|
// || ((c >= '0') && (c <= '9'))
|
||||||
|
// || (c == '_')
|
||||||
|
) {
|
||||||
buff.append((char) c);
|
buff.append((char) c);
|
||||||
c = getChar();
|
c = getChar();
|
||||||
}
|
}
|
||||||
|
@ -2003,7 +2010,6 @@ public class Scanner implements IScanner {
|
||||||
if (tokenImage.length() > 0) throw endOfMacroToken;
|
if (tokenImage.length() > 0) throw endOfMacroToken;
|
||||||
c = getChar();
|
c = getChar();
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (c == '"') {
|
} else if (c == '"') {
|
||||||
|
|
||||||
if (tokenImage.length() > 0) throw endOfMacroToken;
|
if (tokenImage.length() > 0) throw endOfMacroToken;
|
||||||
|
|
Loading…
Add table
Reference in a new issue