improved syntax highligthing
authorkhartlage <khartlage>
Sat, 19 Oct 2002 16:16:57 +0000 (16:16 +0000)
committerkhartlage <khartlage>
Sat, 19 Oct 2002 16:16:57 +0000 (16:16 +0000)
19 files changed:
net.sourceforge.phpeclipse/icons/obj16/apache.gif [new file with mode: 0644]
net.sourceforge.phpeclipse/plugin.xml
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPEclipsePreferencePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/actions/PHPEclipseShowAction.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/IPHPColorConstants.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPPartitionScanner.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPScanner.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/TagRule.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WhitespaceDetector.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/WordDetector.java [deleted file]
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPContentOutlinePage.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCodeScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPPartitionScanner.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/util/PHPColorProvider.java

diff --git a/net.sourceforge.phpeclipse/icons/obj16/apache.gif b/net.sourceforge.phpeclipse/icons/obj16/apache.gif
new file mode 100644 (file)
index 0000000..7a2f52f
Binary files /dev/null and b/net.sourceforge.phpeclipse/icons/obj16/apache.gif differ
index dc2699f..1c3e6fa 100644 (file)
       <import plugin="org.eclipse.jdt.ui"/>
    </requires>
 
-
+   <extension
+         point="org.eclipse.ui.actionSets">
+      <actionSet
+            id="net.sourceforge.phpeclipse.PHPActionSet"
+            label="PHP/Apache"
+            visible="true"
+            description="Starting MySQL and Apache.">
+         <menu
+              id="net.sourceforge.phpeclipse.PHPMenu"
+              label="PHP/Apache">
+              <separator name="phpeclipse"/> 
+         </menu>
+         <action
+            id="net.sourceforge.phpeclipse.actions.PHPRestartApacheAction"
+            menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
+            toolbarPath="Normal"
+            label="Restart Apache"
+            tooltip="Restart Apache"
+            icon="icons/obj16/apache.gif"
+            start="true"
+            class="net.sourceforge.phpeclipse.actions.PHPRestartApacheAction">
+         </action>
+         <action
+            id="net.sourceforge.phpeclipse.actions.PHPStopApacheAction"
+            menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
+            toolbarPath="Normal"
+            label="Stop Apache"
+            tooltip="Stop Apache"
+            icon="icons/obj16/apache.gif"
+            start="true"
+            class="net.sourceforge.phpeclipse.actions.PHPStopApacheAction">
+         </action>
+         <action
+            id="net.sourceforge.phpeclipse.actions.PHPStartApacheAction"
+            menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
+            toolbarPath="Normal"
+            label="Start Apache"
+            tooltip="Start Apache"
+            icon="icons/obj16/apache.gif"
+            start="true"
+            class="net.sourceforge.phpeclipse.actions.PHPStartApacheAction">
+         </action>         
+         <action
+            id="net.sourceforge.phpeclipse.actions.PHPStartMySQLAction"
+            menubarPath="net.sourceforge.phpeclipse.PHPMenu/phpeclipse"
+            toolbarPath="Normal"
+            label="Start MySQL"
+            tooltip="Start MySQL"
+            icon="icons/obj16/apache.gif"
+            start="true"
+            class="net.sourceforge.phpeclipse.actions.PHPStartMySQLAction">
+         </action>
+      </actionSet>
+   </extension>
    <extension
          point="org.eclipse.ui.editors">
       <editor
             name="%phpEditorName"
             icon="icons/obj16/java.gif"
-            extensions="php"
+            extensions="php,php3,php4"
             contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
             class="net.sourceforge.phpeclipse.phpeditor.PHPEditor"
             id="net.sourceforge.phpeclipse.PHPEditor">
index 05b2d4e..3d6fe05 100644 (file)
@@ -56,34 +56,34 @@ public class PHPEclipsePreferencePage extends FieldEditorPreferencePage implemen
 
                StringFieldEditor startMySQL =
                        new StringFieldEditor(PHPeclipsePlugin.MYSQL_PREF, "&MySQL command:", 60, getFieldEditorParent());
-               Button button = new Button(shell, SWT.PUSH);
-               button.setText("Start MySQL");
-               button.addSelectionListener(new SelectionAdapter() {
-                       public void widgetSelected(SelectionEvent e) {
-                               try {
-                                       Runtime runtime = Runtime.getRuntime();
-                                       runtime.exec(store.getString(PHPeclipsePlugin.MYSQL_PREF));
-                               } catch (IOException e1) {
-                               }
-                       }
-               });
+//             Button button = new Button(shell, SWT.PUSH);
+//             button.setText("Start MySQL");
+//             button.addSelectionListener(new SelectionAdapter() {
+//                     public void widgetSelected(SelectionEvent e) {
+//                             try {
+//                                     Runtime runtime = Runtime.getRuntime();
+//                                     runtime.exec(store.getString(PHPeclipsePlugin.MYSQL_PREF));
+//                             } catch (IOException e1) {
+//                             }
+//                     }
+//             });
 
                StringFieldEditor startApache =
                        new StringFieldEditor(PHPeclipsePlugin.APACHE_START_PREF, "Start &Apache command:", 60, getFieldEditorParent());
-               Button startButton = new Button(shell, SWT.PUSH);
-               startButton.setText("Start Apache");
-               startButton.addSelectionListener(new SelectionAdapter() {
-                       public void widgetSelected(SelectionEvent e) {
-                               String[] arguments = { store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF)};
-                               MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
-
-                               try {
-                                       Runtime runtime = Runtime.getRuntime();
-                                       runtime.exec(form.format(arguments));
-                               } catch (IOException e2) {
-                               }
-                       }
-               });
+//             Button startButton = new Button(shell, SWT.PUSH);
+//             startButton.setText("Start Apache");
+//             startButton.addSelectionListener(new SelectionAdapter() {
+//                     public void widgetSelected(SelectionEvent e) {
+//                             String[] arguments = { store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF)};
+//                             MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
+//
+//                             try {
+//                                     Runtime runtime = Runtime.getRuntime();
+//                                     runtime.exec(form.format(arguments));
+//                             } catch (IOException e2) {
+//                             }
+//                     }
+//             });
 
                StringFieldEditor stopApache =
                        new StringFieldEditor(PHPeclipsePlugin.APACHE_STOP_PREF, "&Stop Apache command:", 60, getFieldEditorParent());
index 6dea6cf..911cceb 100644 (file)
@@ -93,7 +93,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin {
                                } else if (version == 3.0) {
                                        jvm = MRJ_3_0;
                                } else if (version >= 3.1) {
-                                       // Assume that all 3.1 and later versions of MRJ work the same.
                                        jvm = MRJ_3_1;
                                }
 
@@ -161,13 +160,13 @@ public class PHPeclipsePlugin extends AbstractUIPlugin {
                if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) {
       store.setDefault(DOCUMENTROOT_PREF, "c:\\eclipse\\workspace");
                        store.setDefault(MYSQL_PREF, "c:\\apache\\mysql\\bin\\mysqld.exe --standalone");
-                       store.setDefault(APACHE_START_PREF, "c:\\apache\\apache.exe \"DocumentRoot \"{0}\"\"");
+                       store.setDefault(APACHE_START_PREF, "c:\\apache\\apache.exe -c \"DocumentRoot \"{0}\"\"");
                        store.setDefault(APACHE_STOP_PREF, "c:\\apache\\apache.exe -k shutdown");
                        store.setDefault(APACHE_RESTART_PREF, "c:\\apache\\apache.exe -k restart");
                } else {
       store.setDefault(DOCUMENTROOT_PREF, "/eclipse/workspace");
                        store.setDefault(MYSQL_PREF, "/apache/mysql/bin/mysqld --standalone");
-                       store.setDefault(APACHE_START_PREF, "/apache/apache \"DocumentRoot \"{0}\"\"");
+                       store.setDefault(APACHE_START_PREF, "/apache/apache -c \"DocumentRoot \"{0}\"\"");
                        store.setDefault(APACHE_STOP_PREF, "/apache/apache.exe -k shutdown");
                        store.setDefault(APACHE_RESTART_PREF, "/apache/apache -k restart");
                }
index a6b8466..7cd25dc 100644 (file)
@@ -48,16 +48,16 @@ public class PHPEclipseShowAction implements IObjectActionDelegate {
        public void setActivePart(IAction action, IWorkbenchPart targetPart) {
                workbenchPart = targetPart;
        }
-  
-//  public static void open(final URL url, final Shell shell, final String dialogTitle) {
-//    IHelp help= WorkbenchHelp.getHelpSupport();
-//    if (help != null) {
-//      WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
-//    } else {
-//      showMessage(shell, dialogTitle, ActionMessages.getString("OpenBrowserUtil.help_not_available"), false); //$NON-NLS-1$
-//    }
-//  }
-  
+
+       //  public static void open(final URL url, final Shell shell, final String dialogTitle) {
+       //    IHelp help= WorkbenchHelp.getHelpSupport();
+       //    if (help != null) {
+       //      WorkbenchHelp.getHelpSupport().displayHelpResource(url.toExternalForm());
+       //    } else {
+       //      showMessage(shell, dialogTitle, ActionMessages.getString("OpenBrowserUtil.help_not_available"), false); //$NON-NLS-1$
+       //    }
+       //  }
+
        public void run(IAction action) {
                ISelectionProvider selectionProvider = null;
                selectionProvider = workbenchPart.getSite().getSelectionProvider();
@@ -91,8 +91,21 @@ public class PHPEclipseShowAction implements IObjectActionDelegate {
                                                //            }
 
                                                String fileName = file.getLocation().toString();
+            String lowerCaseFileName = fileName.toLowerCase();
                                                //       fileName = "http://localhost"+fileName.replaceAll("c:", "");
-                                               fileName = store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + fileName.replaceAll("C:", "");
+                                               String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
+            documentRoot = documentRoot.replace('\\', '/');
+            documentRoot = documentRoot.toLowerCase();
+            MessageDialog.openInformation(shell, "lowerCaseFileName", "lowerCaseFileName: " + lowerCaseFileName);
+              
+            if ( lowerCaseFileName.startsWith(documentRoot) ) {
+              fileName = fileName.substring(documentRoot.length());
+            } else {
+              MessageDialog.openInformation(shell, "Wrong DocumentRoot", "Adjust DocumentRoot: " + documentRoot);
+              return;
+            }
+            
+                                               fileName = store.getString(PHPeclipsePlugin.LOCALHOST_PREF) + fileName.replaceAll(documentRoot, "");
 
                                                try {
                                                        if (store.getBoolean(PHPeclipsePlugin.USE_EXTERNAL_BROWSER_PREF)) {
@@ -125,8 +138,8 @@ public class PHPEclipseShowAction implements IObjectActionDelegate {
                        }
                }
        } /**
-                                        * @see IActionDelegate#selectionChanged(IAction, ISelection)
-                                        */
+                                                * @see IActionDelegate#selectionChanged(IAction, ISelection)
+                                                */
        public void selectionChanged(IAction action, ISelection selection) {
        }
 
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/ColorManager.java
deleted file mode 100644 (file)
index 7bcdd21..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644 (file)
index 4ec6924..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-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(  0,   0, 255); 
-       RGB PHP_STRING =                new RGB( 51, 167,  30);
-       RGB PHP_FONCTION =              new RGB(255, 100,  10);
-       RGB PHP_OPERATOR =              new RGB(255, 200,  00);
-       RGB PHP_VARIABLE =              new RGB(227,  22,  22);
-}
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPConfiguration.java
deleted file mode 100644 (file)
index 249318a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-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 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 };
-       }
-
-       protected PHPScanner getXMLScanner()
-       {
-               if (scanner == null)
-               {
-                       scanner = new PHPScanner(colorManager);
-                       scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IPHPColorConstants.DEFAULT))));
-               }
-               return scanner;
-       
-       
-       }
-       
-       
-
-
-       public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
-       {
-               PresentationReconciler reconciler = new PresentationReconciler();
-
-               DefaultDamagerRepairer dr =
-               new DefaultDamagerRepairer(getXMLScanner());
-               reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
-               reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-
-               return reconciler;
-       }
-       
-       
-       
-
-}
-
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/PHPEditor.java
deleted file mode 100644 (file)
index 0b5d4d7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-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));
-
-       }
-       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
deleted file mode 100644 (file)
index 61e7a31..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-
-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
deleted file mode 100644 (file)
index b46005d..0000000
+++ /dev/null
@@ -1,672 +0,0 @@
-package net.sourceforge.phpeclipse.editors;
-
-
-import java.awt.font.*;
-import java.util.*;
-import org.eclipse.jface.text.rules.*;
-import sun.awt.font.NewArabicShaping;
-import org.eclipse.jface.text.rules.*;
-import org.eclipse.jface.text.TextAttribute;
-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)));
-               
-               IToken php_string   = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_STRING), null, SWT.DEFAULT) );
-               IToken php_default  = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_DEFAULT), null, SWT.BOLD) );
-               IToken php_tag      = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_TAG), null, SWT.DEFAULT) );
-       IToken php_comment  = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_COMMENT), null, SWT.DEFAULT) );
-       IToken php_fonction = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_FONCTION), null, SWT.BOLD) );
-               IToken php_operator = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_OPERATOR))); 
-               IToken php_variable     = new Token(new TextAttribute(manager.getColor(IPHPColorConstants.PHP_VARIABLE)));
-
-               //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));
-
-//             rules.add(new SingleLineRule("[", "]", php_operator));
-//             rules.add(new SingleLineRule("(", ")", php_operator));
-               
-               //
-               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_fonction);
-               rule.addWord( "acos", php_fonction);
-               rule.addWord( "addcslashes", php_fonction);
-               rule.addWord( "addslashes", php_fonction);
-               rule.addWord( "apache_lookup_uri", php_fonction);
-               rule.addWord( "apache_note", php_fonction);
-               rule.addWord( "array", php_fonction);
-               rule.addWord( "array_count_values", php_fonction);
-               rule.addWord( "array_diff", php_fonction);
-               rule.addWord( "array_filter", php_fonction);
-               rule.addWord( "array_flip", php_fonction);
-               rule.addWord( "array_intersect", php_fonction);
-               rule.addWord( "array_keys", php_fonction);
-               rule.addWord( "array_map", php_fonction);
-               rule.addWord( "array_merge", php_fonction);
-               rule.addWord( "array_merge_recursive", php_fonction);
-               rule.addWord( "array_multisort", php_fonction);
-               rule.addWord( "array_pad", php_fonction);
-               rule.addWord( "array_pop", php_fonction);
-               rule.addWord( "array_push", php_fonction);
-               rule.addWord( "array_rand", php_fonction);
-               rule.addWord( "array_reduce", php_fonction);
-               rule.addWord( "array_reverse", php_fonction);
-               rule.addWord( "array_search", php_fonction);
-               rule.addWord( "array_shift", php_fonction);
-               rule.addWord( "array_slice", php_fonction);
-               rule.addWord( "array_splice", php_fonction);
-               rule.addWord( "array_sum", php_fonction);
-               rule.addWord( "array_unique", php_fonction);
-               rule.addWord( "array_unshift", php_fonction);
-               rule.addWord( "array_values", php_fonction);
-               rule.addWord( "array_walk", php_fonction);
-               rule.addWord( "arsort", php_fonction);
-               rule.addWord( "ascii2ebcdic", php_fonction);
-               rule.addWord( "asin", php_fonction);
-               rule.addWord( "asort", php_fonction);
-               rule.addWord( "assert", php_fonction);
-               rule.addWord( "assert-options", php_fonction);
-               rule.addWord( "atan", php_fonction);
-               rule.addWord( "atan2", php_fonction);
-               rule.addWord( "base64_decode", php_fonction);
-               rule.addWord( "base64_encode", php_fonction);
-               rule.addWord( "base_convert", php_fonction);
-               rule.addWord( "basename", php_fonction);
-               rule.addWord( "bin2hex", php_fonction);
-               rule.addWord( "bindec", php_fonction);
-               rule.addWord( "call_user_method", php_fonction);
-               rule.addWord( "call_user_method_array", php_fonction);
-               rule.addWord( "ceil", php_fonction);
-               rule.addWord( "chdir", php_fonction);
-               rule.addWord( "checkdate", php_fonction);
-               rule.addWord( "checkdnsrr", php_fonction);
-               rule.addWord( "chgrp", php_fonction);
-               rule.addWord( "chmod", php_fonction);
-               rule.addWord( "chop", php_fonction);
-               rule.addWord( "chown", php_fonction);
-               rule.addWord( "chr", php_fonction);
-               rule.addWord( "chroot", php_fonction);
-               rule.addWord( "chunk_split", php_fonction);
-               rule.addWord( "class_exists", php_fonction);
-               rule.addWord( "clearstatcache", php_fonction);
-               rule.addWord( "closedir", php_fonction);
-               rule.addWord( "closelog", php_fonction);
-               rule.addWord( "compact", php_fonction);
-               rule.addWord( "connection_aborted", php_fonction);
-               rule.addWord( "connection_status", php_fonction);
-               rule.addWord( "connection_timeout", php_fonction);
-               rule.addWord( "constant", php_fonction);
-               rule.addWord( "convert_cyr_string", php_fonction);
-               rule.addWord( "copy", php_fonction);
-               rule.addWord( "cos", php_fonction);
-               rule.addWord( "count", php_fonction);
-               rule.addWord( "count_chars", php_fonction);
-               rule.addWord( "crc32", php_fonction);
-               rule.addWord( "crypt", php_fonction);
-               rule.addWord( "current", php_fonction);
-               rule.addWord( "date", php_fonction);
-               rule.addWord( "debugger_off", php_fonction);
-               rule.addWord( "debugger_on", php_fonction);
-               rule.addWord( "decbin", php_fonction);
-               rule.addWord( "dechex", php_fonction);
-               rule.addWord( "decoct", php_fonction);
-               rule.addWord( "define", php_fonction);
-               rule.addWord( "define_syslog_variables", php_fonction);
-               rule.addWord( "defined", php_fonction);
-               rule.addWord( "deg2rad", php_fonction);
-               rule.addWord( "delete", php_fonction);
-               rule.addWord( "die", php_fonction);
-               rule.addWord( "dir", php_fonction);
-               rule.addWord( "dirname", php_fonction);
-               rule.addWord( "disk_total_space", php_fonction);
-               rule.addWord( "diskfreespace", php_fonction);
-               rule.addWord( "dl", php_fonction);
-               rule.addWord( "doubleval", php_fonction);
-               rule.addWord( "each", php_fonction);
-               rule.addWord( "easter_date", php_fonction);
-               rule.addWord( "easter_days", php_fonction);
-               rule.addWord( "ebcdic2ascii", php_fonction);
-               rule.addWord( "echo", php_fonction);
-               rule.addWord( "empty", php_fonction);
-               rule.addWord( "end", php_fonction);
-               rule.addWord( "error_log", php_fonction);
-               rule.addWord( "error_reporting", php_fonction);
-               rule.addWord( "eval", php_fonction);
-               rule.addWord( "exit", php_fonction);
-               rule.addWord( "exp", php_fonction);
-               rule.addWord( "explode", php_fonction);
-               rule.addWord( "extension_loaded", php_fonction);
-               rule.addWord( "extract", php_fonction);
-               rule.addWord( "ezmlm_hash", php_fonction);
-               rule.addWord( "fclose", php_fonction);
-               rule.addWord( "feof", php_fonction);
-               rule.addWord( "fflush", php_fonction);
-               rule.addWord( "fgetc", php_fonction);
-               rule.addWord( "fgetcsv", php_fonction);
-               rule.addWord( "fgets", php_fonction);
-               rule.addWord( "fgetss", php_fonction);
-               rule.addWord( "file", php_fonction);
-               rule.addWord( "file_exists", php_fonction);
-               rule.addWord( "fileatime", php_fonction);
-               rule.addWord( "filectime", php_fonction);
-               rule.addWord( "filegroup", php_fonction);
-               rule.addWord( "fileinode", php_fonction);
-               rule.addWord( "filemtime", php_fonction);
-               rule.addWord( "fileowner", php_fonction);
-               rule.addWord( "fileperms", php_fonction);
-               rule.addWord( "filesize", php_fonction);
-               rule.addWord( "filetype", php_fonction);
-               rule.addWord( "flock", php_fonction);
-               rule.addWord( "floor", php_fonction);
-               rule.addWord( "flush", php_fonction);
-               rule.addWord( "fopen", php_fonction);
-               rule.addWord( "fpassthru", php_fonction);
-               rule.addWord( "fputs", php_fonction);
-               rule.addWord( "fread", php_fonction);
-               rule.addWord( "frenchtojd", php_fonction);
-               rule.addWord( "fscanf", php_fonction);
-               rule.addWord( "fseek", php_fonction);
-               rule.addWord( "fsockopen", php_fonction);
-               rule.addWord( "fstat", php_fonction);
-               rule.addWord( "ftell", php_fonction);
-               rule.addWord( "ftp_cdup", php_fonction);
-               rule.addWord( "ftp_chdir", php_fonction);
-               rule.addWord( "ftp_connect", php_fonction);
-               rule.addWord( "ftp_delete", php_fonction);
-               rule.addWord( "ftp_fget", php_fonction);
-               rule.addWord( "ftp_fput", php_fonction);
-               rule.addWord( "ftp_get", php_fonction);
-               rule.addWord( "ftp_login", php_fonction);
-               rule.addWord( "ftp_mdtm", php_fonction);
-               rule.addWord( "ftp_mkdir", php_fonction);
-               rule.addWord( "ftp_nlist", php_fonction);
-               rule.addWord( "ftp_pasv", php_fonction);
-               rule.addWord( "ftp_put", php_fonction);
-               rule.addWord( "ftp_pwd", php_fonction);
-               rule.addWord( "ftp_quit", php_fonction);
-               rule.addWord( "ftp_rawlist", php_fonction);
-               rule.addWord( "ftp_rename", php_fonction);
-               rule.addWord( "ftp_rmdir", php_fonction);
-               rule.addWord( "ftp_site", php_fonction);
-               rule.addWord( "ftp_size", php_fonction);
-               rule.addWord( "ftp_systype", php_fonction);
-               rule.addWord( "ftruncate", php_fonction);
-               rule.addWord( "fwrite", php_fonction);
-               rule.addWord( "get_browser", php_fonction);
-               rule.addWord( "get_cfg_var", php_fonction);
-               rule.addWord( "get_class", php_fonction);
-               rule.addWord( "get_class_methods", php_fonction);
-               rule.addWord( "get_class_vars", php_fonction);
-               rule.addWord( "get_current_user", php_fonction);
-               rule.addWord( "get_declared_classes", php_fonction);
-               rule.addWord( "get_defined_constants", php_fonction);
-               rule.addWord( "get_defined_vars", php_fonction);
-               rule.addWord( "get_extension_funcs", php_fonction);
-               rule.addWord( "get_html_translation_table", php_fonction);
-               rule.addWord( "get_included_files", php_fonction);
-               rule.addWord( "get_loaded_extensions", php_fonction);
-               rule.addWord( "get_magic_quotes_gpc", php_fonction);
-               rule.addWord( "get_magic_quotes_runtime", php_fonction);
-               rule.addWord( "get_meta_tags", php_fonction);
-               rule.addWord( "get_object_vars", php_fonction);
-               rule.addWord( "get_parent_class", php_fonction);
-               rule.addWord( "get_required_files", php_fonction);
-               rule.addWord( "get_resource_type", php_fonction);
-               rule.addWord( "getallheaders", php_fonction);
-               rule.addWord( "getcwd", php_fonction);
-               rule.addWord( "getdate", php_fonction);
-               rule.addWord( "getenv", php_fonction);
-               rule.addWord( "gethostbyaddr", php_fonction);
-               rule.addWord( "gethostbyname", php_fonction);
-               rule.addWord( "gethostbynamel", php_fonction);
-               rule.addWord( "getimagesize", php_fonction);
-               rule.addWord( "getlastmod", php_fonction);
-               rule.addWord( "getmxrr", php_fonction);
-               rule.addWord( "getmyinode", php_fonction);
-               rule.addWord( "getmypid", php_fonction);
-               rule.addWord( "getmyuid", php_fonction);
-               rule.addWord( "getprotobyname", php_fonction);
-               rule.addWord( "getprotobynumber", php_fonction);
-               rule.addWord( "getrandmax", php_fonction);
-               rule.addWord( "getrusage", php_fonction);
-               rule.addWord( "getservbyname", php_fonction);
-               rule.addWord( "getservbyport", php_fonction);
-               rule.addWord( "gettimeofday", php_fonction);
-               rule.addWord( "gettype", php_fonction);
-               rule.addWord( "gmdate", php_fonction);
-               rule.addWord( "gmmktime", php_fonction);
-               rule.addWord( "gmstrftime", php_fonction);
-               rule.addWord( "gregoriantojd", php_fonction);
-               rule.addWord( "header", php_fonction);
-               rule.addWord( "headers_sent", php_fonction);
-               rule.addWord( "hebrev", php_fonction);
-               rule.addWord( "hebrevc", php_fonction);
-               rule.addWord( "hexdec", php_fonction);
-               rule.addWord( "highlight_file", php_fonction);
-               rule.addWord( "highlight_string", php_fonction);
-               rule.addWord( "htmlentities", php_fonction);
-               rule.addWord( "htmlspecialchars", php_fonction);
-               rule.addWord( "ignore_user_abort", php_fonction);
-               rule.addWord( "imagealphablending", php_fonction);
-               rule.addWord( "imagearc", php_fonction);
-               rule.addWord( "imagechar", php_fonction);
-               rule.addWord( "imagecharup", php_fonction);
-               rule.addWord( "imagecolorallocate", php_fonction);
-               rule.addWord( "imagecolorat", php_fonction);
-               rule.addWord( "imagecolorclosest", php_fonction);
-               rule.addWord( "imagecolorclosestalpha", php_fonction);
-               rule.addWord( "imagecolordeallocate", php_fonction);
-               rule.addWord( "imagecolorexact", php_fonction);
-               rule.addWord( "imagecolorexactalpha", php_fonction);
-               rule.addWord( "imagecolorresolve", php_fonction);
-               rule.addWord( "imagecolorresolvealpha", php_fonction);
-               rule.addWord( "imagecolorset", php_fonction);
-               rule.addWord( "imagecolorsforindex", php_fonction);
-               rule.addWord( "imagecolorstotal", php_fonction);
-               rule.addWord( "imagecolortransparent", php_fonction);
-               rule.addWord( "imagecopy", php_fonction);
-               rule.addWord( "imagecopymerge", php_fonction);
-               rule.addWord( "imagecopymergegray", php_fonction);
-               rule.addWord( "imagecopyresampled", php_fonction);
-               rule.addWord( "imagecopyresized", php_fonction);
-               rule.addWord( "imagecreate", php_fonction);
-               rule.addWord( "imagecreatefromgif", php_fonction);
-               rule.addWord( "imagecreatefromjpeg", php_fonction);
-               rule.addWord( "imagecreatefrompng", php_fonction);
-               rule.addWord( "imagecreatefromstring", php_fonction);
-               rule.addWord( "imagecreatefromwbmp", php_fonction);
-               rule.addWord( "imagecreatetruecolor", php_fonction);
-               rule.addWord( "imagedashedline", php_fonction);
-               rule.addWord( "imagedestroy", php_fonction);
-               rule.addWord( "imageellipse", php_fonction);
-               rule.addWord( "imagefill", php_fonction);
-               rule.addWord( "imagefilledarc", php_fonction);
-               rule.addWord( "imagefilledellipse", php_fonction);
-               rule.addWord( "imagefilledpolygon", php_fonction);
-               rule.addWord( "imagefilledrectangle", php_fonction);
-               rule.addWord( "imagefilltoborder", php_fonction);
-               rule.addWord( "imagefontheight", php_fonction);
-               rule.addWord( "imagefontwidth", php_fonction);
-               rule.addWord( "imagegammacorrect", php_fonction);
-               rule.addWord( "imagegif", php_fonction);
-               rule.addWord( "imageinterlace", php_fonction);
-               rule.addWord( "imagejpeg", php_fonction);
-               rule.addWord( "imageline", php_fonction);
-               rule.addWord( "imageloadfont", php_fonction);
-               rule.addWord( "imagepng", php_fonction);
-               rule.addWord( "imagepolygon", php_fonction);
-               rule.addWord( "imagepsbbox", php_fonction);
-               rule.addWord( "imagepsencodefont", php_fonction);
-               rule.addWord( "imagepsextendfont", php_fonction);
-               rule.addWord( "imagepsfreefont", php_fonction);
-               rule.addWord( "imagepsloadfont", php_fonction);
-               rule.addWord( "imagepsslantfont", php_fonction);
-               rule.addWord( "imagepstext", php_fonction);
-               rule.addWord( "imagerectangle", php_fonction);
-               rule.addWord( "imagesetbrush", php_fonction);
-               rule.addWord( "imagesetpixel", php_fonction);
-               rule.addWord( "imagesetthickness", php_fonction);
-               rule.addWord( "imagesettile", php_fonction);
-               rule.addWord( "imagestring", php_fonction);
-               rule.addWord( "imagestringup", php_fonction);
-               rule.addWord( "imagesx", php_fonction);
-               rule.addWord( "imagesy", php_fonction);
-               rule.addWord( "imagetruecolortopalette", php_fonction);
-               rule.addWord( "imagettfbbox", php_fonction);
-               rule.addWord( "imagettftext", php_fonction);
-               rule.addWord( "imagetypes", php_fonction);
-               rule.addWord( "imagewbmp", php_fonction);
-               rule.addWord( "implode", php_fonction);
-               rule.addWord( "in_array", php_fonction);
-               rule.addWord( "Include()", php_fonction);
-               rule.addWord( "Include_once()", php_fonction);
-               rule.addWord( "ini_alter", php_fonction);
-               rule.addWord( "ini_get", php_fonction);
-               rule.addWord( "ini_restore", php_fonction);
-               rule.addWord( "ini_set", php_fonction);
-               rule.addWord( "intval", php_fonction);
-               rule.addWord( "ip2long", php_fonction);
-               rule.addWord( "iptcparse", php_fonction);
-               rule.addWord( "is_array", php_fonction);
-               rule.addWord( "is_bool", php_fonction);
-               rule.addWord( "is_dir", php_fonction);
-               rule.addWord( "is_double", php_fonction);
-               rule.addWord( "is_executable", php_fonction);
-               rule.addWord( "is_file", php_fonction);
-               rule.addWord( "is_float", php_fonction);
-               rule.addWord( "is_int", php_fonction);
-               rule.addWord( "is_integer", php_fonction);
-               rule.addWord( "is_link", php_fonction);
-               rule.addWord( "is_long", php_fonction);
-               rule.addWord( "is_null", php_fonction);
-               rule.addWord( "is_numeric", php_fonction);
-               rule.addWord( "is_object", php_fonction);
-               rule.addWord( "is_readable", php_fonction);
-               rule.addWord( "is_real", php_fonction);
-               rule.addWord( "is_resource", php_fonction);
-               rule.addWord( "is_scalar", php_fonction);
-               rule.addWord( "is_string", php_fonction);
-               rule.addWord( "is_subclass_of", php_fonction);
-               rule.addWord( "is_uploaded_file", php_fonction);
-               rule.addWord( "is_writable", php_fonction);
-               rule.addWord( "is_writeable", php_fonction);
-               rule.addWord( "isset", php_fonction);
-               rule.addWord( "jddayofweek", php_fonction);
-               rule.addWord( "jdmonthname", php_fonction);
-               rule.addWord( "jdtofrench", php_fonction);
-               rule.addWord( "jdtogregorian", php_fonction);
-               rule.addWord( "jdtojewish", php_fonction);
-               rule.addWord( "jdtojulian", php_fonction);
-               rule.addWord( "jdtounix", php_fonction);
-               rule.addWord( "jewishtojd", php_fonction);
-               rule.addWord( "join", php_fonction);
-               rule.addWord( "juliantojd", php_fonction);
-               rule.addWord( "key", php_fonction);
-               rule.addWord( "krsort", php_fonction);
-               rule.addWord( "ksort", php_fonction);
-               rule.addWord( "lcg_value", php_fonction);
-               rule.addWord( "leak", php_fonction);
-               rule.addWord( "levenshtein", php_fonction);
-               rule.addWord( "link", php_fonction);
-               rule.addWord( "linkinfo", php_fonction);
-               rule.addWord( "list", php_fonction);
-               rule.addWord( "localeconv", php_fonction);
-               rule.addWord( "localtime", php_fonction);
-               rule.addWord( "log", php_fonction);
-               rule.addWord( "log10", php_fonction);
-               rule.addWord( "long2ip", php_fonction);
-               rule.addWord( "lstat", php_fonction);
-               rule.addWord( "ltrim", php_fonction);
-               rule.addWord( "mail", php_fonction);
-               rule.addWord( "max", php_fonction);
-               rule.addWord( "mcrypt_cbc", php_fonction);
-               rule.addWord( "mcrypt_cfb", php_fonction);
-               rule.addWord( "mcrypt_create_iv", php_fonction);
-               rule.addWord( "mcrypt_decrypt", php_fonction);
-               rule.addWord( "mcrypt_ecb", php_fonction);
-               rule.addWord( "mcrypt_enc_get_algorithms_name", php_fonction);
-               rule.addWord( "mcrypt_enc_get_block_size", php_fonction);
-               rule.addWord( "mcrypt_enc_get_iv_size", php_fonction);
-               rule.addWord( "mcrypt_enc_get_key_size", php_fonction);
-               rule.addWord( "mcrypt_enc_get_modes_name", php_fonction);
-               rule.addWord( "mcrypt_enc_get_supported_key_sizes", php_fonction);
-               rule.addWord( "mcrypt_enc_is_block_algorithm", php_fonction);
-               rule.addWord( "mcrypt_enc_is_block_algorithm_mode", php_fonction);
-               rule.addWord( "mcrypt_enc_is_block_mode", php_fonction);
-               rule.addWord( "mcrypt_enc_self_test", php_fonction);
-               rule.addWord( "mcrypt_encrypt", php_fonction);
-               rule.addWord( "mcrypt_generic", php_fonction);
-               rule.addWord( "mcrypt_generic_end", php_fonction);
-               rule.addWord( "mcrypt_generic_init", php_fonction);
-               rule.addWord( "mcrypt_get_block_size", php_fonction);
-               rule.addWord( "mcrypt_get_cipher_name", php_fonction);
-               rule.addWord( "mcrypt_get_iv_size", php_fonction);
-               rule.addWord( "mcrypt_get_key_size", php_fonction);
-               rule.addWord( "mcrypt_list_algorithms", php_fonction);
-               rule.addWord( "mcrypt_list_modes", php_fonction);
-               rule.addWord( "mcrypt_module_get_algo_block_size", php_fonction);
-               rule.addWord( "mcrypt_module_get_algo_key_size", php_fonction);
-               rule.addWord( "mcrypt_module_get_algo_supported_key_sizes", php_fonction);
-               rule.addWord( "mcrypt_module_is_block_algorithm", php_fonction);
-               rule.addWord( "mcrypt_module_is_block_algorithm_mode", php_fonction);
-               rule.addWord( "mcrypt_module_is_block_mode", php_fonction);
-               rule.addWord( "mcrypt_module_open", php_fonction);
-               rule.addWord( "mcrypt_module_self_test", php_fonction);
-               rule.addWord( "mcrypt_ofb", php_fonction);
-               rule.addWord( "md5", php_fonction);
-               rule.addWord( "mdecrypt_generic", php_fonction);
-               rule.addWord( "metaphone", php_fonction);
-               rule.addWord( "method_exists", php_fonction);
-               rule.addWord( "microtime", php_fonction);
-               rule.addWord( "min", php_fonction);
-               rule.addWord( "mkdir", php_fonction);
-               rule.addWord( "mktime", php_fonction);
-               rule.addWord( "move_uploaded_file", php_fonction);
-               rule.addWord( "mt_getrandmax", php_fonction);
-               rule.addWord( "mt_rand", php_fonction);
-               rule.addWord( "mt_srand", php_fonction);
-               rule.addWord( "mysql_affected_rows", php_fonction);
-               rule.addWord( "mysql_change_user", php_fonction);
-               rule.addWord( "mysql_close", php_fonction);
-               rule.addWord( "mysql_connect", php_fonction);
-               rule.addWord( "mysql_create_db", php_fonction);
-               rule.addWord( "mysql_data_seek", php_fonction);
-               rule.addWord( "mysql_db_name", php_fonction);
-               rule.addWord( "mysql_db_query", php_fonction);
-               rule.addWord( "mysql_drop_db", php_fonction);
-               rule.addWord( "mysql_errno", php_fonction);
-               rule.addWord( "mysql_error", php_fonction);
-               rule.addWord( "mysql_escape_string", php_fonction);
-               rule.addWord( "mysql_fetch_array", php_fonction);
-               rule.addWord( "mysql_fetch_assoc", php_fonction);
-               rule.addWord( "mysql_fetch_field", php_fonction);
-               rule.addWord( "mysql_fetch_lengths", php_fonction);
-               rule.addWord( "mysql_fetch_object", php_fonction);
-               rule.addWord( "mysql_fetch_row", php_fonction);
-               rule.addWord( "mysql_field_flags", php_fonction);
-               rule.addWord( "mysql_field_len", php_fonction);
-               rule.addWord( "mysql_field_name", php_fonction);
-               rule.addWord( "mysql_field_seek", php_fonction);
-               rule.addWord( "mysql_field_table", php_fonction);
-               rule.addWord( "mysql_field_type", php_fonction);
-               rule.addWord( "mysql_free_result", php_fonction);
-               rule.addWord( "mysql_get_client_info", php_fonction);
-               rule.addWord( "mysql_get_host_info", php_fonction);
-               rule.addWord( "mysql_get_proto_info", php_fonction);
-               rule.addWord( "mysql_get_server_info", php_fonction);
-               rule.addWord( "mysql_insert_id", php_fonction);
-               rule.addWord( "mysql_list_dbs", php_fonction);
-               rule.addWord( "mysql_list_fields", php_fonction);
-               rule.addWord( "mysql_list_tables", php_fonction);
-               rule.addWord( "mysql_num_fields", php_fonction);
-               rule.addWord( "mysql_num_rows", php_fonction);
-               rule.addWord( "mysql_pconnect", php_fonction);
-               rule.addWord( "mysql_query", php_fonction);
-               rule.addWord( "mysql_result", php_fonction);
-               rule.addWord( "mysql_select_db", php_fonction);
-               rule.addWord( "mysql_tablename", php_fonction);
-               rule.addWord( "mysql_unbuffered_query", php_fonction);
-               rule.addWord( "natcasesort", php_fonction);
-               rule.addWord( "natsort", php_fonction);
-               rule.addWord( "next", php_fonction);
-               rule.addWord( "nl2br", php_fonction);
-               rule.addWord( "number_format", php_fonction);
-               rule.addWord( "ob_end_clean", php_fonction);
-               rule.addWord( "ob_end_flush", php_fonction);
-               rule.addWord( "ob_get_contents", php_fonction);
-               rule.addWord( "ob_get_length", php_fonction);
-               rule.addWord( "ob_gzhandler", php_fonction);
-               rule.addWord( "ob_implicit_flush", php_fonction);
-               rule.addWord( "ob_start", php_fonction);
-               rule.addWord( "octdec", php_fonction);
-               rule.addWord( "opendir", php_fonction);
-               rule.addWord( "openlog", php_fonction);
-               rule.addWord( "ord", php_fonction);
-               rule.addWord( "pack", php_fonction);
-               rule.addWord( "parse_str", php_fonction);
-               rule.addWord( "parse_url", php_fonction);
-               rule.addWord( "pathinfo", php_fonction);
-               rule.addWord( "pclose", php_fonction);
-               rule.addWord( "pfsockopen", php_fonction);
-               rule.addWord( "php_logo_guid", php_fonction);
-               rule.addWord( "php_sapi_name", php_fonction);
-               rule.addWord( "php_uname", php_fonction);
-               rule.addWord( "phpcredits", php_fonction);
-               rule.addWord( "phpinfo", php_fonction);
-               rule.addWord( "phpversion", php_fonction);
-               rule.addWord( "pi", php_fonction);
-               rule.addWord( "popen", php_fonction);
-               rule.addWord( "pos", php_fonction);
-               rule.addWord( "pow", php_fonction);
-               rule.addWord( "prev", php_fonction);
-               rule.addWord( "print", php_fonction);
-               rule.addWord( "print_r", php_fonction);
-               rule.addWord( "printf", php_fonction);
-               rule.addWord( "putenv", php_fonction);
-               rule.addWord( "quoted_printable_decode", php_fonction);
-               rule.addWord( "quotemeta", php_fonction);
-               rule.addWord( "rad2deg", php_fonction);
-               rule.addWord( "rand", php_fonction);
-               rule.addWord( "range", php_fonction);
-               rule.addWord( "rawurldecode", php_fonction);
-               rule.addWord( "rawurlencode", php_fonction);
-               rule.addWord( "read_exif_data", php_fonction);
-               rule.addWord( "readdir", php_fonction);
-               rule.addWord( "readfile", php_fonction);
-               rule.addWord( "readlink", php_fonction);
-               rule.addWord( "realpath", php_fonction);
-               rule.addWord( "rename", php_fonction);
-               rule.addWord( "Require()", php_fonction);
-               rule.addWord( "Require_once()", php_fonction);
-               rule.addWord( "reset", php_fonction);
-               rule.addWord( "restore_error_handler", php_fonction);
-               rule.addWord( "rewind", php_fonction);
-               rule.addWord( "rewinddir", php_fonction);
-               rule.addWord( "rmdir", php_fonction);
-               rule.addWord( "round", php_fonction);
-               rule.addWord( "rsort", php_fonction);
-               rule.addWord( "rtrim", php_fonction);
-               rule.addWord( "serialize", php_fonction);
-               rule.addWord( "session_cache_limiter", php_fonction);
-               rule.addWord( "session_decode", php_fonction);
-               rule.addWord( "session_destroy", php_fonction);
-               rule.addWord( "session_encode", php_fonction);
-               rule.addWord( "session_get_cookie_params", php_fonction);
-               rule.addWord( "session_id", php_fonction);
-               rule.addWord( "session_is_registered", php_fonction);
-               rule.addWord( "session_module_name", php_fonction);
-               rule.addWord( "session_name", php_fonction);
-               rule.addWord( "session_register", php_fonction);
-               rule.addWord( "session_save_path", php_fonction);
-               rule.addWord( "session_set_cookie_params", php_fonction);
-               rule.addWord( "session_set_save_handler", php_fonction);
-               rule.addWord( "session_start", php_fonction);
-               rule.addWord( "session_unregister", php_fonction);
-               rule.addWord( "session_unset", php_fonction);
-               rule.addWord( "session_write_close", php_fonction);
-               rule.addWord( "set_error_handler", php_fonction);
-               rule.addWord( "set_file_buffer", php_fonction);
-               rule.addWord( "set_magic_quotes_runtime", php_fonction);
-               rule.addWord( "set_time_limit", php_fonction);
-               rule.addWord( "setcookie", php_fonction);
-               rule.addWord( "setlocale", php_fonction);
-               rule.addWord( "settype", php_fonction);
-               rule.addWord( "show_source", php_fonction);
-               rule.addWord( "shuffle", php_fonction);
-               rule.addWord( "similar_text", php_fonction);
-               rule.addWord( "sin", php_fonction);
-               rule.addWord( "sizeof", php_fonction);
-               rule.addWord( "sleep", php_fonction);
-               rule.addWord( "socket_get_status", php_fonction);
-               rule.addWord( "socket_set_blocking", php_fonction);
-               rule.addWord( "socket_set_timeout", php_fonction);
-               rule.addWord( "sort", php_fonction);
-               rule.addWord( "soundex", php_fonction);
-               rule.addWord( "sprintf", php_fonction);
-               rule.addWord( "sqrt", php_fonction);
-               rule.addWord( "srand", php_fonction);
-               rule.addWord( "sscanf", php_fonction);
-               rule.addWord( "stat", php_fonction);
-               rule.addWord( "str_pad", php_fonction);
-               rule.addWord( "str_repeat", php_fonction);
-               rule.addWord( "str_replace", php_fonction);
-               rule.addWord( "strcasecmp", php_fonction);
-               rule.addWord( "strchr", php_fonction);
-               rule.addWord( "strcmp", php_fonction);
-               rule.addWord( "strcoll", php_fonction);
-               rule.addWord( "strcspn", php_fonction);
-               rule.addWord( "strftime", php_fonction);
-               rule.addWord( "strip_tags", php_fonction);
-               rule.addWord( "stripcslashes", php_fonction);
-               rule.addWord( "stripslashes", php_fonction);
-               rule.addWord( "stristr", php_fonction);
-               rule.addWord( "strlen", php_fonction);
-               rule.addWord( "strnatcasecmp", php_fonction);
-               rule.addWord( "strnatcmp", php_fonction);
-               rule.addWord( "strncasecmp", php_fonction);
-               rule.addWord( "strncmp", php_fonction);
-               rule.addWord( "strpos", php_fonction);
-               rule.addWord( "strrchr", php_fonction);
-               rule.addWord( "strrev", php_fonction);
-               rule.addWord( "strrpos", php_fonction);
-               rule.addWord( "strspn", php_fonction);
-               rule.addWord( "strstr", php_fonction);
-               rule.addWord( "strtok", php_fonction);
-               rule.addWord( "strtolower", php_fonction);
-               rule.addWord( "strtotime", php_fonction);
-               rule.addWord( "strtoupper", php_fonction);
-               rule.addWord( "strtr", php_fonction);
-               rule.addWord( "strval", php_fonction);
-               rule.addWord( "substr", php_fonction);
-               rule.addWord( "substr_count", php_fonction);
-               rule.addWord( "substr_replace", php_fonction);
-               rule.addWord( "symlink", php_fonction);
-               rule.addWord( "syslog", php_fonction);
-               rule.addWord( "tan", php_fonction);
-               rule.addWord( "tempnam", php_fonction);
-               rule.addWord( "time", php_fonction);
-               rule.addWord( "tmpfile", php_fonction);
-               rule.addWord( "touch", php_fonction);
-               rule.addWord( "trigger_error", php_fonction);
-               rule.addWord( "trim", php_fonction);
-               rule.addWord( "uasort", php_fonction);
-               rule.addWord( "ucfirst", php_fonction);
-               rule.addWord( "ucwords", php_fonction);
-               rule.addWord( "uksort", php_fonction);
-               rule.addWord( "umask", php_fonction);
-               rule.addWord( "uniqid", php_fonction);
-               rule.addWord( "unixtojd", php_fonction);
-               rule.addWord( "unlink", php_fonction);
-               rule.addWord( "unpack", php_fonction);
-               rule.addWord( "unserialize", php_fonction);
-               rule.addWord( "unset", php_fonction);
-               rule.addWord( "urldecode", php_fonction);
-               rule.addWord( "urlencode", php_fonction);
-               rule.addWord( "user_error", php_fonction);
-               rule.addWord( "usleep", php_fonction);
-               rule.addWord( "usort", php_fonction);
-               rule.addWord( "var_dump", php_fonction);
-               rule.addWord( "virtual", php_fonction);
-               rule.addWord( "wordwrap", php_fonction);
-               rule.addWord( "zend_logo_guid", php_fonction);
-               rule.addWord( "zend_version ", php_fonction);
-
-               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/TagRule.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/editors/TagRule.java
deleted file mode 100644 (file)
index b0b3ac3..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-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
deleted file mode 100644 (file)
index 2e54bf1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-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
deleted file mode 100644 (file)
index b84b6cf..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.sourceforge.phpeclipse.editors;
-
-import org.eclipse.jface.text.rules.IWordDetector;
-
-/**
- * XML word detector.
- * 
- * @author Igor Malinin
- */
-
-/** 
- * detects the keywords and highlights them
- * 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);
-       }
-
-}
index d7ab260..e081aea 100644 (file)
@@ -51,8 +51,8 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                public Position position;
 
                public Segment(String name, Position position) {
-                       this.name= name;
-                       this.position= position;
+                       this.name = name;
+                       this.position = position;
                }
 
                public String toString() {
@@ -65,34 +65,56 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
         */
        protected class ContentProvider implements ITreeContentProvider {
 
-               protected final static String SEGMENTS= "__java_segments"; //$NON-NLS-1$
-               protected IPositionUpdater fPositionUpdater= new DefaultPositionUpdater(SEGMENTS);
-               protected List fContent= new ArrayList(10);
+               protected final static String SEGMENTS = "__php_segments"; //$NON-NLS-1$
+               protected IPositionUpdater fPositionUpdater = new DefaultPositionUpdater(SEGMENTS);
+               protected List fContent = new ArrayList(10);
 
                protected void parse(IDocument document) {
 
-                       int lines= document.getNumberOfLines();
-                       int increment= Math.max(Math.round((float) (lines / 10)), 10);
-
-                       for (int line= 0; line < lines; line += increment) {
-
-                               int length= increment;
-                               if (line + increment > lines)
-                                       length= lines - line;
+                       int lines = document.getNumberOfLines();
+                       int increment = Math.max(Math.round((float) (lines / 10)), 10);
+                       
+      String text = document.get();
+                       int lastIndex = 0;
+      int i=0;
+                       lastIndex = text.indexOf("function ", lastIndex);
+                       while (lastIndex > 0) {
 
                                try {
-
-                                       int offset= document.getLineOffset(line);
-                                       int end= document.getLineOffset(line + length);
-                                       length= end - offset;
-                                       Position p= new Position(offset, length);
+          i = lastIndex+9;
+          while ((i<text.length())&&Character.isJavaIdentifierPart(text.charAt(i))) {
+            i++;
+          } 
+                                       Position p = new Position(lastIndex, i-lastIndex);
                                        document.addPosition(SEGMENTS, p);
-                                       fContent.add(new Segment(MessageFormat.format(PHPEditorMessages.getString("OutlinePage.segment.title_pattern"), new Object[] { new Integer(offset) }), p)); //$NON-NLS-1$
-
-                               } catch (BadPositionCategoryException x) {
-                               } catch (BadLocationException x) {
+                                       fContent.add(new Segment(text.substring(lastIndex,i), p));
+     //     MessageFormat.format("function", new Object[] { new Integer(lastIndex)}), p)); //$NON-NLS-1$
+                                       lastIndex = text.indexOf("function", lastIndex+1);
+                               } catch (BadLocationException e) {
+                               } catch (BadPositionCategoryException e) {
                                }
+
                        }
+
+                       //                      for (int line = 0; line < lines; line += increment) {
+                       //
+                       //                              int length = increment;
+                       //                              if (line + increment > lines)
+                       //                                      length = lines - line;
+                       //
+                       //                              try {
+                       //
+                       //                                      int offset = document.getLineOffset(line);
+                       //                                      int end = document.getLineOffset(line + length);
+                       //                                      length = end - offset;
+                       //                                      Position p = new Position(offset, length);
+                       //                                      document.addPosition(SEGMENTS, p);
+                       //                                      fContent.add(new Segment(MessageFormat.format(PHPEditorMessages.getString("OutlinePage.segment.title_pattern"), new Object[] { new Integer(offset)}), p)); //$NON-NLS-1$
+                       //
+                       //                              } catch (BadPositionCategoryException x) {
+                       //                              } catch (BadLocationException x) {
+                       //                              }
+                       //                      }
                }
 
                /*
@@ -100,7 +122,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                 */
                public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
                        if (oldInput != null) {
-                               IDocument document= fDocumentProvider.getDocument(oldInput);
+                               IDocument document = fDocumentProvider.getDocument(oldInput);
                                if (document != null) {
                                        try {
                                                document.removePositionCategory(SEGMENTS);
@@ -113,7 +135,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                        fContent.clear();
 
                        if (newInput != null) {
-                               IDocument document= fDocumentProvider.getDocument(newInput);
+                               IDocument document = fDocumentProvider.getDocument(newInput);
                                if (document != null) {
                                        document.addPositionCategory(SEGMENTS);
                                        document.addPositionUpdater(fPositionUpdater);
@@ -129,7 +151,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                public void dispose() {
                        if (fContent != null) {
                                fContent.clear();
-                               fContent= null;
+                               fContent = null;
                        }
                }
 
@@ -182,10 +204,10 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
         */
        public PHPContentOutlinePage(IDocumentProvider provider, ITextEditor editor) {
                super();
-               fDocumentProvider= provider;
-               fTextEditor= editor;
+               fDocumentProvider = provider;
+               fTextEditor = editor;
        }
-       
+
        /* (non-Javadoc)
         * Method declared on ContentOutlinePage
         */
@@ -193,7 +215,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
 
                super.createControl(parent);
 
-               TreeViewer viewer= getTreeViewer();
+               TreeViewer viewer = getTreeViewer();
                viewer.setContentProvider(new ContentProvider());
                viewer.setLabelProvider(new LabelProvider());
                viewer.addSelectionChangedListener(this);
@@ -201,7 +223,7 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                if (fInput != null)
                        viewer.setInput(fInput);
        }
-       
+
        /* (non-Javadoc)
         * Method declared on ContentOutlinePage
         */
@@ -209,13 +231,13 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
 
                super.selectionChanged(event);
 
-               ISelection selection= event.getSelection();
+               ISelection selection = event.getSelection();
                if (selection.isEmpty())
                        fTextEditor.resetHighlightRange();
                else {
-                       Segment segment= (Segment) ((IStructuredSelection) selection).getFirstElement();
-                       int start= segment.position.getOffset();
-                       int length= segment.position.getLength();
+                       Segment segment = (Segment) ((IStructuredSelection) selection).getFirstElement();
+                       int start = segment.position.getOffset();
+                       int length = segment.position.getLength();
                        try {
                                fTextEditor.setHighlightRange(start, length, true);
                        } catch (IllegalArgumentException x) {
@@ -223,23 +245,23 @@ public class PHPContentOutlinePage extends ContentOutlinePage {
                        }
                }
        }
-       
+
        /**
         * Sets the input of the outline page
         */
        public void setInput(Object input) {
-               fInput= input;
+               fInput = input;
                update();
        }
-       
+
        /**
         * Updates the outline page.
         */
        public void update() {
-               TreeViewer viewer= getTreeViewer();
+               TreeViewer viewer = getTreeViewer();
 
                if (viewer != null) {
-                       Control control= viewer.getControl();
+                       Control control = viewer.getControl();
                        if (control != null && !control.isDisposed()) {
                                control.setRedraw(false);
                                viewer.setInput(fInput);
index 84f31f4..9e75272 100644 (file)
@@ -19,8 +19,10 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
 import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.text.rules.EndOfLineRule;
+import org.eclipse.jface.text.rules.ICharacterScanner;
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.IWordDetector;
 import org.eclipse.jface.text.rules.MultiLineRule;
 import org.eclipse.jface.text.rules.RuleBasedScanner;
 import org.eclipse.jface.text.rules.SingleLineRule;
@@ -2412,6 +2414,54 @@ public class PHPCodeScanner extends RuleBasedScanner {
                        "zzip_read",
                        "zzip_readdir" };
 
+  private IToken variable;
+  
+       private class PHPWordRule extends WordRule {
+    private StringBuffer fBuffer= new StringBuffer();
+
+               public PHPWordRule(IWordDetector detector) {
+                       super(detector, Token.UNDEFINED);
+               }
+
+               public PHPWordRule(IWordDetector detector, IToken defaultToken) {
+                       super(detector, defaultToken);
+               }
+
+               public IToken evaluate(ICharacterScanner scanner) {
+                       int c = scanner.read();
+      boolean isVariable = false;
+                       if (fDetector.isWordStart((char) c)) {
+        if (c=='$') {
+          isVariable = true;
+        }
+                               if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
+
+                                       fBuffer.setLength(0);
+                                       do {
+                                               fBuffer.append((char) c);
+                                               c = scanner.read();
+                                       } while (c != scanner.EOF && fDetector.isWordPart((char) c));
+                                       scanner.unread();
+
+          if (isVariable) {
+            return variable;
+          }
+                                       IToken token = (IToken) fWords.get(fBuffer.toString());
+                                       if (token != null)
+                                               return token;
+
+                                       if (fDefaultToken.isUndefined())
+                                               unreadBuffer(scanner);
+
+                                       return fDefaultToken;
+                               }
+                       }
+
+                       scanner.unread();
+                       return Token.UNDEFINED;
+               }
+       }
+
        private static String[] fgConstants = { "__LINE__", "__FILE__", "true", "false" };
        private TextAttribute fComment;
        private TextAttribute fKeyword;
@@ -2429,28 +2479,31 @@ public class PHPCodeScanner extends RuleBasedScanner {
                IToken string = new Token(new TextAttribute(provider.getColor(PHPColorProvider.STRING)));
                IToken comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.SINGLE_LINE_COMMENT)));
                IToken multi_comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.MULTI_LINE_COMMENT)));
-    IToken other = new Token(new TextAttribute(provider.getColor(PHPColorProvider.DEFAULT)));
+               IToken other = new Token(new TextAttribute(provider.getColor(PHPColorProvider.DEFAULT)));
 
+    variable = new Token(new TextAttribute(provider.getColor(PHPColorProvider.VARIABLE)));
+
+    
                List rules = new ArrayList();
 
                // Add rule for single line comments.
                rules.add(new EndOfLineRule("//", comment)); //$NON-NLS-1$
-    EndOfLineRule endOfLine = new EndOfLineRule("#", comment);
-    endOfLine.setColumnConstraint(0);
-    rules.add(endOfLine);
-    
+               //    EndOfLineRule endOfLine = new EndOfLineRule("#", comment);
+               //    endOfLine.setColumnConstraint(0);
+               rules.add(new EndOfLineRule("#", comment));
+
                // Add rule for strings and character constants.
                rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
                rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
 
-   // rules.add(new SingleLineRule("//", "//", php_comment));
-    rules.add(new MultiLineRule("/*", "*/", multi_comment));
-    
+               // rules.add(new SingleLineRule("//", "//", php_comment));
+               rules.add(new MultiLineRule("/*", "*/", multi_comment));
+
                // Add generic whitespace rule.
                rules.add(new WhitespaceRule(new PHPWhitespaceDetector()));
 
                // Add word rule for keywords, types, and constants.
-               WordRule wordRule = new WordRule(new PHPWordDetector(), other);
+               PHPWordRule wordRule = new PHPWordRule(new PHPWordDetector(), other);
                for (int i = 0; i < fgKeywords.length; i++)
                        wordRule.addWord(fgKeywords[i], keyword);
                for (int i = 0; i < fgTypes.length; i++)
index 601db7f..a9b88fc 100644 (file)
@@ -59,43 +59,43 @@ public class PHPCompletionProcessor implements IContentAssistProcessor {
        };
 
        protected final static String[] fgProposals =
-       {
-               
-               "elseif",
-               "else",
-               "endif",
-    "endfor",
-               "for",
-    "if",
-               "while",
-               "endwhile",
-               "switch",
-               "case",
-               "endswitch",
-               "break",
-               "continue",
-               "return",
-               "define",
-               "include",
-               "include_once",
-               "require",
-               "require_once",
-               "function",
-               "class",
-               "new",
-               "do",
-               "old_function",
-               "default",
-               "global",
-               "static",
-               "foreach",
-               "endforeach",
-               "extends",
-               "empty",
-               "array",
-               "isset",
-               "echo",
-               "var" };
+               {
+                       "array",
+                       "break",
+                       "class",
+                       "continue",
+                       "do",
+                       "echo",
+                       "else",
+                       "elseif",
+                       "endfor",
+                       "endif",
+                       "for",
+                       "if",
+                       "while",
+                       "endwhile",
+                       "switch",
+                       "case",
+                       "endswitch",
+                       "return",
+                       "define",
+                       "include",
+                       "include_once",
+                       "require",
+                       "require_once",
+                       "function",
+                       "new",
+                       "old_function",
+                       "default",
+                       "global",
+                       "static",
+                       "foreach",
+                       "endforeach",
+                       "extends",
+                       "empty",
+                       "isset",
+                       "var" };
+      
        protected IContextInformationValidator fValidator = new Validator();
 
        /* (non-Javadoc)
index b96202a..00ec730 100644 (file)
@@ -31,10 +31,95 @@ import org.eclipse.jface.text.rules.WordRule;
  */
 public class PHPPartitionScanner extends RuleBasedPartitionScanner {
 
-       private final static String SKIP= "__skip"; //$NON-NLS-1$
-       public final static String JAVA_MULTILINE_COMMENT= "__html_multiline_comment"; //$NON-NLS-1$
-//     public final static String JAVA_DOC= "__java_javadoc"; //$NON-NLS-1$
-  public final static String PHP= "__php";
+       private final static String SKIP = "__skip"; //$NON-NLS-1$
+       public final static String JAVA_MULTILINE_COMMENT = "__html_multiline_comment"; //$NON-NLS-1$
+       //      public final static String JAVA_DOC= "__java_javadoc"; //$NON-NLS-1$
+       public final static String PHP = "__php";
+
+       public class PHPMultiLineRule extends MultiLineRule {
+
+               public PHPMultiLineRule(String startSequence, String endSequence, IToken token) {
+                       super(startSequence, endSequence, token);
+               }
+
+               public PHPMultiLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter) {
+                       super(startSequence, endSequence, token, escapeCharacter);
+               }
+
+               protected boolean endSequenceDetected(ICharacterScanner scanner) {
+                       int c;
+                       int c2;
+
+                       boolean lineCommentMode = false;
+                       boolean multiLineCommentMode = false;
+                       boolean stringMode = false;
+
+                       char[][] delimiters = scanner.getLegalLineDelimiters();
+                       while ((c = scanner.read()) != ICharacterScanner.EOF) {
+                               if (c == '\n') {
+                                       lineCommentMode = false;
+                                       // read until end of line
+                               } else if (c == '#') {
+                                       // read until end of line
+                                       lineCommentMode = true;
+                                       continue;
+                               } else if (c == '/') {
+                                       c2 = scanner.read();
+                                       if (c2 == '/') {
+                                               lineCommentMode = true;
+            continue;
+                                       }       else if(c2 == '*') {
+                                               multiLineCommentMode = true;
+                                               continue;
+                                       } else {
+                                               scanner.unread();
+                                       }
+                               } else if (c == '*' && multiLineCommentMode) {
+                                       c2 = scanner.read();
+                                       if (c2 == '/') {
+                                               multiLineCommentMode = false;
+                                               continue;
+                                       } else {
+                                               scanner.unread();
+                                       }
+                               } else if (c == '\\' && stringMode) {
+                                       c2 = scanner.read();
+                                       if (c2 == '"') {
+                                               continue;
+                                       } else {
+                                               scanner.unread();
+                                       }
+                               } else if (c == '"') {
+                                       if (stringMode) {
+                                               stringMode = false;
+                                       } else {
+                                               stringMode = true;
+                                       }
+                                       continue;
+                               }
+                               if (lineCommentMode || multiLineCommentMode || stringMode) {
+                                       continue;
+                               }
+
+                               if (c == fEscapeCharacter) {
+                                       // Skip the escaped character.
+                                       scanner.read();
+                               } else if (fEndSequence.length > 0 && c == fEndSequence[0]) {
+                                       // Check if the specified end sequence has been found.
+                                       if (sequenceDetected(scanner, fEndSequence, true))
+                                               return true;
+                               } else if (fBreaksOnEOL) {
+                                       // Check for end of line since it can be used to terminate the pattern.
+                                       for (int i = 0; i < delimiters.length; i++) {
+                                               if (c == delimiters[i][0] && sequenceDetected(scanner, delimiters[i], false))
+                                                       return true;
+                                       }
+                               }
+                       }
+                       scanner.unread();
+                       return true;
+               }
+       }
        /**
         * Detector for empty comments.
         */
@@ -42,32 +127,32 @@ public class PHPPartitionScanner extends RuleBasedPartitionScanner {
 
                /* (non-Javadoc)
                * Method declared on IWordDetector
-               */
+                       */
                public boolean isWordStart(char c) {
                        return (c == '/');
                }
 
                /* (non-Javadoc)
                * Method declared on IWordDetector
-               */
+                       */
                public boolean isWordPart(char c) {
                        return (c == '*' || c == '/');
                }
        };
-       
+
        /**
         * 
         */
        static class WordPredicateRule extends WordRule implements IPredicateRule {
-               
+
                private IToken fSuccessToken;
-               
+
                public WordPredicateRule(IToken successToken) {
                        super(new EmptyCommentDetector());
-                       fSuccessToken= successToken;
+                       fSuccessToken = successToken;
                        addWord("/**/", fSuccessToken);
                }
-               
+
                /*
                 * @see org.eclipse.jface.text.rules.IPredicateRule#evaluate(ICharacterScanner, boolean)
                 */
@@ -89,32 +174,31 @@ public class PHPPartitionScanner extends RuleBasedPartitionScanner {
        public PHPPartitionScanner() {
                super();
 
-//             IToken javaDoc= new Token(JAVA_DOC);
-               IToken comment= new Token(JAVA_MULTILINE_COMMENT);
-    IToken php = new Token(PHP);
-               List rules= new ArrayList();
+               //              IToken javaDoc= new Token(JAVA_DOC);
+               IToken comment = new Token(JAVA_MULTILINE_COMMENT);
+               IToken php = new Token(PHP);
+
+               List rules = new ArrayList();
 
                // Add rule for single line comments.
-       //      rules.add(new EndOfLineRule("//", Token.UNDEFINED));
+               //      rules.add(new EndOfLineRule("//", Token.UNDEFINED));
 
                // Add rule for strings and character constants.
-  //           rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\'));
-       //      rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\')); 
+               //              rules.add(new SingleLineRule("\"", "\"", Token.UNDEFINED, '\\'));
+               //      rules.add(new SingleLineRule("'", "'", Token.UNDEFINED, '\\')); 
 
                // Add special case word rule.
                rules.add(new WordPredicateRule(comment));
 
                // Add rules for multi-line comments and javadoc.
                //rules.add(new MultiLineRule("/**", "*/", javaDoc));
-               rules.add(new MultiLineRule("<!--", "-->", comment)); 
-    rules.add(new MultiLineRule("<? ", "?>", php)); 
-    rules.add(new MultiLineRule("<?php", "?>", php)); 
-    rules.add(new MultiLineRule("<?PHP", "?>", php)); 
-    //Add rule for processing instructions
-
+               rules.add(new MultiLineRule("<!--", "-->", comment));
+               rules.add(new PHPMultiLineRule("<? ", "?>", php));
+               rules.add(new PHPMultiLineRule("<?php", "?>", php));
+               rules.add(new PHPMultiLineRule("<?PHP", "?>", php));
+               //Add rule for processing instructions
 
-               IPredicateRule[] result= new IPredicateRule[rules.size()];
+               IPredicateRule[] result = new IPredicateRule[rules.size()];
                rules.toArray(result);
                setPredicateRules(result);
        }
index 30b61f9..a0ba4d4 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Map;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Display;
-
 /**
  * Manager for colors used in the Java editor
  */
@@ -25,7 +25,8 @@ public class PHPColorProvider {
 
        public static final RGB MULTI_LINE_COMMENT= new RGB(128, 0, 0);
        public static final RGB SINGLE_LINE_COMMENT= new RGB(128, 128, 0);
-       public static final RGB KEYWORD= new RGB(0, 0, 128);
+       public static final RGB KEYWORD= new RGB(127, 0, 85);
+  public static final RGB VARIABLE= new RGB(127, 159, 191);
        public static final RGB TYPE= new RGB(0, 0, 128);
        public static final RGB STRING= new RGB(0, 128, 0);
        public static final RGB DEFAULT= new RGB(0, 0, 0);