mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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:
parent
c021d8a42e
commit
6b80ff9dd3
6 changed files with 181 additions and 110 deletions
|
@ -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.
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2003-04-01
|
||||||
|
Added testBug35906() to DOMTests.
|
||||||
|
|
||||||
2003-03-31 John Camelon
|
2003-03-31 John Camelon
|
||||||
Added testStruct() to DOMTests.
|
Added testStruct() to DOMTests.
|
||||||
Added test35892()to ScannerTest.
|
Added test35892()to ScannerTest.
|
||||||
|
|
|
@ -969,5 +969,25 @@ public class DOMTests extends TestCase {
|
||||||
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" );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue