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 2003-03-31 John Camelon
Fixed unsigned short SimpleDeclarations not showing up in the outline view. Fixed unsigned short SimpleDeclarations not showing up in the outline view.
Fixed default visibilities for structs in 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 else
{ {
elem.setTypeName( wrapper.getClassKind().getImage() );
elem.setIdPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength()); elem.setIdPos(wrapper.getClassKind().getOffset(), wrapper.getClassKind().getLength());
elem.setPos(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 // this is an elaborated class specifier
Object elab = null; Object elab = null;
try{ elab = callback.elaboratedTypeSpecifierBegin( decl, consume() );} catch( Exception e ) {} try{ elab = callback.elaboratedTypeSpecifierBegin( decl, consume() );} catch( Exception e ) {}
className(); name();
try{ callback.elaboratedTypeSpecifierName( elab ); } catch( Exception e ) {} try{ callback.elaboratedTypeSpecifierName( elab ); } catch( Exception e ) {}
try{ callback.elaboratedTypeSpecifierEnd( elab );} catch( Exception e ) {} try{ callback.elaboratedTypeSpecifierEnd( elab );} catch( Exception e ) {}
encounteredTypename = true; encounteredTypename = true;
@ -830,6 +830,25 @@ c, quick);
switch (LT(1)) { switch (LT(1)) {
case Token.tIDENTIFIER: case Token.tIDENTIFIER:
last = consume(); 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; break;
default: default:
throw backtrack; throw backtrack;
@ -844,6 +863,26 @@ c, quick);
switch (LT(1)) { switch (LT(1)) {
case Token.tIDENTIFIER: case Token.tIDENTIFIER:
last = consume(); 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 throwExceptionOnUnboundedString = true;
private boolean throwExceptionOnEOFWithinMultilineComment = true; private boolean throwExceptionOnEOFWithinMultilineComment = true;
private boolean throwExceptionOnEOFWithoutBalancedEndifs = true; private boolean throwExceptionOnEOFWithoutBalancedEndifs = true;
private boolean throwExceptionOnBadCharacterRead = true; private boolean throwExceptionOnBadCharacterRead = false;
private boolean quickScan = false; private boolean quickScan = false;
public void setQuickScan(boolean qs) { public void setQuickScan(boolean qs) {
@ -1194,7 +1194,11 @@ public class Scanner implements IScanner {
// Bad character // Bad character
if( throwExceptionOnBadCharacterRead ) if( throwExceptionOnBadCharacterRead )
throw new ScannerException( "Invalid character '" + (char)c + "' read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() ); throw new ScannerException( "Invalid character '" + (char)c + "' read @ offset " + currentContext.getOffset() + " of file " + currentContext.getFilename() );
break; else
{
c = getChar();
continue;
}
} }
throw Parser.endOfFile; throw Parser.endOfFile;

View file

@ -1,106 +1,109 @@
2003-03-31 John Camelon 2003-04-01
Added testStruct() to DOMTests. Added testBug35906() to DOMTests.
Added test35892()to ScannerTest.
2003-03-31 John Camelon
2003-03-31 Andrew Niefer Added testStruct() to DOMTests.
In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(), Added test35892()to ScannerTest.
and modified to reflect changes in function resolution.
Added testFunctionResolution_TypedefsAndPointers(). 2003-03-31 Andrew Niefer
In ParserSymbolTableTest, renamed testFunctionResolution_2() to testFunctionResolution_PointersAndBaseClasses(),
2003-03-31 John Camelon and modified to reflect changes in function resolution.
Added testWeirdStrings() and testNumerics() to ScannerTestCase. Added testFunctionResolution_TypedefsAndPointers().
Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(),
testTypedef() and testTemplateInstantiation() to DOMTests. 2003-03-31 John Camelon
Added testWeirdStrings() and testNumerics() to ScannerTestCase.
2003-03-28 John Camelon Added testTemplateSpecialization(), testTemplateDeclaration(), testBug26467(),
Added testConstructorChain() and testASMDefinition() to DOMTests. testTypedef() and testTemplateInstantiation() to DOMTests.
2003-03-27 Alain Magloire 2003-03-28 John Camelon
Changes were done in the Core Model API, the hierarchy is now Added testConstructorChain() and testASMDefinition() to DOMTests.
ICModel
ICProject 2003-03-27 Alain Magloire
ICContainer Changes were done in the Core Model API, the hierarchy is now
ITranslationUnit ICModel
IArchive ICProject
IBinary ICContainer
We adjust the tests. ITranslationUnit
* model/org/eclipse/cdt/core/model/tests/ArchiveTests.java IArchive
* model/org/eclipse/cdt/core/model/tests/BinaryTests.java IBinary
* model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java We adjust the tests.
* model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java * model/org/eclipse/cdt/core/model/tests/ArchiveTests.java
* model/org/eclipse/cdt/core/model/tests/BinaryTests.java
2003-03-26 Andrew Niefer * model/org/eclipse/cdt/core/model/tests/TranslationUniTests.java
In ParserSymbolTableTest : * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java
updated all tests to reflect TypeInfo changes
Added testFunctionResolution() & testFunctionResolution_2() in 2003-03-26 Andrew Niefer
In ParserSymbolTableTest :
2003-03-25 John Camelon updated all tests to reflect TypeInfo changes
Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(), Added testFunctionResolution() & testFunctionResolution_2() in
testUsingClauses() and testEnumSpecifier() to DOMTests.
2003-03-25 John Camelon
2003-03-23 John Camelon Added testDeclSpecifier(), testNamespaceDefinition(), testLinkageSpecification(),
Added ptrOperator() test to DOMTests. testUsingClauses() and testEnumSpecifier() to DOMTests.
Added testFunctionModifiers() test to DOMTests.
Added testArrays() test to DOMTests. 2003-03-23 John Camelon
Added ptrOperator() test to DOMTests.
2003-03-20 Alain Magloire Added testFunctionModifiers() test to DOMTests.
Added testArrays() test to DOMTests.
Patch from Amer Hoda, tests for the CElement deltas for Translation Units.
* model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java 2003-03-20 Alain Magloire
* model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h
Patch from Amer Hoda, tests for the CElement deltas for Translation Units.
2003-03-19 Alain Magloire * model/org/eclipse/cdt/core/model/tests/ElementDeltaTest.java
Patch from Amer Hoda, introducing a simple test for the core model. * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h
* model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.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.
2003-03-18 John Camelon * model/org/eclipse/cdt/core/model/tests/WorkingCopyTests.java
Updated DOMTests to validate simple case of a function declaration with multiple parameters. * model/org/eclipse/cdt/core/model/tests/resource/WorkingCopyTestStart.h
* parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
2003-03-18 John Camelon
2003-03-11 John Camelon Updated DOMTests to validate simple case of a function declaration with multiple parameters.
Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
Organized imports
* parser/org/eclipse/cdt/core/parser/tests/DOMTests.java 2003-03-11 John Camelon
* parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java Updated DOMTests for core.internal.parser change of merging DeclarationSpecifier and DeclSpecifier
Organized imports
2003-03-10 John Camelon * parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
Added macro pasting tests * parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
2003-03-06 Andrew Niefer 2003-03-10 John Camelon
Added tests for exercising Namespaces & using directives in new parser's symbol table Added macro pasting tests
2003-03-04 Doug Schaefer 2003-03-06 Andrew Niefer
This is a pretty big patch, but it is the merge of the NewParser1 branch into the HEAD branch. lder "parser") Added tests for exercising Namespaces & using directives in new parser's symbol table
JUnit tests for testing various pieces (source folder "parser" in cdt.ui.tests.
2003-03-04 Doug Schaefer
2003-01-29 Peter Graves 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.
Fixed the warnings when accessing static methods
* src/org/eclipse/cdt/testplugin/util/DialogCheck.java: 2003-01-29 Peter Graves
* src/org/eclipse/cdt/testplugin/CTestPlugin.java
* src/org/eclipse/cdt/testplugin/TestWorkbench.java Fixed the warnings when accessing static methods
* ChangeLog: make all entries have the same formatting * src/org/eclipse/cdt/testplugin/util/DialogCheck.java:
* src/org/eclipse/cdt/testplugin/CTestPlugin.java
2002-12-17 Peter Graves * src/org/eclipse/cdt/testplugin/TestWorkbench.java
* ChangeLog: make all entries have the same formatting
* plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and
to move closer to automated running 2002-12-17 Peter Graves
2002-11-27 Alain Magloire * plugin.xml,test.xml: Some simple cleanups to remove refrences to the jdt and
to move closer to automated running
* model/org/eclipse/cdt/core/model/tests/CModelTests.java:
Use CoreModel.getDefault(). 2002-11-27 Alain Magloire
2002-10-30 Alain Magloire * model/org/eclipse/cdt/core/model/tests/CModelTests.java:
Use CoreModel.getDefault().
* 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. 2002-10-30 Alain Magloire
(testHasNature): The method use in this case was refactor in the classes
CProjectNature and CCProjectNature, fix the test. * 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.
2002-10-18 Peter Graves (testHasNature): The method use in this case was refactor in the classes
CProjectNature and CCProjectNature, fix the test.
src/org/eclipse/cdt/testplugin/CProjectHelper.jada
Cleanup of the CProjectHelper file to remove unused imports, commeted out code etc. 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.getPointerOperators().size(), 0 );
assertEquals( d.getName().toString(), "left" ); 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" );
}
} }