Long longNumber;
Double doubleNumber;
- String stringValue;
+ private String stringValue;
+
+ /** Contains the current expression. */
+ private StringBuffer expression;
+
private boolean phpMode;
final static int TT_EOF = 0;
return outlineInfo;
}
- private void parseDeclarations(PHPOutlineInfo outlineInfo, PHPClassDeclaration current, boolean goBack) {
+ private void parseDeclarations(PHPOutlineInfo outlineInfo, PHPSegmentWithChildren current, boolean goBack) {
// PHPClassDeclaration current = (PHPClassDeclaration) stack.peek();
- PHPClassDeclaration temp;
+ PHPSegmentWithChildren temp;
int counter = 0;
String oldIdentifier;
IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
}
if (token == TT_IDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_FUNC)) {
outlineInfo.addVariable(identifier);
- current.add(new PHPFunctionDeclaration(current, identifier, chIndx - identifier.length()));
+ temp = new PHPFunctionDeclaration(current, identifier, chIndx - identifier.length());
+ current.add(temp);
getNextToken();
+ parseDeclarations(outlineInfo, temp, true);
}
} else if (token == TT_class) {
getNextToken();
current.add(temp);
// stack.push(temp);
getNextToken();
+
+ //skip tokens for classname, extends and others until we have the opening '{'
while (token != TT_LISTOPEN && token != TT_EOF && token != TT_UNDEFINED) {
getNextToken();
}
if (counter == 0 && goBack) {
return;
}
+ } else if (token == TT_require || token == TT_require_once || token == TT_include || token == TT_include_once) {
+ expression();
+ outlineInfo.addVariable(identifier);
+ current.add(new PHPReqIncDeclaration(current, identifier, chIndx - identifier.length(),expression.toString()));
+ getNextToken();
} else {
getNextToken();
}
}
private void expression() throws CoreException {
+ //todo: find a better way to get the expression
+ expression = new StringBuffer();
+ for (int i = chIndx;i<str.length();i++) {
+ if (str.charAt(i) == ';') {
+ break;
+ }
+ expression.append(str.charAt(i));
+ }
// if (token == TT_STRING_CONSTANT || token == TT_INTERPOLATED_STRING) {
// getNextToken();
// } else {