1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 398254 - Syntax error in A<::B> a;

This commit is contained in:
Sergey Prigogin 2013-01-15 16:51:46 -08:00
parent 4811216ec4
commit 23a2d90279
2 changed files with 36 additions and 3 deletions

View file

@ -202,6 +202,28 @@ public class LexerTests extends BaseTestCase {
eof();
}
public void testLessColonColon() throws Exception {
// 2.5-3
// <: is treated as digraph [
init("<::>");
token(IToken.tLBRACKET);
token(IToken.tRBRACKET);
eof();
// <: is treated as digraph [
init("<:::");
token(IToken.tLBRACKET);
token(IToken.tCOLONCOLON);
eof();
// <:: is treated as < and ::
init("<::A");
token(IToken.tLT);
token(IToken.tCOLONCOLON);
token(IToken.tIDENTIFIER);
eof();
}
public void testWindowsLineEnding() throws Exception {
init("\n\n");
nl(); nl(); eof();

View file

@ -582,8 +582,19 @@ final public class Lexer implements ITokenSequence {
}
break;
case ':':
nextCharPhase3();
return newDigraphToken(IToken.tLBRACKET, start);
// 2.5-3
markPhase3();
if (nextCharPhase3() != ':') {
return newDigraphToken(IToken.tLBRACKET, start);
}
switch (nextCharPhase3()) {
case ':': case '>':
restorePhase3();
nextCharPhase3();
return newDigraphToken(IToken.tLBRACKET, start);
}
restorePhase3();
break;
case '%':
nextCharPhase3();
return newDigraphToken(IToken.tLBRACE, start);