initial import
authorgtonic <gtonic>
Fri, 19 Jul 2002 05:01:39 +0000 (05:01 +0000)
committergtonic <gtonic>
Fri, 19 Jul 2002 05:01:39 +0000 (05:01 +0000)
21 files changed:
net.sourceforge.phpeclipse/.classpath [new file with mode: 0644]
net.sourceforge.phpeclipse/.project [new file with mode: 0644]
net.sourceforge.phpeclipse/.template [new file with mode: 0644]
net.sourceforge.phpeclipse/build.properties [new file with mode: 0644]
net.sourceforge.phpeclipse/plugin.xml [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/IPHPColorConstants.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/NonRuleBasedDamagerRepairer.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDocumentProvider.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDoubleClickStrategy.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPScanner.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPTagScanner.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/TagRule.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WhitespaceDetector.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WordDetector.java [new file with mode: 0644]
net.sourceforge.phpeclipse/test/test.php [new file with mode: 0644]
net.sourceforge.phpeclipse/tmp/sample.gif [new file with mode: 0644]

diff --git a/net.sourceforge.phpeclipse/.classpath b/net.sourceforge.phpeclipse/.classpath
new file mode 100644 (file)
index 0000000..1639ffb
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+    <classpathentry kind="src" path="src/"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_2.0.0/resources.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.resources_2.0.0/resourcessrc.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.0.0/workbench.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.ui_2.0.0/workbenchsrc.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.ui.win32_2.0.0/workbenchwin32.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_WIN32_SOURCE/org.eclipse.ui.win32_2.0.0/workbenchwin32src.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_2.0.0/ws/win32/swt.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_WIN32_SOURCE/org.eclipse.swt.win32_2.0.0/ws/win32/swtsrc.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.0.0/runtime.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.runtime_2.0.0/runtimesrc.zip"/>
+    <classpathentry kind="var"
+        path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.0.0/boot.jar" sourcepath="_ORG_ECLIPSE_PLATFORM_SOURCE/org.eclipse.core.boot_2.0.0/bootsrc.zip"/>
+    <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+    <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/net.sourceforge.phpeclipse/.project b/net.sourceforge.phpeclipse/.project
new file mode 100644 (file)
index 0000000..a74b8f8
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>net.sourceforge.phpeclipse</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.PluginNature</nature>
+       </natures>
+</projectDescription>
diff --git a/net.sourceforge.phpeclipse/.template b/net.sourceforge.phpeclipse/.template
new file mode 100644 (file)
index 0000000..f3bcd41
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<form>\r
+   <p/><p><b>Tips on working with this plug-in project</b></p><li>For the view of the new plug-in at a glance, go to the <img href="pageImage"/><a href="OverviewPage">Overview</a>.</li><li>You can test the contributions of this plug-in by launching another instance of the workbench. On the <b>Run</b> menu, click <b>Run As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.run">Run-time Workbench</a> from the available choices.</li><li>You can add more functionality to this plug-in by adding extensions using the <a href="action.newExtension">New Extension Wizard</a>.</li><li>The plug-in project contains Java code that you can debug. Place breakpoints in Java classes. On the <b>Run</b> menu, select <b>Debug As</b> and choose <img href="runTimeWorkbenchImage"/><a href="action.debug">Run-time Workbench</a> from the available choices.</li>\r
+</form>\r
diff --git a/net.sourceforge.phpeclipse/build.properties b/net.sourceforge.phpeclipse/build.properties
new file mode 100644 (file)
index 0000000..18a879d
--- /dev/null
@@ -0,0 +1 @@
+source.phpeclipse.jar = src/
diff --git a/net.sourceforge.phpeclipse/plugin.xml b/net.sourceforge.phpeclipse/plugin.xml
new file mode 100644 (file)
index 0000000..98341d8
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+   id="net.sourceforge.phpeclipse"
+   name="Phpeclipse Plug-in"
+   version="0.0.1"
+   provider-name="phpeclipse"
+   class="net.sourceforge.phpeclipse.PhpeclipsePlugin">
+
+   <runtime>
+      <library name="phpeclipse.jar"/>
+   </runtime>
+   <requires>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.ui"/>
+   </requires>
+
+
+</plugin>
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java
new file mode 100644 (file)
index 0000000..f8431ba
--- /dev/null
@@ -0,0 +1,66 @@
+package net.sourceforge.phpeclipse;
+
+import org.eclipse.ui.plugin.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.resources.*;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class PHPeclipsePlugin extends AbstractUIPlugin {
+       //The shared instance.
+       private static PHPeclipsePlugin plugin;
+       //Resource bundle.
+       private ResourceBundle resourceBundle;
+
+       /**
+        * The constructor.
+        */
+       public PHPeclipsePlugin(IPluginDescriptor descriptor) {
+               super(descriptor);
+               plugin = this;
+               try {
+                       resourceBundle =
+                               ResourceBundle.getBundle(
+                                       "net.sourceforge.PHPeclipsePluginResources");
+               } catch (MissingResourceException x) {
+                       resourceBundle = null;
+               }
+       }
+
+       /**
+        * Returns the shared instance.
+        */
+       public static PHPeclipsePlugin getDefault() {
+               return plugin;
+       }
+
+       /**
+        * Returns the workspace instance.
+        */
+       public static IWorkspace getWorkspace() {
+               return ResourcesPlugin.getWorkspace();
+       }
+
+       /**
+        * Returns the string from the plugin's resource bundle,
+        * or 'key' if not found.
+        */
+       public static String getResourceString(String key) {
+               ResourceBundle bundle =
+                       PHPeclipsePlugin.getDefault().getResourceBundle();
+               try {
+                       return bundle.getString(key);
+               } catch (MissingResourceException e) {
+                       return key;
+               }
+       }
+
+       /**
+        * Returns the plugin's resource bundle,
+        */
+       public ResourceBundle getResourceBundle() {
+               return resourceBundle;
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java
new file mode 100644 (file)
index 0000000..0a5c492
--- /dev/null
@@ -0,0 +1,28 @@
+package net.sourceforge.phpeclipse.editors;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+public class ColorManager {
+
+       protected Map fColorTable = new HashMap(10);
+
+       public void dispose() {
+               Iterator e = fColorTable.values().iterator();
+               while (e.hasNext())
+                        ((Color) e.next()).dispose();
+       }
+       public Color getColor(RGB rgb) {
+               Color color = (Color) fColorTable.get(rgb);
+               if (color == null) {
+                       color = new Color(Display.getCurrent(), rgb);
+                       fColorTable.put(rgb, color);
+               }
+               return color;
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/IPHPColorConstants.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/IPHPColorConstants.java
new file mode 100644 (file)
index 0000000..e68c89c
--- /dev/null
@@ -0,0 +1,18 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.swt.graphics.RGB;
+
+public interface IPHPColorConstants {
+       RGB XML_COMMENT = new RGB(128, 0, 0);
+       RGB PROC_INSTR = new RGB(128, 128, 128);
+       RGB STRING = new RGB(0, 128, 0);
+       RGB DEFAULT = new RGB(0, 0, 0);
+       RGB PHP_TAG = new RGB(0, 0, 128);
+
+       RGB HTML = new RGB(9, 148, 255);
+
+       RGB PHP_DEFAULT = new RGB(255, 154, 9);
+       RGB PHP_COMMENT = new RGB(227, 22, 22);
+       RGB PHP_STRING = new RGB(51, 167, 30);
+       RGB PHP_FUNCTION = new RGB(255, 100, 10);
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/NonRuleBasedDamagerRepairer.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/NonRuleBasedDamagerRepairer.java
new file mode 100644 (file)
index 0000000..b4e077b
--- /dev/null
@@ -0,0 +1,138 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.presentation.IPresentationDamager;
+import org.eclipse.jface.text.presentation.IPresentationRepairer;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.swt.custom.StyleRange;
+
+public class NonRuleBasedDamagerRepairer
+       implements IPresentationDamager, IPresentationRepairer {
+
+       /** The document this object works on */
+       protected IDocument fDocument;
+       /** The default text attribute if non is returned as data by the current token */
+       protected TextAttribute fDefaultTextAttribute;
+
+       /**
+        * Constructor for NonRuleBasedDamagerRepairer.
+        */
+       public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
+               Assert.isNotNull(defaultTextAttribute);
+
+               fDefaultTextAttribute = defaultTextAttribute;
+       }
+
+       /**
+        * @see IPresentationRepairer#setDocument(IDocument)
+        */
+       public void setDocument(IDocument document) {
+               fDocument = document;
+       }
+
+       /**
+        * Returns the end offset of the line that contains the specified offset or
+        * if the offset is inside a line delimiter, the end offset of the next line.
+        *
+        * @param offset the offset whose line end offset must be computed
+        * @return the line end offset for the given offset
+        * @exception BadLocationException if offset is invalid in the current document
+        */
+       protected int endOfLineOf(int offset) throws BadLocationException {
+
+               IRegion info = fDocument.getLineInformationOfOffset(offset);
+               if (offset <= info.getOffset() + info.getLength())
+                       return info.getOffset() + info.getLength();
+
+               int line = fDocument.getLineOfOffset(offset);
+               try {
+                       info = fDocument.getLineInformation(line + 1);
+                       return info.getOffset() + info.getLength();
+               } catch (BadLocationException x) {
+                       return fDocument.getLength();
+               }
+       }
+
+       /**
+        * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
+        */
+       public IRegion getDamageRegion(
+               ITypedRegion partition,
+               DocumentEvent event,
+               boolean documentPartitioningChanged) {
+               if (!documentPartitioningChanged) {
+                       try {
+
+                               IRegion info =
+                                       fDocument.getLineInformationOfOffset(event.getOffset());
+                               int start = Math.max(partition.getOffset(), info.getOffset());
+
+                               int end =
+                                       event.getOffset()
+                                               + (event.getText() == null
+                                                       ? event.getLength()
+                                                       : event.getText().length());
+
+                               if (info.getOffset() <= end
+                                       && end <= info.getOffset() + info.getLength()) {
+                                       // optimize the case of the same line
+                                       end = info.getOffset() + info.getLength();
+                               } else
+                                       end = endOfLineOf(end);
+
+                               end =
+                                       Math.min(
+                                               partition.getOffset() + partition.getLength(),
+                                               end);
+                               return new Region(start, end - start);
+
+                       } catch (BadLocationException x) {
+                       }
+               }
+
+               return partition;
+       }
+
+       /**
+        * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
+        */
+       public void createPresentation(
+               TextPresentation presentation,
+               ITypedRegion region) {
+               addRange(
+                       presentation,
+                       region.getOffset(),
+                       region.getLength(),
+                       fDefaultTextAttribute);
+       }
+
+       /**
+        * Adds style information to the given text presentation.
+        *
+        * @param presentation the text presentation to be extended
+        * @param offset the offset of the range to be styled
+        * @param length the length of the range to be styled
+        * @param attr the attribute describing the style of the range to be styled
+        */
+       protected void addRange(
+               TextPresentation presentation,
+               int offset,
+               int length,
+               TextAttribute attr) {
+               if (attr != null)
+                       presentation.addStyleRange(
+                               new StyleRange(
+                                       offset,
+                                       length,
+                                       attr.getForeground(),
+                                       attr.getBackground(),
+                                       attr.getStyle()));
+       }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java
new file mode 100644 (file)
index 0000000..508ae00
--- /dev/null
@@ -0,0 +1,81 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
+public class PHPConfiguration extends SourceViewerConfiguration {
+       private PHPDoubleClickStrategy doubleClickStrategy;
+       private PHPTagScanner tagScanner;
+       private PHPScanner scanner;
+       private ColorManager colorManager;
+
+       public PHPConfiguration(ColorManager colorManager) {
+               this.colorManager = colorManager;
+       }
+       public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+               return new String[] {
+                       IDocument.DEFAULT_CONTENT_TYPE,
+                       PHPPartitionScanner.HTML_COMMENT,
+                       PHPPartitionScanner.HTML_TAG };
+       }
+       public ITextDoubleClickStrategy getDoubleClickStrategy(
+               ISourceViewer sourceViewer,
+               String contentType) {
+               if (doubleClickStrategy == null)
+                       doubleClickStrategy = new PHPDoubleClickStrategy();
+               return doubleClickStrategy;
+       }
+
+       protected PHPScanner getXMLScanner() {
+               if (scanner == null) {
+                       scanner = new PHPScanner(colorManager);
+                       scanner.setDefaultReturnToken(
+                               new Token(
+                                       new TextAttribute(
+                                               colorManager.getColor(IPHPColorConstants.DEFAULT))));
+               }
+               return scanner;
+
+       }
+
+       protected PHPTagScanner getXMLTagScanner() {
+               if (tagScanner == null) {
+                       tagScanner = new PHPTagScanner(colorManager);
+                       tagScanner.setDefaultReturnToken(
+                               new Token(
+                                       new TextAttribute(
+                                               colorManager.getColor(IPHPColorConstants.PHP_TAG))));
+               }
+               return tagScanner;
+       }
+
+       public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+               PresentationReconciler reconciler = new PresentationReconciler();
+
+               DefaultDamagerRepairer dr =
+                       new DefaultDamagerRepairer(getXMLTagScanner());
+               reconciler.setDamager(dr, PHPPartitionScanner.HTML_TAG);
+               reconciler.setRepairer(dr, PHPPartitionScanner.HTML_TAG);
+
+               dr = new DefaultDamagerRepairer(getXMLScanner());
+               reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+               reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+               NonRuleBasedDamagerRepairer ndr =
+                       new NonRuleBasedDamagerRepairer(
+                               new TextAttribute(
+                                       colorManager.getColor(IPHPColorConstants.XML_COMMENT)));
+               reconciler.setDamager(ndr, PHPPartitionScanner.HTML_COMMENT);
+               reconciler.setRepairer(ndr, PHPPartitionScanner.HTML_COMMENT);
+
+               return reconciler;
+       }
+
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDocumentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDocumentProvider.java
new file mode 100644 (file)
index 0000000..5bffbd3
--- /dev/null
@@ -0,0 +1,35 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.DefaultPartitioner;
+import org.eclipse.ui.editors.text.FileDocumentProvider;
+
+public class PHPDocumentProvider extends FileDocumentProvider {
+
+       /**
+        * Constructor for XMLDocumentProvider.
+        */
+       public PHPDocumentProvider() {
+               super();
+       }
+
+       /* (non-Javadoc)
+        * Method declared on AbstractDocumentProvider
+        */
+       protected IDocument createDocument(Object element) throws CoreException {
+               IDocument document = super.createDocument(element);
+               if (document != null) {
+                       IDocumentPartitioner partitioner =
+                               new DefaultPartitioner(
+                                       new PHPPartitionScanner(),
+                                       new String[] {
+                                               PHPPartitionScanner.HTML_TAG,
+                                               PHPPartitionScanner.HTML_COMMENT });
+                       partitioner.connect(document);
+                       document.setDocumentPartitioner(partitioner);
+               }
+               return document;
+       }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDoubleClickStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPDoubleClickStrategy.java
new file mode 100644 (file)
index 0000000..5f74b2d
--- /dev/null
@@ -0,0 +1,115 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.*;
+
+public class PHPDoubleClickStrategy implements ITextDoubleClickStrategy {
+       protected ITextViewer fText;
+
+       public PHPDoubleClickStrategy() {
+               super();
+       }
+       public void doubleClicked(ITextViewer part) {
+               int pos = part.getSelectedRange().x;
+
+               if (pos < 0)
+                       return;
+
+               fText = part;
+
+               if (!selectComment(pos)) {
+                       selectWord(pos);
+               }
+       }
+       protected boolean selectComment(int caretPos) {
+               IDocument doc = fText.getDocument();
+               int startPos, endPos;
+
+               try {
+                       int pos = caretPos;
+                       char c = ' ';
+
+                       while (pos >= 0) {
+                               c = doc.getChar(pos);
+                               if (c == '\\') {
+                                       pos -= 2;
+                                       continue;
+                               }
+                               if (c == Character.LINE_SEPARATOR || c == '\"')
+                                       break;
+                               --pos;
+                       }
+
+                       if (c != '\"')
+                               return false;
+
+                       startPos = pos;
+
+                       pos = caretPos;
+                       int length = doc.getLength();
+                       c = ' ';
+
+                       while (pos < length) {
+                               c = doc.getChar(pos);
+                               if (c == Character.LINE_SEPARATOR || c == '\"')
+                                       break;
+                               ++pos;
+                       }
+                       if (c != '\"')
+                               return false;
+
+                       endPos = pos;
+
+                       int offset = startPos + 1;
+                       int len = endPos - offset;
+                       fText.setSelectedRange(offset, len);
+                       return true;
+               } catch (BadLocationException x) {
+               }
+
+               return false;
+       }
+       protected boolean selectWord(int caretPos) {
+
+               IDocument doc = fText.getDocument();
+               int startPos, endPos;
+
+               try {
+
+                       int pos = caretPos;
+                       char c;
+
+                       while (pos >= 0) {
+                               c = doc.getChar(pos);
+                               if (!Character.isJavaIdentifierPart(c))
+                                       break;
+                               --pos;
+                       }
+
+                       startPos = pos;
+
+                       pos = caretPos;
+                       int length = doc.getLength();
+
+                       while (pos < length) {
+                               c = doc.getChar(pos);
+                               if (!Character.isJavaIdentifierPart(c))
+                                       break;
+                               ++pos;
+                       }
+
+                       endPos = pos;
+                       selectRange(startPos, endPos);
+                       return true;
+
+               } catch (BadLocationException x) {
+               }
+
+               return false;
+       }
+
+       private void selectRange(int startPos, int stopPos) {
+               int offset = startPos + 1;
+               int length = stopPos - offset;
+               fText.setSelectedRange(offset, length);
+       }
+}
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java
new file mode 100644 (file)
index 0000000..a90cead
--- /dev/null
@@ -0,0 +1,22 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.ui.editors.text.TextEditor;
+
+public class PHPEditor extends TextEditor {
+
+       private ColorManager colorManager;
+       /**
+        * Constructor for SampleEditor.
+        */
+       public PHPEditor() {
+               super();
+               colorManager = new ColorManager();
+               setSourceViewerConfiguration(new PHPConfiguration(colorManager));
+               setDocumentProvider(new PHPDocumentProvider());
+       }
+       public void dispose() {
+               colorManager.dispose();
+               super.dispose();
+       }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java
new file mode 100644 (file)
index 0000000..5c56abf
--- /dev/null
@@ -0,0 +1,33 @@
+package net.sourceforge.phpeclipse.editors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.rules.*;
+
+public class PHPPartitionScanner extends RuleBasedPartitionScanner {
+       public final static String HTML_COMMENT = "__html_comment";
+       public final static String HTML_TAG = "__tag";
+       public final static String PHP_COMMENT = "__php_comment";
+       public final static String PHP_STRING = "__php_string";
+
+       public PHPPartitionScanner() {
+
+               List rules = new ArrayList();
+
+               IToken php_tag = new Token(HTML_TAG);
+               IToken php_comment = new Token(PHP_COMMENT);
+               IToken html_comment = new Token(HTML_COMMENT);
+
+               rules.add(new MultiLineRule("<!--", "-->", html_comment));
+               rules.add(new MultiLineRule("/*", "*/", php_comment));
+               rules.add(new MultiLineRule("<script", "script>", php_tag));
+
+               //              rules.add(new TagRule(tag));
+
+               IPredicateRule[] result = new IPredicateRule[rules.size()];
+               rules.toArray(result);
+               setPredicateRules(result);
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPScanner.java
new file mode 100644 (file)
index 0000000..e144169
--- /dev/null
@@ -0,0 +1,699 @@
+package net.sourceforge.phpeclipse.editors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.rules.WhitespaceRule;
+import org.eclipse.jface.text.rules.WordRule;
+import org.eclipse.swt.SWT;
+
+public class PHPScanner extends RuleBasedScanner {
+
+       public PHPScanner(ColorManager manager) {
+               List rules = new ArrayList();
+               IToken procInstr =
+                       new Token(
+                               new TextAttribute(
+                                       manager.getColor(IPHPColorConstants.PROC_INSTR)));
+
+               ColorManager colors = new ColorManager();
+
+               IToken php_string =
+                       new Token(
+                               new TextAttribute(
+                                       colors.getColor(IPHPColorConstants.PHP_STRING),
+                                       null,
+                                       SWT.DEFAULT));
+               IToken php_default =
+                       new Token(
+                               new TextAttribute(
+                                       colors.getColor(IPHPColorConstants.PHP_DEFAULT),
+                                       null,
+                                       SWT.BOLD));
+               IToken php_tag =
+                       new Token(
+                               new TextAttribute(
+                                       colors.getColor(IPHPColorConstants.PHP_TAG),
+                                       null,
+                                       SWT.DEFAULT));
+               IToken php_comment =
+                       new Token(
+                               new TextAttribute(
+                                       colors.getColor(IPHPColorConstants.PHP_COMMENT),
+                                       null,
+                                       SWT.DEFAULT));
+               IToken php_function =
+                       new Token(
+                               new TextAttribute(
+                                       colors.getColor(IPHPColorConstants.PHP_FUNCTION),
+                                       null,
+                                       SWT.BOLD));
+
+               //Add rule for processing instructions
+               rules.add(new SingleLineRule("<?", "?>", php_tag));
+               rules.add(new SingleLineRule("<?php", "?>", php_tag));
+               rules.add(new SingleLineRule("<?PHP", "?>", php_tag));
+               rules.add(new SingleLineRule("\"", "\"", php_string));
+               rules.add(new SingleLineRule("'", "'", php_string));
+               rules.add(new SingleLineRule("//", "//", php_comment));
+
+               //
+               WordRule rule = new WordRule(new WordDetector());
+               rule.addWord("if", php_default);
+               rule.addWord("else", php_default);
+               rule.addWord("elseif", php_default);
+               rule.addWord("while", php_default);
+               rule.addWord("do", php_default);
+               rule.addWord("for", php_default);
+               rule.addWord("foreach", php_default);
+               rule.addWord("break", php_default);
+               rule.addWord("continue", php_default);
+               rule.addWord("switch", php_default);
+               rule.addWord("declare", php_default);
+               rule.addWord("ticks", php_default);
+               rule.addWord("require", php_default);
+               rule.addWord("include", php_default);
+               rule.addWord("true", php_default);
+               rule.addWord("false", php_default);
+
+               /*
+               rule.addWord( "abs", php_function);
+               rule.addWord( "acos", php_function);
+               rule.addWord( "addcslashes", php_function);
+               rule.addWord( "addslashes", php_function);
+               rule.addWord( "apache_lookup_uri", php_function);
+               rule.addWord( "apache_note", php_function);
+               rule.addWord( "array", php_function);
+               rule.addWord( "array_count_values", php_function);
+               rule.addWord( "array_diff", php_function);
+               rule.addWord( "array_filter", php_function);
+               rule.addWord( "array_flip", php_function);
+               rule.addWord( "array_intersect", php_function);
+               rule.addWord( "array_keys", php_function);
+               rule.addWord( "array_map", php_function);
+               rule.addWord( "array_merge", php_function);
+               rule.addWord( "array_merge_recursive", php_function);
+               rule.addWord( "array_multisort", php_function);
+               rule.addWord( "array_pad", php_function);
+               rule.addWord( "array_pop", php_function);
+               rule.addWord( "array_push", php_function);
+               rule.addWord( "array_rand", php_function);
+               rule.addWord( "array_reduce", php_function);
+               rule.addWord( "array_reverse", php_function);
+               rule.addWord( "array_search", php_function);
+               rule.addWord( "array_shift", php_function);
+               rule.addWord( "array_slice", php_function);
+               rule.addWord( "array_splice", php_function);
+               rule.addWord( "array_sum", php_function);
+               rule.addWord( "array_unique", php_function);
+               rule.addWord( "array_unshift", php_function);
+               rule.addWord( "array_values", php_function);
+               rule.addWord( "array_walk", php_function);
+               rule.addWord( "arsort", php_function);
+               rule.addWord( "ascii2ebcdic", php_function);
+               rule.addWord( "asin", php_function);
+               rule.addWord( "asort", php_function);
+               rule.addWord( "assert", php_function);
+               rule.addWord( "assert-options", php_function);
+               rule.addWord( "atan", php_function);
+               rule.addWord( "atan2", php_function);
+               rule.addWord( "base64_decode", php_function);
+               rule.addWord( "base64_encode", php_function);
+               rule.addWord( "base_convert", php_function);
+               rule.addWord( "basename", php_function);
+               rule.addWord( "bin2hex", php_function);
+               rule.addWord( "bindec", php_function);
+               rule.addWord( "call_user_method", php_function);
+               rule.addWord( "call_user_method_array", php_function);
+               rule.addWord( "ceil", php_function);
+               rule.addWord( "chdir", php_function);
+               rule.addWord( "checkdate", php_function);
+               rule.addWord( "checkdnsrr", php_function);
+               rule.addWord( "chgrp", php_function);
+               rule.addWord( "chmod", php_function);
+               rule.addWord( "chop", php_function);
+               rule.addWord( "chown", php_function);
+               rule.addWord( "chr", php_function);
+               rule.addWord( "chroot", php_function);
+               rule.addWord( "chunk_split", php_function);
+               rule.addWord( "class_exists", php_function);
+               rule.addWord( "clearstatcache", php_function);
+               rule.addWord( "closedir", php_function);
+               rule.addWord( "closelog", php_function);
+               rule.addWord( "compact", php_function);
+               rule.addWord( "connection_aborted", php_function);
+               rule.addWord( "connection_status", php_function);
+               rule.addWord( "connection_timeout", php_function);
+               rule.addWord( "constant", php_function);
+               rule.addWord( "convert_cyr_string", php_function);
+               rule.addWord( "copy", php_function);
+               rule.addWord( "cos", php_function);
+               rule.addWord( "count", php_function);
+               rule.addWord( "count_chars", php_function);
+               rule.addWord( "crc32", php_function);
+               rule.addWord( "crypt", php_function);
+               rule.addWord( "current", php_function);
+               rule.addWord( "date", php_function);
+               rule.addWord( "debugger_off", php_function);
+               rule.addWord( "debugger_on", php_function);
+               rule.addWord( "decbin", php_function);
+               rule.addWord( "dechex", php_function);
+               rule.addWord( "decoct", php_function);
+               rule.addWord( "define", php_function);
+               rule.addWord( "define_syslog_variables", php_function);
+               rule.addWord( "defined", php_function);
+               rule.addWord( "deg2rad", php_function);
+               rule.addWord( "delete", php_function);
+               rule.addWord( "die", php_function);
+               rule.addWord( "dir", php_function);
+               rule.addWord( "dirname", php_function);
+               rule.addWord( "disk_total_space", php_function);
+               rule.addWord( "diskfreespace", php_function);
+               rule.addWord( "dl", php_function);
+               rule.addWord( "doubleval", php_function);
+               rule.addWord( "each", php_function);
+               rule.addWord( "easter_date", php_function);
+               rule.addWord( "easter_days", php_function);
+               rule.addWord( "ebcdic2ascii", php_function);
+               rule.addWord( "echo", php_function);
+               rule.addWord( "empty", php_function);
+               rule.addWord( "end", php_function);
+               rule.addWord( "error_log", php_function);
+               rule.addWord( "error_reporting", php_function);
+               rule.addWord( "eval", php_function);
+               rule.addWord( "exit", php_function);
+               rule.addWord( "exp", php_function);
+               rule.addWord( "explode", php_function);
+               rule.addWord( "extension_loaded", php_function);
+               rule.addWord( "extract", php_function);
+               rule.addWord( "ezmlm_hash", php_function);
+               rule.addWord( "fclose", php_function);
+               rule.addWord( "feof", php_function);
+               rule.addWord( "fflush", php_function);
+               rule.addWord( "fgetc", php_function);
+               rule.addWord( "fgetcsv", php_function);
+               rule.addWord( "fgets", php_function);
+               rule.addWord( "fgetss", php_function);
+               rule.addWord( "file", php_function);
+               rule.addWord( "file_exists", php_function);
+               rule.addWord( "fileatime", php_function);
+               rule.addWord( "filectime", php_function);
+               rule.addWord( "filegroup", php_function);
+               rule.addWord( "fileinode", php_function);
+               rule.addWord( "filemtime", php_function);
+               rule.addWord( "fileowner", php_function);
+               rule.addWord( "fileperms", php_function);
+               rule.addWord( "filesize", php_function);
+               rule.addWord( "filetype", php_function);
+               rule.addWord( "flock", php_function);
+               rule.addWord( "floor", php_function);
+               rule.addWord( "flush", php_function);
+               rule.addWord( "fopen", php_function);
+               rule.addWord( "fpassthru", php_function);
+               rule.addWord( "fputs", php_function);
+               rule.addWord( "fread", php_function);
+               rule.addWord( "frenchtojd", php_function);
+               rule.addWord( "fscanf", php_function);
+               rule.addWord( "fseek", php_function);
+               rule.addWord( "fsockopen", php_function);
+               rule.addWord( "fstat", php_function);
+               rule.addWord( "ftell", php_function);
+               rule.addWord( "ftp_cdup", php_function);
+               rule.addWord( "ftp_chdir", php_function);
+               rule.addWord( "ftp_connect", php_function);
+               rule.addWord( "ftp_delete", php_function);
+               rule.addWord( "ftp_fget", php_function);
+               rule.addWord( "ftp_fput", php_function);
+               rule.addWord( "ftp_get", php_function);
+               rule.addWord( "ftp_login", php_function);
+               rule.addWord( "ftp_mdtm", php_function);
+               rule.addWord( "ftp_mkdir", php_function);
+               rule.addWord( "ftp_nlist", php_function);
+               rule.addWord( "ftp_pasv", php_function);
+               rule.addWord( "ftp_put", php_function);
+               rule.addWord( "ftp_pwd", php_function);
+               rule.addWord( "ftp_quit", php_function);
+               rule.addWord( "ftp_rawlist", php_function);
+               rule.addWord( "ftp_rename", php_function);
+               rule.addWord( "ftp_rmdir", php_function);
+               rule.addWord( "ftp_site", php_function);
+               rule.addWord( "ftp_size", php_function);
+               rule.addWord( "ftp_systype", php_function);
+               rule.addWord( "ftruncate", php_function);
+               rule.addWord( "fwrite", php_function);
+               rule.addWord( "get_browser", php_function);
+               rule.addWord( "get_cfg_var", php_function);
+               rule.addWord( "get_class", php_function);
+               rule.addWord( "get_class_methods", php_function);
+               rule.addWord( "get_class_vars", php_function);
+               rule.addWord( "get_current_user", php_function);
+               rule.addWord( "get_declared_classes", php_function);
+               rule.addWord( "get_defined_constants", php_function);
+               rule.addWord( "get_defined_vars", php_function);
+               rule.addWord( "get_extension_funcs", php_function);
+               rule.addWord( "get_html_translation_table", php_function);
+               rule.addWord( "get_included_files", php_function);
+               rule.addWord( "get_loaded_extensions", php_function);
+               rule.addWord( "get_magic_quotes_gpc", php_function);
+               rule.addWord( "get_magic_quotes_runtime", php_function);
+               rule.addWord( "get_meta_tags", php_function);
+               rule.addWord( "get_object_vars", php_function);
+               rule.addWord( "get_parent_class", php_function);
+               rule.addWord( "get_required_files", php_function);
+               rule.addWord( "get_resource_type", php_function);
+               rule.addWord( "getallheaders", php_function);
+               rule.addWord( "getcwd", php_function);
+               rule.addWord( "getdate", php_function);
+               rule.addWord( "getenv", php_function);
+               rule.addWord( "gethostbyaddr", php_function);
+               rule.addWord( "gethostbyname", php_function);
+               rule.addWord( "gethostbynamel", php_function);
+               rule.addWord( "getimagesize", php_function);
+               rule.addWord( "getlastmod", php_function);
+               rule.addWord( "getmxrr", php_function);
+               rule.addWord( "getmyinode", php_function);
+               rule.addWord( "getmypid", php_function);
+               rule.addWord( "getmyuid", php_function);
+               rule.addWord( "getprotobyname", php_function);
+               rule.addWord( "getprotobynumber", php_function);
+               rule.addWord( "getrandmax", php_function);
+               rule.addWord( "getrusage", php_function);
+               rule.addWord( "getservbyname", php_function);
+               rule.addWord( "getservbyport", php_function);
+               rule.addWord( "gettimeofday", php_function);
+               rule.addWord( "gettype", php_function);
+               rule.addWord( "gmdate", php_function);
+               rule.addWord( "gmmktime", php_function);
+               rule.addWord( "gmstrftime", php_function);
+               rule.addWord( "gregoriantojd", php_function);
+               rule.addWord( "header", php_function);
+               rule.addWord( "headers_sent", php_function);
+               rule.addWord( "hebrev", php_function);
+               rule.addWord( "hebrevc", php_function);
+               rule.addWord( "hexdec", php_function);
+               rule.addWord( "highlight_file", php_function);
+               rule.addWord( "highlight_string", php_function);
+               rule.addWord( "htmlentities", php_function);
+               rule.addWord( "htmlspecialchars", php_function);
+               rule.addWord( "ignore_user_abort", php_function);
+               rule.addWord( "imagealphablending", php_function);
+               rule.addWord( "imagearc", php_function);
+               rule.addWord( "imagechar", php_function);
+               rule.addWord( "imagecharup", php_function);
+               rule.addWord( "imagecolorallocate", php_function);
+               rule.addWord( "imagecolorat", php_function);
+               rule.addWord( "imagecolorclosest", php_function);
+               rule.addWord( "imagecolorclosestalpha", php_function);
+               rule.addWord( "imagecolordeallocate", php_function);
+               rule.addWord( "imagecolorexact", php_function);
+               rule.addWord( "imagecolorexactalpha", php_function);
+               rule.addWord( "imagecolorresolve", php_function);
+               rule.addWord( "imagecolorresolvealpha", php_function);
+               rule.addWord( "imagecolorset", php_function);
+               rule.addWord( "imagecolorsforindex", php_function);
+               rule.addWord( "imagecolorstotal", php_function);
+               rule.addWord( "imagecolortransparent", php_function);
+               rule.addWord( "imagecopy", php_function);
+               rule.addWord( "imagecopymerge", php_function);
+               rule.addWord( "imagecopymergegray", php_function);
+               rule.addWord( "imagecopyresampled", php_function);
+               rule.addWord( "imagecopyresized", php_function);
+               rule.addWord( "imagecreate", php_function);
+               rule.addWord( "imagecreatefromgif", php_function);
+               rule.addWord( "imagecreatefromjpeg", php_function);
+               rule.addWord( "imagecreatefrompng", php_function);
+               rule.addWord( "imagecreatefromstring", php_function);
+               rule.addWord( "imagecreatefromwbmp", php_function);
+               rule.addWord( "imagecreatetruecolor", php_function);
+               rule.addWord( "imagedashedline", php_function);
+               rule.addWord( "imagedestroy", php_function);
+               rule.addWord( "imageellipse", php_function);
+               rule.addWord( "imagefill", php_function);
+               rule.addWord( "imagefilledarc", php_function);
+               rule.addWord( "imagefilledellipse", php_function);
+               rule.addWord( "imagefilledpolygon", php_function);
+               rule.addWord( "imagefilledrectangle", php_function);
+               rule.addWord( "imagefilltoborder", php_function);
+               rule.addWord( "imagefontheight", php_function);
+               rule.addWord( "imagefontwidth", php_function);
+               rule.addWord( "imagegammacorrect", php_function);
+               rule.addWord( "imagegif", php_function);
+               rule.addWord( "imageinterlace", php_function);
+               rule.addWord( "imagejpeg", php_function);
+               rule.addWord( "imageline", php_function);
+               rule.addWord( "imageloadfont", php_function);
+               rule.addWord( "imagepng", php_function);
+               rule.addWord( "imagepolygon", php_function);
+               rule.addWord( "imagepsbbox", php_function);
+               rule.addWord( "imagepsencodefont", php_function);
+               rule.addWord( "imagepsextendfont", php_function);
+               rule.addWord( "imagepsfreefont", php_function);
+               rule.addWord( "imagepsloadfont", php_function);
+               rule.addWord( "imagepsslantfont", php_function);
+               rule.addWord( "imagepstext", php_function);
+               rule.addWord( "imagerectangle", php_function);
+               rule.addWord( "imagesetbrush", php_function);
+               rule.addWord( "imagesetpixel", php_function);
+               rule.addWord( "imagesetthickness", php_function);
+               rule.addWord( "imagesettile", php_function);
+               rule.addWord( "imagestring", php_function);
+               rule.addWord( "imagestringup", php_function);
+               rule.addWord( "imagesx", php_function);
+               rule.addWord( "imagesy", php_function);
+               rule.addWord( "imagetruecolortopalette", php_function);
+               rule.addWord( "imagettfbbox", php_function);
+               rule.addWord( "imagettftext", php_function);
+               rule.addWord( "imagetypes", php_function);
+               rule.addWord( "imagewbmp", php_function);
+               rule.addWord( "implode", php_function);
+               rule.addWord( "in_array", php_function);
+               rule.addWord( "Include()", php_function);
+               rule.addWord( "Include_once()", php_function);
+               rule.addWord( "ini_alter", php_function);
+               rule.addWord( "ini_get", php_function);
+               rule.addWord( "ini_restore", php_function);
+               rule.addWord( "ini_set", php_function);
+               rule.addWord( "intval", php_function);
+               rule.addWord( "ip2long", php_function);
+               rule.addWord( "iptcparse", php_function);
+               rule.addWord( "is_array", php_function);
+               rule.addWord( "is_bool", php_function);
+               rule.addWord( "is_dir", php_function);
+               rule.addWord( "is_double", php_function);
+               rule.addWord( "is_executable", php_function);
+               rule.addWord( "is_file", php_function);
+               rule.addWord( "is_float", php_function);
+               rule.addWord( "is_int", php_function);
+               rule.addWord( "is_integer", php_function);
+               rule.addWord( "is_link", php_function);
+               rule.addWord( "is_long", php_function);
+               rule.addWord( "is_null", php_function);
+               rule.addWord( "is_numeric", php_function);
+               rule.addWord( "is_object", php_function);
+               rule.addWord( "is_readable", php_function);
+               rule.addWord( "is_real", php_function);
+               rule.addWord( "is_resource", php_function);
+               rule.addWord( "is_scalar", php_function);
+               rule.addWord( "is_string", php_function);
+               rule.addWord( "is_subclass_of", php_function);
+               rule.addWord( "is_uploaded_file", php_function);
+               rule.addWord( "is_writable", php_function);
+               rule.addWord( "is_writeable", php_function);
+               rule.addWord( "isset", php_function);
+               rule.addWord( "jddayofweek", php_function);
+               rule.addWord( "jdmonthname", php_function);
+               rule.addWord( "jdtofrench", php_function);
+               rule.addWord( "jdtogregorian", php_function);
+               rule.addWord( "jdtojewish", php_function);
+               rule.addWord( "jdtojulian", php_function);
+               rule.addWord( "jdtounix", php_function);
+               rule.addWord( "jewishtojd", php_function);
+               rule.addWord( "join", php_function);
+               rule.addWord( "juliantojd", php_function);
+               rule.addWord( "key", php_function);
+               rule.addWord( "krsort", php_function);
+               rule.addWord( "ksort", php_function);
+               rule.addWord( "lcg_value", php_function);
+               rule.addWord( "leak", php_function);
+               rule.addWord( "levenshtein", php_function);
+               rule.addWord( "link", php_function);
+               rule.addWord( "linkinfo", php_function);
+               rule.addWord( "list", php_function);
+               rule.addWord( "localeconv", php_function);
+               rule.addWord( "localtime", php_function);
+               rule.addWord( "log", php_function);
+               rule.addWord( "log10", php_function);
+               rule.addWord( "long2ip", php_function);
+               rule.addWord( "lstat", php_function);
+               rule.addWord( "ltrim", php_function);
+               rule.addWord( "mail", php_function);
+               rule.addWord( "max", php_function);
+               rule.addWord( "mcrypt_cbc", php_function);
+               rule.addWord( "mcrypt_cfb", php_function);
+               rule.addWord( "mcrypt_create_iv", php_function);
+               rule.addWord( "mcrypt_decrypt", php_function);
+               rule.addWord( "mcrypt_ecb", php_function);
+               rule.addWord( "mcrypt_enc_get_algorithms_name", php_function);
+               rule.addWord( "mcrypt_enc_get_block_size", php_function);
+               rule.addWord( "mcrypt_enc_get_iv_size", php_function);
+               rule.addWord( "mcrypt_enc_get_key_size", php_function);
+               rule.addWord( "mcrypt_enc_get_modes_name", php_function);
+               rule.addWord( "mcrypt_enc_get_supported_key_sizes", php_function);
+               rule.addWord( "mcrypt_enc_is_block_algorithm", php_function);
+               rule.addWord( "mcrypt_enc_is_block_algorithm_mode", php_function);
+               rule.addWord( "mcrypt_enc_is_block_mode", php_function);
+               rule.addWord( "mcrypt_enc_self_test", php_function);
+               rule.addWord( "mcrypt_encrypt", php_function);
+               rule.addWord( "mcrypt_generic", php_function);
+               rule.addWord( "mcrypt_generic_end", php_function);
+               rule.addWord( "mcrypt_generic_init", php_function);
+               rule.addWord( "mcrypt_get_block_size", php_function);
+               rule.addWord( "mcrypt_get_cipher_name", php_function);
+               rule.addWord( "mcrypt_get_iv_size", php_function);
+               rule.addWord( "mcrypt_get_key_size", php_function);
+               rule.addWord( "mcrypt_list_algorithms", php_function);
+               rule.addWord( "mcrypt_list_modes", php_function);
+               rule.addWord( "mcrypt_module_get_algo_block_size", php_function);
+               rule.addWord( "mcrypt_module_get_algo_key_size", php_function);
+               rule.addWord( "mcrypt_module_get_algo_supported_key_sizes", php_function);
+               rule.addWord( "mcrypt_module_is_block_algorithm", php_function);
+               rule.addWord( "mcrypt_module_is_block_algorithm_mode", php_function);
+               rule.addWord( "mcrypt_module_is_block_mode", php_function);
+               rule.addWord( "mcrypt_module_open", php_function);
+               rule.addWord( "mcrypt_module_self_test", php_function);
+               rule.addWord( "mcrypt_ofb", php_function);
+               rule.addWord( "md5", php_function);
+               rule.addWord( "mdecrypt_generic", php_function);
+               rule.addWord( "metaphone", php_function);
+               rule.addWord( "method_exists", php_function);
+               rule.addWord( "microtime", php_function);
+               rule.addWord( "min", php_function);
+               rule.addWord( "mkdir", php_function);
+               rule.addWord( "mktime", php_function);
+               rule.addWord( "move_uploaded_file", php_function);
+               rule.addWord( "mt_getrandmax", php_function);
+               rule.addWord( "mt_rand", php_function);
+               rule.addWord( "mt_srand", php_function);
+               rule.addWord( "mysql_affected_rows", php_function);
+               rule.addWord( "mysql_change_user", php_function);
+               rule.addWord( "mysql_close", php_function);
+               rule.addWord( "mysql_connect", php_function);
+               rule.addWord( "mysql_create_db", php_function);
+               rule.addWord( "mysql_data_seek", php_function);
+               rule.addWord( "mysql_db_name", php_function);
+               rule.addWord( "mysql_db_query", php_function);
+               rule.addWord( "mysql_drop_db", php_function);
+               rule.addWord( "mysql_errno", php_function);
+               rule.addWord( "mysql_error", php_function);
+               rule.addWord( "mysql_escape_string", php_function);
+               rule.addWord( "mysql_fetch_array", php_function);
+               rule.addWord( "mysql_fetch_assoc", php_function);
+               rule.addWord( "mysql_fetch_field", php_function);
+               rule.addWord( "mysql_fetch_lengths", php_function);
+               rule.addWord( "mysql_fetch_object", php_function);
+               rule.addWord( "mysql_fetch_row", php_function);
+               rule.addWord( "mysql_field_flags", php_function);
+               rule.addWord( "mysql_field_len", php_function);
+               rule.addWord( "mysql_field_name", php_function);
+               rule.addWord( "mysql_field_seek", php_function);
+               rule.addWord( "mysql_field_table", php_function);
+               rule.addWord( "mysql_field_type", php_function);
+               rule.addWord( "mysql_free_result", php_function);
+               rule.addWord( "mysql_get_client_info", php_function);
+               rule.addWord( "mysql_get_host_info", php_function);
+               rule.addWord( "mysql_get_proto_info", php_function);
+               rule.addWord( "mysql_get_server_info", php_function);
+               rule.addWord( "mysql_insert_id", php_function);
+               rule.addWord( "mysql_list_dbs", php_function);
+               rule.addWord( "mysql_list_fields", php_function);
+               rule.addWord( "mysql_list_tables", php_function);
+               rule.addWord( "mysql_num_fields", php_function);
+               rule.addWord( "mysql_num_rows", php_function);
+               rule.addWord( "mysql_pconnect", php_function);
+               rule.addWord( "mysql_query", php_function);
+               rule.addWord( "mysql_result", php_function);
+               rule.addWord( "mysql_select_db", php_function);
+               rule.addWord( "mysql_tablename", php_function);
+               rule.addWord( "mysql_unbuffered_query", php_function);
+               rule.addWord( "natcasesort", php_function);
+               rule.addWord( "natsort", php_function);
+               rule.addWord( "next", php_function);
+               rule.addWord( "nl2br", php_function);
+               rule.addWord( "number_format", php_function);
+               rule.addWord( "ob_end_clean", php_function);
+               rule.addWord( "ob_end_flush", php_function);
+               rule.addWord( "ob_get_contents", php_function);
+               rule.addWord( "ob_get_length", php_function);
+               rule.addWord( "ob_gzhandler", php_function);
+               rule.addWord( "ob_implicit_flush", php_function);
+               rule.addWord( "ob_start", php_function);
+               rule.addWord( "octdec", php_function);
+               rule.addWord( "opendir", php_function);
+               rule.addWord( "openlog", php_function);
+               rule.addWord( "ord", php_function);
+               rule.addWord( "pack", php_function);
+               rule.addWord( "parse_str", php_function);
+               rule.addWord( "parse_url", php_function);
+               rule.addWord( "pathinfo", php_function);
+               rule.addWord( "pclose", php_function);
+               rule.addWord( "pfsockopen", php_function);
+               rule.addWord( "php_logo_guid", php_function);
+               rule.addWord( "php_sapi_name", php_function);
+               rule.addWord( "php_uname", php_function);
+               rule.addWord( "phpcredits", php_function);
+               rule.addWord( "phpinfo", php_function);
+               rule.addWord( "phpversion", php_function);
+               rule.addWord( "pi", php_function);
+               rule.addWord( "popen", php_function);
+               rule.addWord( "pos", php_function);
+               rule.addWord( "pow", php_function);
+               rule.addWord( "prev", php_function);
+               rule.addWord( "print", php_function);
+               rule.addWord( "print_r", php_function);
+               rule.addWord( "printf", php_function);
+               rule.addWord( "putenv", php_function);
+               rule.addWord( "quoted_printable_decode", php_function);
+               rule.addWord( "quotemeta", php_function);
+               rule.addWord( "rad2deg", php_function);
+               rule.addWord( "rand", php_function);
+               rule.addWord( "range", php_function);
+               rule.addWord( "rawurldecode", php_function);
+               rule.addWord( "rawurlencode", php_function);
+               rule.addWord( "read_exif_data", php_function);
+               rule.addWord( "readdir", php_function);
+               rule.addWord( "readfile", php_function);
+               rule.addWord( "readlink", php_function);
+               rule.addWord( "realpath", php_function);
+               rule.addWord( "rename", php_function);
+               rule.addWord( "Require()", php_function);
+               rule.addWord( "Require_once()", php_function);
+               rule.addWord( "reset", php_function);
+               rule.addWord( "restore_error_handler", php_function);
+               rule.addWord( "rewind", php_function);
+               rule.addWord( "rewinddir", php_function);
+               rule.addWord( "rmdir", php_function);
+               rule.addWord( "round", php_function);
+               rule.addWord( "rsort", php_function);
+               rule.addWord( "rtrim", php_function);
+               rule.addWord( "serialize", php_function);
+               rule.addWord( "session_cache_limiter", php_function);
+               rule.addWord( "session_decode", php_function);
+               rule.addWord( "session_destroy", php_function);
+               rule.addWord( "session_encode", php_function);
+               rule.addWord( "session_get_cookie_params", php_function);
+               rule.addWord( "session_id", php_function);
+               rule.addWord( "session_is_registered", php_function);
+               rule.addWord( "session_module_name", php_function);
+               rule.addWord( "session_name", php_function);
+               rule.addWord( "session_register", php_function);
+               rule.addWord( "session_save_path", php_function);
+               rule.addWord( "session_set_cookie_params", php_function);
+               rule.addWord( "session_set_save_handler", php_function);
+               rule.addWord( "session_start", php_function);
+               rule.addWord( "session_unregister", php_function);
+               rule.addWord( "session_unset", php_function);
+               rule.addWord( "session_write_close", php_function);
+               rule.addWord( "set_error_handler", php_function);
+               rule.addWord( "set_file_buffer", php_function);
+               rule.addWord( "set_magic_quotes_runtime", php_function);
+               rule.addWord( "set_time_limit", php_function);
+               rule.addWord( "setcookie", php_function);
+               rule.addWord( "setlocale", php_function);
+               rule.addWord( "settype", php_function);
+               rule.addWord( "show_source", php_function);
+               rule.addWord( "shuffle", php_function);
+               rule.addWord( "similar_text", php_function);
+               rule.addWord( "sin", php_function);
+               rule.addWord( "sizeof", php_function);
+               rule.addWord( "sleep", php_function);
+               rule.addWord( "socket_get_status", php_function);
+               rule.addWord( "socket_set_blocking", php_function);
+               rule.addWord( "socket_set_timeout", php_function);
+               rule.addWord( "sort", php_function);
+               rule.addWord( "soundex", php_function);
+               rule.addWord( "sprintf", php_function);
+               rule.addWord( "sqrt", php_function);
+               rule.addWord( "srand", php_function);
+               rule.addWord( "sscanf", php_function);
+               rule.addWord( "stat", php_function);
+               rule.addWord( "str_pad", php_function);
+               rule.addWord( "str_repeat", php_function);
+               rule.addWord( "str_replace", php_function);
+               rule.addWord( "strcasecmp", php_function);
+               rule.addWord( "strchr", php_function);
+               rule.addWord( "strcmp", php_function);
+               rule.addWord( "strcoll", php_function);
+               rule.addWord( "strcspn", php_function);
+               rule.addWord( "strftime", php_function);
+               rule.addWord( "strip_tags", php_function);
+               rule.addWord( "stripcslashes", php_function);
+               rule.addWord( "stripslashes", php_function);
+               rule.addWord( "stristr", php_function);
+               rule.addWord( "strlen", php_function);
+               rule.addWord( "strnatcasecmp", php_function);
+               rule.addWord( "strnatcmp", php_function);
+               rule.addWord( "strncasecmp", php_function);
+               rule.addWord( "strncmp", php_function);
+               rule.addWord( "strpos", php_function);
+               rule.addWord( "strrchr", php_function);
+               rule.addWord( "strrev", php_function);
+               rule.addWord( "strrpos", php_function);
+               rule.addWord( "strspn", php_function);
+               rule.addWord( "strstr", php_function);
+               rule.addWord( "strtok", php_function);
+               rule.addWord( "strtolower", php_function);
+               rule.addWord( "strtotime", php_function);
+               rule.addWord( "strtoupper", php_function);
+               rule.addWord( "strtr", php_function);
+               rule.addWord( "strval", php_function);
+               rule.addWord( "substr", php_function);
+               rule.addWord( "substr_count", php_function);
+               rule.addWord( "substr_replace", php_function);
+               rule.addWord( "symlink", php_function);
+               rule.addWord( "syslog", php_function);
+               rule.addWord( "tan", php_function);
+               rule.addWord( "tempnam", php_function);
+               rule.addWord( "time", php_function);
+               rule.addWord( "tmpfile", php_function);
+               rule.addWord( "touch", php_function);
+               rule.addWord( "trigger_error", php_function);
+               rule.addWord( "trim", php_function);
+               rule.addWord( "uasort", php_function);
+               rule.addWord( "ucfirst", php_function);
+               rule.addWord( "ucwords", php_function);
+               rule.addWord( "uksort", php_function);
+               rule.addWord( "umask", php_function);
+               rule.addWord( "uniqid", php_function);
+               rule.addWord( "unixtojd", php_function);
+               rule.addWord( "unlink", php_function);
+               rule.addWord( "unpack", php_function);
+               rule.addWord( "unserialize", php_function);
+               rule.addWord( "unset", php_function);
+               rule.addWord( "urldecode", php_function);
+               rule.addWord( "urlencode", php_function);
+               rule.addWord( "user_error", php_function);
+               rule.addWord( "usleep", php_function);
+               rule.addWord( "usort", php_function);
+               rule.addWord( "var_dump", php_function);
+               rule.addWord( "virtual", php_function);
+               rule.addWord( "wordwrap", php_function);
+               rule.addWord( "zend_logo_guid", php_function);
+               rule.addWord( "zend_version ", php_function);
+               */
+               rules.add(rule);
+
+               // Add generic whitespace rule.
+               rules.add(new WhitespaceRule(new WhitespaceDetector()));
+
+               IRule[] result = new IRule[rules.size()];
+               rules.toArray(result);
+
+               setRules(result);
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPTagScanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPTagScanner.java
new file mode 100644 (file)
index 0000000..e39eff8
--- /dev/null
@@ -0,0 +1,30 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.*;
+import java.util.*;
+import org.eclipse.jface.text.rules.*;
+
+public class PHPTagScanner extends RuleBasedScanner {
+
+       public PHPTagScanner(ColorManager manager) {
+               IToken string =
+                       new Token(
+                               new TextAttribute(manager.getColor(IPHPColorConstants.STRING)));
+
+               Vector rules = new Vector();
+
+               // Add rule for single and double quotes
+               rules.add(new SingleLineRule("\"", "\"", string, '\\'));
+               rules.add(new SingleLineRule("'", "'", string, '\\'));
+
+               // Add generic whitespace rule.
+               rules.add(new WhitespaceRule(new WhitespaceDetector()));
+
+               IRule[] result = new IRule[rules.size()];
+               rules.copyInto(result);
+               setRules(result);
+       }
+       public IToken nextToken() {
+               return super.nextToken();
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/TagRule.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/TagRule.java
new file mode 100644 (file)
index 0000000..7a53f1c
--- /dev/null
@@ -0,0 +1,31 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.rules.*;
+
+public class TagRule extends MultiLineRule {
+
+       public TagRule(IToken token) {
+               super("<", ">", token);
+       }
+       protected boolean sequenceDetected(
+               ICharacterScanner scanner,
+               char[] sequence,
+               boolean eofAllowed) {
+               int c = scanner.read();
+               if (sequence[0] == '<') {
+                       if (c == '?') {
+                               // processing instruction - abort
+                               scanner.unread();
+                               return false;
+                       }
+                       if (c == '!') {
+                               scanner.unread();
+                               // comment - abort
+                               return false;
+                       }
+               } else if (sequence[0] == '>') {
+                       scanner.unread();
+               }
+               return super.sequenceDetected(scanner, sequence, eofAllowed);
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WhitespaceDetector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WhitespaceDetector.java
new file mode 100644 (file)
index 0000000..2e54bf1
--- /dev/null
@@ -0,0 +1,11 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.rules.IWhitespaceDetector;
+
+public class WhitespaceDetector implements IWhitespaceDetector {
+
+       public boolean isWhitespace(char c) {
+               return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+       }
+
+}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WordDetector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WordDetector.java
new file mode 100644 (file)
index 0000000..d3b1d73
--- /dev/null
@@ -0,0 +1,31 @@
+package net.sourceforge.phpeclipse.editors;
+
+import org.eclipse.jface.text.rules.IWordDetector;
+
+/**
+ * XML word detector.
+ * 
+ * @author Igor Malinin
+ */
+
+/* detection des mots pour la gestion des couleurs
+ * Dans PHPScanner.java
+ * 
+ */
+
+public class WordDetector implements IWordDetector {
+       /**
+        * @see IWordDetector#isWordPart(char)
+        */
+       public boolean isWordPart(char ch) {
+               return Character.isJavaIdentifierPart(ch);
+       }
+
+       /**
+        * @see IWordDetector#isWordStart(char)
+        */
+       public boolean isWordStart(char ch) {
+               return Character.isJavaIdentifierStart(ch);
+       }
+
+}
diff --git a/net.sourceforge.phpeclipse/test/test.php b/net.sourceforge.phpeclipse/test/test.php
new file mode 100644 (file)
index 0000000..34f1171
--- /dev/null
@@ -0,0 +1 @@
+<? phpinfo() ?>
\ No newline at end of file
diff --git a/net.sourceforge.phpeclipse/tmp/sample.gif b/net.sourceforge.phpeclipse/tmp/sample.gif
new file mode 100644 (file)
index 0000000..34fb3c9
Binary files /dev/null and b/net.sourceforge.phpeclipse/tmp/sample.gif differ