import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
import net.sourceforge.phpdt.internal.compiler.parser.SyntaxError;
import net.sourceforge.phpdt.internal.compiler.util.Util;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.obfuscator.PHPIdentifier;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
/**
* Manages the identifer index information for a specific project
*
*
* @param typeOfIdentifier
* the type of the identifier ('c'lass, 'd'efine, 'f'unction,
- * 'm'ethod, 'v'ariable)
+ * 'm'ethod(class), 'v'ariable(class) 'g'lobal variable)
* @param identifier
* current identifier
* @param line
ident[5]=='e') {
if (fToken == TokenNameLPAREN) {
getNextToken();
- if (fToken == TokenNameStringLiteral) {
+ if (fToken == TokenNameStringDoubleQuote) {
ident = fScanner.getCurrentStringLiteralSource();
addIdentifierInformation('d', ident, buf, phpdocOffset,
phpdocLength);
}
}
}
+ } else if (fToken == TokenNameglobal) {
+ // global variable
+ while (fToken != TokenNameEOF && fToken != TokenNameERROR &&
+ fToken != TokenNameSEMICOLON &&
+ fToken != TokenNameLBRACE &&
+ fToken != TokenNameRBRACE ) {
+ getNextToken();
+ if (fToken == TokenNameVariable) {
+ ident = fScanner.getCurrentIdentifierSource();
+ addIdentifierInformation('g', ident, buf, phpdocOffset,
+ phpdocLength);
+ }
+ }
} else if (fToken == TokenNameLBRACE) {
getNextToken();
counter++;
}
parseDeclarations(ident, buf, true);
}
+ } else if (fToken == TokenNameVariable) {
+ // global variable
+ ident = fScanner.getCurrentIdentifierSource();
+ addIdentifierInformation('g', ident, buf, phpdocOffset,
+ phpdocLength);
+ getNextToken();
} else if (fToken == TokenNameIdentifier) {
ident = fScanner.getCurrentIdentifierSource();
getNextToken();
ident[5]=='e') {
if (fToken == TokenNameLPAREN) {
getNextToken();
- if (fToken == TokenNameStringLiteral) {
+ if (fToken == TokenNameStringDoubleQuote) {
ident = fScanner.getCurrentStringLiteralSource();
addIdentifierInformation('d', ident, buf, phpdocOffset,
phpdocLength);
phpIdentifier = new PHPIdentifierLocation(identifier,
PHPIdentifier.FUNCTION, phpFileName);
break;
+ case 'g' :
+ // global variable
+ identifier = token.substring(1);
+ phpIdentifier = new PHPIdentifierLocation(identifier,
+ PHPIdentifier.GLOBAL_VARIABLE, phpFileName);
+ break;
case 'k' :
// constructor function name
identifier = token.substring(1);
}
break;
default :
+ PHPeclipsePlugin.log(IStatus.ERROR, "Unknown token character in IdentifierIndexManager: "+token.charAt(0));
identifier = null;
phpIdentifier = null;
classname = null;
//System.out.println(token);
} else {
return;
- }
+ }
+ int offset = -1;
// all the other tokens are identifiers:
while (tokenizer.hasMoreTokens()) {
token = tokenizer.nextToken();
phpIdentifier = new PHPIdentifierLocation(identifier,
PHPIdentifier.FUNCTION, phpFileName);
break;
+ case 'g' :
+ // global variable
+ identifier = token.substring(1);
+ phpIdentifier = new PHPIdentifierLocation(identifier,
+ PHPIdentifier.GLOBAL_VARIABLE, phpFileName);
+ break;
case 'k' :
// constructor function name
identifier = token.substring(1);
phpIdentifier = new PHPIdentifierLocation(identifier,
PHPIdentifier.METHOD, phpFileName, classname);
break;
+ case 'o' :
+ // offset information
+ identifier = null;
+ break;
case 'v' :
// variable inside a class
identifier = token.substring(1);
PHPIdentifier.VARIABLE, phpFileName, classname);
break;
default :
+ PHPeclipsePlugin.log(IStatus.ERROR, "Unknown token character in IdentifierIndexManager: "+token.charAt(0));
identifier = null;
phpIdentifier = null;
classname = null;