line.append(phpdocLength);
}
}
-
+
private void addClassVariableInformation(char typeOfIdentifier, char[] identifier, StringBuffer line, int phpdocOffset,
int phpdocLength) {
line.append('\t');
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);
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();
}
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'
ident = fScanner.getCurrentStringLiteralSource();
addIdentifierInformation('d', ident, buf, phpdocOffset, phpdocLength);
getNextToken();
+ } else if (fToken == TokenNameStringSingleQuote) {
+ ident = fScanner.getCurrentStringLiteralSource();
+ addIdentifierInformation('d', ident, buf, phpdocOffset, phpdocLength);
+ getNextToken();
}
}
}
char[] ident;
String identifier;
int counter = 0;
+ boolean hasModifiers = false;
int phpdocOffset = -1;
int phpdocLength = -1;
fScanner.setSource(charArray);
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;
}
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'
ident = fScanner.getCurrentStringLiteralSource();
addIdentifierInformation('d', ident, buf, phpdocOffset, phpdocLength);
getNextToken();
- }
+ } else if (fToken == TokenNameStringSingleQuote) {
+ ident = fScanner.getCurrentStringLiteralSource();
+ addIdentifierInformation('d', ident, buf, phpdocOffset, phpdocLength);
+ getNextToken();
+ }
}
}
} else {