import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
import net.sourceforge.phpeclipse.phpeditor.PHPString;
+import net.sourceforge.phpeclipse.phpeditor.PHPParserAction;
import net.sourceforge.phpeclipse.phpeditor.php.PHPKeywords;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.action.IAction;
import org.eclipse.ui.texteditor.MarkerUtilities;
public class PHPParser extends PHPKeywords {
if (ch2 == '?') {
ch2 = str.charAt(chIndx++);
if (Character.isWhitespace(ch2)) {
- // php start
+ // php start
phpMode = true;
phpFound = true;
break;
chIndx--;
// determine if this identitfer is a keyword
- // @todo improve this in future version
+ // @todo improve this in future version
Integer i = (Integer) keywordMap.get(identifier.toLowerCase());
if (i != null) {
token = i.intValue();
if (ch2 == '?') {
ch2 = input.charAt(i++);
if (Character.isWhitespace(ch2)) {
- // php start
+ // php start
phpMode = true;
phpFound = true;
startIndex = i;
// String temp = ((PHPString)phpList.get(j)).getPHPString();
// int startIndx = temp.length()-10;
// if (startIndx<0) {
- // startIndx = 0;
+ // startIndx = 0;
// }
// System.out.println(temp.substring(startIndx)+"?>");
// }
// for(int j=0;j<phpList.size();j++) {
// temp = (PHPString) phpList.get(j);
// parser.start(temp.getPHPString(), temp.getLineNumber());
- // }
+ // }
}
} catch (CoreException e) {
}
} else {
setMarker(err.getMessage(), err.getLine(), ERROR);
}
- // if an error occured,
+ // if an error occured,
// try to find keywords 'class' or 'function'
// to parse the rest of the string
while (token != TT_EOF && token != TT_UNDEFINED) {
} catch (SyntaxError sytaxErr1) {
setMarker(sytaxErr1.getMessage(), sytaxErr1.getLine(), ERROR);
try {
- // if an error occured,
+ // if an error occured,
// try to find keywords 'class' or 'function'
// to parse the rest of the string
while (token != TT_EOF && token != TT_UNDEFINED) {
// PHPClassDeclaration current = (PHPClassDeclaration) stack.peek();
PHPClassDeclaration temp;
int counter = 0;
-
+ IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
try {
while (token != TT_EOF && token != TT_UNDEFINED) {
if (token == TT_VARIABLE) {
outlineInfo.addVariable(identifier);
getNextToken();
+ } else if (token == TT_var) {
+ getNextToken();
+ if (token == TT_VARIABLE && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_VAR)) {
+ outlineInfo.addVariable(identifier);
+ current.add(new PHPVarDeclaration(current, identifier, chIndx - identifier.length()));
+ getNextToken();
+ }
} else if (token == TT_function) {
getNextToken();
if (token == TT_AMPERSAND) {
getNextToken();
}
- if (token == TT_IDENTIFIER) {
+ if (token == TT_IDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_FUNC)) {
outlineInfo.addVariable(identifier);
current.add(new PHPFunctionDeclaration(current, identifier, chIndx - identifier.length()));
getNextToken();
}
} else if (token == TT_class) {
getNextToken();
- if (token == TT_IDENTIFIER) {
+ if (token == TT_IDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_CLASS)) {
outlineInfo.addVariable(identifier);
temp = new PHPClassDeclaration(current, identifier, chIndx - identifier.length());
current.add(temp);
} else {
throwSyntaxError("':' character after 'case' constant expected.");
}
- } else { // TT_default
+ } else { // TT_default
getNextToken();
if (token == TT_DDOT) {
getNextToken();
getNextToken();
unaryExpression();
break;
- // '@' '&' '*' '+' '-' '~' '!'
+ // '@' '&' '*' '+' '-' '~' '!'
case TT_AT :
getNextToken();
castExpression();