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

Patch for Devin Steffler.

Fixed Bug 102568 - [Scanner] The Outline view does not show all methods of a class!
This commit is contained in:
John Camelon 2005-07-04 18:38:42 +00:00
parent a80f774ac0
commit 843da7c608
2 changed files with 25 additions and 1 deletions

View file

@ -2294,4 +2294,21 @@ public class Scanner2Test extends BaseScanner2Test
validateDefinition("TEST", "'y'"); //$NON-NLS-1$ //$NON-NLS-2$
validateDefinition("TRUE", "1"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBug102568A() throws Exception {
initializeScanner("///*\r\nint x;\r\n");
validateToken( IToken.t_int );
validateIdentifier( "x" ); //$NON-NLS-1$
validateToken( IToken.tSEMI );
validateEOF();
}
public void testBug102568B() throws Exception {
initializeScanner("// bla some thing /* ... \r\nint x;\r\n");
validateToken( IToken.t_int );
validateIdentifier( "x" ); //$NON-NLS-1$
validateToken( IToken.tSEMI );
validateEOF();
}
}

View file

@ -3512,7 +3512,7 @@ abstract class BaseScanner implements IScanner {
if (pos + 1 < limit) {
if (buffer[pos + 1] == '/') {
// C++ comment, skip rest of line
skipToNewLine();
skipToNewLine(true);
// leave the new line there
--bufferPos[bufferStackPos];
return false;
@ -3856,6 +3856,10 @@ abstract class BaseScanner implements IScanner {
}
protected void skipToNewLine() {
skipToNewLine(false);
}
protected void skipToNewLine(boolean insideComment) {
char[] buffer = bufferStack[bufferStackPos];
int limit = bufferLimit[bufferStackPos];
int pos = ++bufferPos[bufferStackPos];
@ -3868,6 +3872,9 @@ abstract class BaseScanner implements IScanner {
while (++bufferPos[bufferStackPos] < limit) {
switch (buffer[bufferPos[bufferStackPos]]) {
case '/':
if (insideComment)
break;
pos = bufferPos[bufferStackPos];
if (pos + 1 < limit && buffer[pos + 1] == '*') {
++bufferPos[bufferStackPos];