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

Patch for Victor Mozgin.

Fixed PR 39532 : Parser fails on fully-qualified class names.
This commit is contained in:
John Camelon 2003-07-30 13:04:53 +00:00
parent 57c348fffa
commit 7b4de80105
5 changed files with 21 additions and 19 deletions

View file

@ -1,3 +1,6 @@
2003-07-30 Victor Mozgin
Moved testBug39532() from ASTFailedTests.java to QuickParseASTTests.java.
2003-07-29 John Camelon 2003-07-29 John Camelon
Updated QuickParseASTTests for pointer to function updates. Updated QuickParseASTTests for pointer to function updates.
Updated CompleteParseASTTests for typedef work. Updated CompleteParseASTTests for typedef work.

View file

@ -90,10 +90,6 @@ public class ASTFailedTests extends BaseASTTest
{ {
assertCodeFailsParse("class AString { operator char const *() const; };"); assertCodeFailsParse("class AString { operator char const *() const; };");
} }
public void testBug39532() throws Exception
{
assertCodeFailsParse("class N1::N2::B : public A {};");
}
public void testBug39535() throws Exception public void testBug39535() throws Exception
{ {
assertCodeFailsParse("namespace bar = foo;"); assertCodeFailsParse("namespace bar = foo;");

View file

@ -1751,4 +1751,10 @@ public class QuickParseASTTests extends BaseASTTest
assertEquals( typedef.getName(), "life"); assertEquals( typedef.getName(), "life");
} }
public void testBug39532() throws Exception
{
parse("class N1::N2::B : public A {};");
assertTrue( quickParseCallback.getCompilationUnit().getDeclarations().hasNext() );
}
} }

View file

@ -1,3 +1,6 @@
2003-07-30 Victor Mozgin
Fixed PR 39532 : Parser fails on fully-qualified class names.
2003-07-29 John Camelon 2003-07-29 John Camelon
Updated AST to better represent pointers to functions/methods. Updated AST to better represent pointers to functions/methods.
Implemented typedef declaration/x-ref infrastructure. Implemented typedef declaration/x-ref infrastructure.

View file

@ -1563,21 +1563,15 @@ public class Parser implements IParser
*/ */
protected ITokenDuple className() throws Backtrack protected ITokenDuple className() throws Backtrack
{ {
if (LT(1) == IToken.tIDENTIFIER) ITokenDuple duple = name();
{ IToken last = duple.getLastToken();
if (LT(2) == IToken.tLT) if (LT(1) == IToken.tLT) {
{ last = consumeTemplateParameters(duple.getLastToken());
return new TokenDuple(LA(1), templateId());
}
else
{
IToken t = identifier();
return new TokenDuple(t, t);
}
} }
else
throw backtrack; return new TokenDuple(duple.getFirstToken(), last);
} }
/** /**
* Parse a template-id, according to the ANSI C++ spec. * Parse a template-id, according to the ANSI C++ spec.
* *
@ -1590,8 +1584,8 @@ public class Parser implements IParser
*/ */
protected IToken templateId() throws Backtrack protected IToken templateId() throws Backtrack
{ {
IToken first = consume(IToken.tIDENTIFIER); ITokenDuple duple = name();
IToken last = consumeTemplateParameters(first); IToken last = consumeTemplateParameters(duple.getLastToken());
return last; return last;
} }
/** /**