X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java index 262d596..e3bfcda 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java @@ -72,7 +72,7 @@ public class IdentifierIndexManager { line.append(phpdocLength); } } - + private void addClassVariableInformation(char typeOfIdentifier, char[] identifier, StringBuffer line, int phpdocOffset, int phpdocLength) { line.append('\t'); @@ -80,7 +80,7 @@ public class IdentifierIndexManager { line.append(identifier); line.append("\to"); // Offset // we don't store the '$' in the index for class variables: - line.append(fScanner.getCurrentTokenStartPosition()+1); + line.append(fScanner.getCurrentTokenStartPosition() + 1); if (phpdocOffset >= 0) { line.append("\tp"); // phpdoc offset line.append(phpdocOffset); @@ -113,33 +113,27 @@ public class IdentifierIndexManager { char[] ident; char[] classVariable; int counter = 0; + boolean hasModifiers = false; int phpdocOffset = -1; int phpdocLength = -1; try { while (fToken != TokenNameEOF && fToken != TokenNameERROR) { phpdocOffset = -1; + hasModifiers = false; if (fToken == TokenNameCOMMENT_PHPDOC) { phpdocOffset = fScanner.getCurrentTokenStartPosition(); phpdocLength = fScanner.getCurrentTokenEndPosition() - fScanner.getCurrentTokenStartPosition() + 1; getNextToken(); + while (fToken == TokenNamestatic || fToken == TokenNamefinal || fToken == TokenNamepublic + || fToken == TokenNameprotected || fToken == TokenNameprivate || fToken == TokenNameabstract) { + hasModifiers = true; + getNextToken(); + } if (fToken == TokenNameEOF || fToken == TokenNameERROR) { break; } } - if (fToken == TokenNamevar || fToken == TokenNamestatic || fToken == TokenNamefinal || fToken == TokenNamepublic - || fToken == TokenNameprotected || fToken == TokenNameprivate) { - while (fToken == TokenNamevar || fToken == TokenNamestatic || fToken == TokenNamefinal || fToken == TokenNamepublic - || fToken == TokenNameprotected || fToken == TokenNameprivate) { - getNextToken(); - } - if (fToken == TokenNameVariable) { - ident = fScanner.getCurrentIdentifierSource(); - classVariable = new char[ident.length - 1]; - System.arraycopy(ident, 1, classVariable, 0, ident.length - 1); - addClassVariableInformation('v', classVariable, buf, phpdocOffset, phpdocLength); - getNextToken(); - } - } else if (fToken == TokenNamefunction) { + if (fToken == TokenNamefunction) { getNextToken(); if (fToken == TokenNameAND) { getNextToken(); @@ -174,7 +168,23 @@ public class IdentifierIndexManager { } parseDeclarations(ident, buf, true); } - } else if (fToken == TokenNameIdentifier) { + } else if (fToken == TokenNamevar || hasModifiers || fToken == TokenNamestatic || fToken == TokenNamefinal + || fToken == TokenNamepublic || fToken == TokenNameprotected || fToken == TokenNameprivate) { + while (fToken == TokenNamevar || fToken == TokenNamestatic || fToken == TokenNamefinal || fToken == TokenNamepublic + || fToken == TokenNameprotected || fToken == TokenNameprivate) { + getNextToken(); + } + while (fToken == TokenNameVariable) { + ident = fScanner.getCurrentIdentifierSource(); + classVariable = new char[ident.length - 1]; + System.arraycopy(ident, 1, classVariable, 0, ident.length - 1); + addClassVariableInformation('v', classVariable, buf, phpdocOffset, phpdocLength); + getNextToken(); + if (fToken == TokenNameCOMMA) { + getNextToken(); + } + } + } else if (!hasModifiers && fToken == TokenNameIdentifier) { ident = fScanner.getCurrentIdentifierSource(); getNextToken(); if (ident.length == 6 && ident[0] == 'd' && ident[1] == 'e' && ident[2] == 'f' && ident[3] == 'i' && ident[4] == 'n' @@ -221,6 +231,7 @@ public class IdentifierIndexManager { char[] ident; String identifier; int counter = 0; + boolean hasModifiers = false; int phpdocOffset = -1; int phpdocLength = -1; fScanner.setSource(charArray); @@ -230,10 +241,16 @@ public class IdentifierIndexManager { try { while (fToken != TokenNameEOF) { // && fToken != TokenNameERROR) { phpdocOffset = -1; + hasModifiers = false; if (fToken == TokenNameCOMMENT_PHPDOC) { phpdocOffset = fScanner.getCurrentTokenStartPosition(); phpdocLength = fScanner.getCurrentTokenEndPosition() - fScanner.getCurrentTokenStartPosition() + 1; getNextToken(); + while (fToken == TokenNamestatic || fToken == TokenNamefinal || fToken == TokenNamepublic + || fToken == TokenNameprotected || fToken == TokenNameprivate || fToken == TokenNameabstract) { + hasModifiers = true; + getNextToken(); + } if (fToken == TokenNameEOF || fToken == TokenNameERROR) { break; } @@ -267,7 +284,7 @@ public class IdentifierIndexManager { ident = fScanner.getCurrentIdentifierSource(); addIdentifierInformation('g', ident, buf, phpdocOffset, phpdocLength); getNextToken(); - } else if (fToken == TokenNameIdentifier) { + } else if (!hasModifiers && fToken == TokenNameIdentifier) { ident = fScanner.getCurrentIdentifierSource(); getNextToken(); if (ident.length == 6 && ident[0] == 'd' && ident[1] == 'e' && ident[2] == 'f' && ident[3] == 'i' && ident[4] == 'n'