1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Patch for John Camelon:

CORE
 - fixed bug35906
 - updated scanner to not puke on certain control characters

TESTS
 - added testBug35906() to DOMTests.
This commit is contained in:
Doug Schaefer 2003-04-02 13:13:34 +00:00
parent c021d8a42e
commit 6b80ff9dd3
6 changed files with 181 additions and 110 deletions

View file

@ -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.

View file

@ -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());
}

View file

@ -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;
}
}
}
}
}

View file

@ -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;

View file

@ -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.

View file

@ -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" );
}
}