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:
parent
4811216ec4
commit
23a2d90279
2 changed files with 36 additions and 3 deletions
|
@ -202,6 +202,28 @@ public class LexerTests extends BaseTestCase {
|
||||||
eof();
|
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 {
|
public void testWindowsLineEnding() throws Exception {
|
||||||
init("\n\n");
|
init("\n\n");
|
||||||
nl(); nl(); eof();
|
nl(); nl(); eof();
|
||||||
|
|
|
@ -582,8 +582,19 @@ final public class Lexer implements ITokenSequence {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ':':
|
case ':':
|
||||||
|
// 2.5-3
|
||||||
|
markPhase3();
|
||||||
|
if (nextCharPhase3() != ':') {
|
||||||
|
return newDigraphToken(IToken.tLBRACKET, start);
|
||||||
|
}
|
||||||
|
switch (nextCharPhase3()) {
|
||||||
|
case ':': case '>':
|
||||||
|
restorePhase3();
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newDigraphToken(IToken.tLBRACKET, start);
|
return newDigraphToken(IToken.tLBRACKET, start);
|
||||||
|
}
|
||||||
|
restorePhase3();
|
||||||
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
nextCharPhase3();
|
nextCharPhase3();
|
||||||
return newDigraphToken(IToken.tLBRACE, start);
|
return newDigraphToken(IToken.tLBRACE, start);
|
||||||
|
|
Loading…
Add table
Reference in a new issue