diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog index d5fff579785..e4b488f4452 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog +++ b/core/org.eclipse.cdt.core/parser/ChangeLog @@ -1,3 +1,7 @@ +2003-04-01 John Camelon + Fixed bug35906 + Udated Scanner to not puke on certain control characters. + 2003-03-31 John Camelon Fixed unsigned short SimpleDeclarations not showing up in the outline view. Fixed default visibilities for structs in outline view. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java index b89f97c035a..33ba0fff14b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/model/NewModelBuilder.java @@ -359,6 +359,7 @@ org.eclipse.cdt.internal.core.newparser.IParserCallback#beginSimpleDeclaration(T } else { + elem.setTypeName( wrapper.getClassKind().getImage() ); elem.setIdPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength()); elem.setPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength()); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java index 0fa839d3928..adaca8b0a54 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java @@ -719,7 +719,7 @@ c, quick); // this is an elaborated class specifier Object elab = null; try{ elab = callback.elaboratedTypeSpecifierBegin( decl, consume() );} catch( Exception e ) {} - className(); + name(); try{ callback.elaboratedTypeSpecifierName( elab ); } catch( Exception e ) {} try{ callback.elaboratedTypeSpecifierEnd( elab );} catch( Exception e ) {} encounteredTypename = true; @@ -830,6 +830,25 @@ c, quick); switch (LT(1)) { case Token.tIDENTIFIER: last = consume(); + if( LT(1) == Token.tLT ) + { + consume( Token.tLT ); + + // until we get all the names sorted out + int depth = 1; + + while (depth > 0) { + last = consume(); + switch ( last.getType()) { + case Token.tGT: + --depth; + break; + case Token.tLT: + ++depth; + break; + } + } + } break; default: throw backtrack; @@ -844,6 +863,26 @@ c, quick); switch (LT(1)) { case Token.tIDENTIFIER: last = consume(); + if( LT(1) == Token.tLT ) + { + consume( Token.tLT ); + + // until we get all the names sorted out + int depth = 1; + + while (depth > 0) { + last = consume(); + switch ( last.getType()) { + case Token.tGT: + --depth; + break; + case Token.tLT: + ++depth; + break; + } + } + } + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java index 191b75fb8e2..e5baf23b945 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java @@ -347,7 +347,7 @@ public class Scanner implements IScanner { private boolean throwExceptionOnUnboundedString = true; private boolean throwExceptionOnEOFWithinMultilineComment = true; private boolean throwExceptionOnEOFWithoutBalancedEndifs = true; - private boolean throwExceptionOnBadCharacterRead = true; + private boolean throwExceptionOnBadCharacterRead = false; private boolean quickScan = false; public void setQuickScan(boolean qs) { @@ -1194,7 +1194,11 @@ public class Scanner implements IScanner { // Bad character if( throwExceptionOnBadCharacterRead ) throw new ScannerException( "Invalid character '" + (char)c + "' read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() ); - break; + else + { + c = getChar(); + continue; + } } throw Parser.endOfFile; diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog index 183557a45e7..b3b634dd359 100644 --- a/core/org.eclipse.cdt.ui.tests/ChangeLog +++ b/core/org.eclipse.cdt.ui.tests/ChangeLog @@ -1,106 +1,109 @@ -2003-03-31 John Camelon - Added testStruct() to DOMTests. - Added test35892()to ScannerTest. - -2003-03-31 Andrew Niefer - In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), - and modified to reflect changes in function resolution. - Added testFunctionResolution_TypedefsAndPointers(). - -2003-03-31 John Camelon - Added testWeirdStrings() and testNumerics() to ScannerTestCase. - Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), - testTypedef() and testTemplateInstantiation() to DOMTests. - -2003-03-28 John Camelon - Added testConstructorChain() and testASMDefinition() to DOMTests. - -2003-03-27 Alain Magloire - Changes were done in the Core Model API, the hierarchy is now - ICModel - ICProject - ICContainer - ITranslationUnit - IArchive - IBinary - We adjust the tests. - * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java - * model/org/eclipse/cdt/core/model/tests/BinaryTests.java - * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - -2003-03-26 Andrew Niefer - In ParserSymbolTableTest : - updated all tests to reflect TypeInfo changes - Added testFunctionResolution() & testFunctionResolution_2() in - -2003-03-25 John Camelon - Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), - testUsingClauses() and testEnumSpecifier() to DOMTests. - -2003-03-23 John Camelon - Added ptrOperator() test to DOMTests. - Added testFunctionModifiers() test to DOMTests. - Added testArrays() test to DOMTests. - -2003-03-20 Alain Magloire - - Patch from Amer Hoda, tests for the CElement deltas for Translation Units. - * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-19 Alain Magloire - Patch from Amer Hoda, introducing a simple test for the core model. - * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java - * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h - -2003-03-18 John Camelon - Updated DOMTests to validate simple case of a function declaration with multiple parameters. - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - -2003-03-11 John Camelon - Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier - Organized imports - * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java - * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java - -2003-03-10 John Camelon - Added macro pasting tests - -2003-03-06 Andrew Niefer - Added tests for exercising Namespaces & using directives in new parser's symbol table - -2003-03-04 Doug Schaefer - This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") - JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. - -2003-01-29 Peter Graves - - Fixed the warnings when accessing static methods - * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: - * src/org/eclipse/cdt/testplugin/CTestPlugin.java - * src/org/eclipse/cdt/testplugin/TestWorkbench.java - * ChangeLog: make all entries have the same formatting - -2002-12-17 Peter Graves - - * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and - to move closer to automated running - -2002-11-27 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java: - Use CoreModel.getDefault(). - -2002-10-30 Alain Magloire - - * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): - The fields and the methods use in this test was removed from the CoreModel class. - (testHasNature): The method use in this case was refactor in the classes - CProjectNature and CCProjectNature, fix the test. - -2002-10-18 Peter Graves - - src/org/eclipse/cdt/testplugin/CProjectHelper.jada - Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. - +2003-04-01 + Added testBug35906() to DOMTests. + +2003-03-31 John Camelon + Added testStruct() to DOMTests. + Added test35892()to ScannerTest. + +2003-03-31 Andrew Niefer + In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), + and modified to reflect changes in function resolution. + Added testFunctionResolution_TypedefsAndPointers(). + +2003-03-31 John Camelon + Added testWeirdStrings() and testNumerics() to ScannerTestCase. + Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(), + testTypedef() and testTemplateInstantiation() to DOMTests. + +2003-03-28 John Camelon + Added testConstructorChain() and testASMDefinition() to DOMTests. + +2003-03-27 Alain Magloire + Changes were done in the Core Model API, the hierarchy is now + ICModel + ICProject + ICContainer + ITranslationUnit + IArchive + IBinary + We adjust the tests. + * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java + * model/org/eclipse/cdt/core/model/tests/BinaryTests.java + * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + +2003-03-26 Andrew Niefer + In ParserSymbolTableTest : + updated all tests to reflect TypeInfo changes + Added testFunctionResolution() & testFunctionResolution_2() in + +2003-03-25 John Camelon + Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), + testUsingClauses() and testEnumSpecifier() to DOMTests. + +2003-03-23 John Camelon + Added ptrOperator() test to DOMTests. + Added testFunctionModifiers() test to DOMTests. + Added testArrays() test to DOMTests. + +2003-03-20 Alain Magloire + + Patch from Amer Hoda, tests for the CElement deltas for Translation Units. + * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-19 Alain Magloire + Patch from Amer Hoda, introducing a simple test for the core model. + * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java + * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h + +2003-03-18 John Camelon + Updated DOMTests to validate simple case of a function declaration with multiple parameters. + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + +2003-03-11 John Camelon + Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier + Organized imports + * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java + * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java + +2003-03-10 John Camelon + Added macro pasting tests + +2003-03-06 Andrew Niefer + Added tests for exercising Namespaces & using directives in new parser's symbol table + +2003-03-04 Doug Schaefer + This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") + JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests. + +2003-01-29 Peter Graves + + Fixed the warnings when accessing static methods + * src/org/eclipse/cdt/testplugin/util/DialogCheck.java: + * src/org/eclipse/cdt/testplugin/CTestPlugin.java + * src/org/eclipse/cdt/testplugin/TestWorkbench.java + * ChangeLog: make all entries have the same formatting + +2002-12-17 Peter Graves + + * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and + to move closer to automated running + +2002-11-27 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java: + Use CoreModel.getDefault(). + +2002-10-30 Alain Magloire + + * model/org/eclipse/cdt/core/model/tests/CModelTests.java (testGetNatureID): + The fields and the methods use in this test was removed from the CoreModel class. + (testHasNature): The method use in this case was refactor in the classes + CProjectNature and CCProjectNature, fix the test. + +2002-10-18 Peter Graves + + src/org/eclipse/cdt/testplugin/CProjectHelper.jada + Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. + diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java index df44866526d..86cd9290bc7 100644 --- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java +++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java @@ -968,6 +968,26 @@ public class DOMTests extends TestCase { assertEquals( d.getPointerOperators().size(), 0 ); assertEquals( d.getName().toString(), "left" ); } - + + + public void testBug35906() throws Exception + { + StringWriter code = new StringWriter(); + code.write( "void TTest::MTest() {}\n" ); + code.write( "struct TTest::STest *TTest::FTest (int i) {}\n" ); + TranslationUnit tu = parse( code.toString() ); + assertEquals( tu.getDeclarations().size(), 2 ); + SimpleDeclaration declaration = (SimpleDeclaration)tu.getDeclarations().get(0); + assertEquals( declaration.getDeclSpecifier().getType(), DeclSpecifier.t_void ); + assertEquals( declaration.getDeclarators().size(), 1 ); + Declarator d = (Declarator)declaration.getDeclarators().get(0); + assertEquals( d.getName().toString(), "TTest::MTest"); + + declaration = (SimpleDeclaration)tu.getDeclarations().get(1); + ElaboratedTypeSpecifier spec = (ElaboratedTypeSpecifier)declaration.getTypeSpecifier(); + assertEquals( spec.getClassKey(), ClassKey.t_struct ); + assertEquals( spec.getName().toString(), "TTest::STest" ); + } + }