import java.util.ArrayList;
import java.util.List;
-import java.util.Vector;
import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
-
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.TextAttribute;
// Add word rule for keywords, types, and constants.
PHPWordRule wordRule = new PHPWordRule(new PHPWordDetector(), other);
- //choochter-->
- for (int i = 0; i < PHPKeywords.PHP_KEYWORS.length; i++)
- wordRule.addWord(PHPKeywords.PHP_KEYWORS[i], keyword);
-
- /*Read in the keywords from the XML file*/
- PHPSyntaxRdr syntaxRdr = new PHPSyntaxRdr();
- syntaxRdr.readFromFile(
- "C:\\eclipse\\workspace\\net.sourceforge.phpeclipse\\src\\net\\sourceforge\\phpeclipse\\phpeditor"
- + java.io.File.separator
- + "syntax.xml");
- {
- Vector Vbuffer = syntaxRdr.getKeywords();
- String VString = null;
- //Read keywords
- while ((Vbuffer != null) && (!Vbuffer.isEmpty() && ((VString = (String) Vbuffer.remove(0)) != null))) {
- wordRule.addWord(VString, keyword);
- }
- //Read functions - to be tested
- Vbuffer = syntaxRdr.getFunctions();
- while ((Vbuffer != null) && (!Vbuffer.isEmpty() && ((VString = (String) Vbuffer.remove(0)) != null))) {
- wordRule.addWord(VString, functionName);
- }
- }
-
- //for (int i = 0; i < PHPFunctionNames.FUNCTION_NAMES.length; i++)
- // wordRule.addWord(PHPFunctionNames.FUNCTION_NAMES[i], functionName);
- //<--choochter
+// //choochter-->
+// for (int i = 0; i < PHPKeywords.PHP_KEYWORS.length; i++)
+// wordRule.addWord(PHPKeywords.PHP_KEYWORS[i], keyword);
+//
+// /*Read in the keywords from the XML file*/
+// PHPSyntaxRdr syntaxRdr = new PHPSyntaxRdr();
+// syntaxRdr.readFromFile(
+// "C:\\eclipse\\workspace\\net.sourceforge.phpeclipse\\src\\net\\sourceforge\\phpeclipse\\phpeditor"
+// + java.io.File.separator
+// + "syntax.xml");
+// {
+// Vector Vbuffer = syntaxRdr.getKeywords();
+// String VString = null;
+// //Read keywords
+// while ((Vbuffer != null) && (!Vbuffer.isEmpty() && ((VString = (String) Vbuffer.remove(0)) != null))) {
+// wordRule.addWord(VString, keyword);
+// }
+// //Read functions - to be tested
+// Vbuffer = syntaxRdr.getFunctions();
+// while ((Vbuffer != null) && (!Vbuffer.isEmpty() && ((VString = (String) Vbuffer.remove(0)) != null))) {
+// wordRule.addWord(VString, functionName);
+// }
+// }
+//
+// //for (int i = 0; i < PHPFunctionNames.FUNCTION_NAMES.length; i++)
+// // wordRule.addWord(PHPFunctionNames.FUNCTION_NAMES[i], functionName);
+// //<--choochter
+ for (int i = 0; i < PHPFunctionNames.FUNCTION_NAMES.length; i++)
+ wordRule.addWord(PHPFunctionNames.FUNCTION_NAMES[i], functionName);
for (int i = 0; i < fgConstants.length; i++)
wordRule.addWord(fgConstants[i], functionName);
rules.add(wordRule);
--- /dev/null
+package net.sourceforge.phpeclipse.phpeditor.phpparser;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sourceforge.phpdt.internal.ui.PHPUiImages;
+import org.eclipse.jface.resource.ImageDescriptor;
+/**
+ *
+ * @author khartlage
+ */
+public class PHPClassDeclaration extends PHPSegment {
+ ArrayList fFunctions;
+
+ public PHPClassDeclaration(Object parent, String name, int index) {
+ super(parent, name, index);
+ fFunctions = new ArrayList();
+ }
+
+ public List getList( ) {
+ return fFunctions;
+ }
+ /**
+ * Appends the specified function declaration
+ *
+ * @param o function declaration to be appended to this list.
+ * @return <tt>true</tt> (as per the general contract of Collection.add).
+ */
+ public boolean add(PHPSegment o) {
+ return fFunctions.add(o);
+ }
+
+ /**
+ * Returns the function declaration at the specified position in this list.
+ *
+ * @param index index of function declaration to return.
+ * @return the function declaration at the specified position in this list.
+ * @throws IndexOutOfBoundsException if index is out of range <tt>(index
+ * < 0 || index >= size())</tt>.
+ */
+ public PHPSegment get(int index) {
+ return (PHPSegment) fFunctions.get(index);
+ }
+
+ /**
+ * Returns the number of declarations in this list.
+ *
+ * @return the number of declarations in this list.
+ */
+ public int size() {
+ return fFunctions.size();
+ }
+
+ public ImageDescriptor getImage() {
+ return PHPUiImages.DESC_CLASS;
+ }
+}
--- /dev/null
+package net.sourceforge.phpeclipse.phpeditor.phpparser;
+
+import net.sourceforge.phpdt.internal.ui.PHPUiImages;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ *
+ * @author khartlage
+ */
+public class PHPFunctionDeclaration extends PHPSegment {
+
+
+ public PHPFunctionDeclaration(Object parent, String name, int index) {
+ super(parent, name, index);
+ }
+
+ public ImageDescriptor getImage() {
+ return PHPUiImages.DESC_FUN;
+ }
+}
--- /dev/null
+package net.sourceforge.phpeclipse.phpeditor.phpparser;
+
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ *
+ * @author khartlage
+ */
+public class PHPOutlineInfo {
+ TreeSet fVariables;
+ PHPClassDeclaration fDeclarations;
+
+ public PHPOutlineInfo(Object parent) {
+ fVariables = new TreeSet();
+ fDeclarations = new PHPClassDeclaration(parent, "_root", 1);
+ }
+
+ public TreeSet getVariables() {
+ return fVariables;
+ }
+
+ public PHPClassDeclaration getDeclarations() {
+ return fDeclarations;
+ }
+
+ public boolean add(PHPFunctionDeclaration o) {
+ return fDeclarations.add(o);
+ }
+
+ public boolean addVariable(String variable) {
+ return fVariables.add(variable);
+ }
+}
--- /dev/null
+package net.sourceforge.phpeclipse.phpeditor.phpparser;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
+
+/**
+ *
+ * @author khartlage
+ */
+public abstract class PHPSegment {
+ private String name;
+ private Position position;
+ private Object parent;
+
+ public PHPSegment(Object parent, String name, int index) {
+ this.parent = parent;
+ this.name = name;
+ this.position = new Position(index, name.length());
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ public Position getPosition() {
+ return position;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public abstract ImageDescriptor getImage();
+};
\ No newline at end of file