Charles Coldwell dcc57f
;;; php-mode.el --- major mode for editing PHP code
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad
Charles Coldwell dcc57f
;;               2008 Aaron S. Hawley
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Maintainer: Aaron S. Hawley <ashawley at users.sourceforge.net>
Charles Coldwell dcc57f
;; Author: Turadg Aleahmad, 1999-2004
Charles Coldwell dcc57f
;; Keywords: php languages oop
Charles Coldwell dcc57f
;; Created: 1999-05-17
Charles Coldwell dcc57f
;; Modified: 2007-01-02
Charles Coldwell dcc57f
;; X-URL:   http://php-mode.sourceforge.net/
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-mode-version-number "1.4.0"
Charles Coldwell dcc57f
  "PHP Mode version number.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; License
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; This file is free software; you can redistribute it and/or
Charles Coldwell dcc57f
;; modify it under the terms of the GNU General Public License
Charles Coldwell dcc57f
;; as published by the Free Software Foundation; either version 3
Charles Coldwell dcc57f
;; of the License, or (at your option) any later version.
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; This file is distributed in the hope that it will be useful,
Charles Coldwell dcc57f
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
Charles Coldwell dcc57f
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Charles Coldwell dcc57f
;; GNU General Public License for more details.
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; You should have received a copy of the GNU General Public License
Charles Coldwell dcc57f
;; along with this file; if not, write to the Free Software
Charles Coldwell dcc57f
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Charles Coldwell dcc57f
;; 02110-1301, USA.
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; Usage
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Put this file in your Emacs lisp path (eg. site-lisp) and add to
Charles Coldwell dcc57f
;; your .emacs file:
Charles Coldwell dcc57f
;;
Charles Coldwell dcc57f
;;   (require 'php-mode)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; To use abbrev-mode, add lines like this:
Charles Coldwell dcc57f
;;   (add-hook 'php-mode-hook
Charles Coldwell dcc57f
;;     '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; To make php-mode compatible with html-mode, see http://php-mode.sf.net
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Many options available under Help:Customize
Charles Coldwell dcc57f
;; Options specific to php-mode are in
Charles Coldwell dcc57f
;;  Programming/Languages/Php
Charles Coldwell dcc57f
;; Since it inherits much functionality from c-mode, look there too
Charles Coldwell dcc57f
;;  Programming/Languages/C
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; Commentary:
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; PHP mode is a major mode for editing PHP 3 and 4 source code.  It's
Charles Coldwell dcc57f
;; an extension of C mode; thus it inherits all C mode's navigation
Charles Coldwell dcc57f
;; functionality.  But it colors according to the PHP grammar and indents
Charles Coldwell dcc57f
;; according to the PEAR coding guidelines.  It also includes a couple
Charles Coldwell dcc57f
;; handy IDE-type features such as documentation search and a source
Charles Coldwell dcc57f
;; and class browser.
Charles Coldwell dcc57f
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; Contributors: (in chronological order)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Juanjo, Torsten Martinsen, Vinai Kopp, Sean Champ, Doug Marcey,
Charles Coldwell dcc57f
;; Kevin Blake, Rex McMaster, Mathias Meyer, Boris Folgmann, Roland
Charles Coldwell dcc57f
;; Rosenfeld, Fred Yankowski, Craig Andrews, John Keller, Ryan
Charles Coldwell dcc57f
;; Sammartino, ppercot, Valentin Funk, Stig Bakken, Gregory Stark,
Charles Coldwell dcc57f
;; Chris Morris, Nils Rennebarth, Gerrit Riessen, Eric Mc Sween,
Charles Coldwell dcc57f
;; Ville Skytta, Giacomo Tesio, Lennart Borgman, Stefan Monnier,
Charles Coldwell dcc57f
;; Aaron S. Hawley, Ian Eure, Bill Lovett
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; Changelog:
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; 1.4
Charles Coldwell dcc57f
;;   Updated GNU GPL to version 3.  Ported to Emacs 22 (CC mode
Charles Coldwell dcc57f
;;   5.31). M-x php-mode-version shows version.  Provide end-of-defun
Charles Coldwell dcc57f
;;   beginning-of-defun functionality. Support add-log library.
Charles Coldwell dcc57f
;;   Fix __CLASS__ constant (Ian Eure).  Allow imenu to see visibility
Charles Coldwell dcc57f
;;   declarations -- "private", "public", "protected". (Bill Lovett)
Charles Coldwell dcc57f
;;
Charles Coldwell dcc57f
;; 1.3
Charles Coldwell dcc57f
;;   Changed the definition of # using a tip from Stefan
Charles Coldwell dcc57f
;;   Monnier to correct highlighting and indentation. (Lennart Borgman)
Charles Coldwell dcc57f
;;   Changed the highlighting of the HTML part. (Lennart Borgman)
Charles Coldwell dcc57f
;;
Charles Coldwell dcc57f
;; 1.2
Charles Coldwell dcc57f
;;   Implemented php-show-arglist, C-. (Engelke Eschner)
Charles Coldwell dcc57f
;;   Implemented php-complete-function, M-tab (Engelke Eschner)
Charles Coldwell dcc57f
;;   Re-enabled # comment detection in GNU Emacs (Urban Müller)
Charles Coldwell dcc57f
;;   Fixed some keybindings and default settings (Engelke Eschner)
Charles Coldwell dcc57f
;;
Charles Coldwell dcc57f
;; 1.1
Charles Coldwell dcc57f
;;   Added PHP5 support (Giacomo Tesio)
Charles Coldwell dcc57f
;;     known problem: doesn't highlight after first 'implements'
Charles Coldwell dcc57f
;;   Better XEmacs compatibility (imenu, regexp, and comments!) (Ville Skytta)
Charles Coldwell dcc57f
;;   Improvement to php-conditional-key regexp (Eric Mc Sween)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; 1.05
Charles Coldwell dcc57f
;;   Incorporated speedbar defs by Gerrit Riessen
Charles Coldwell dcc57f
;;   Add "foreach" to conditional introducing keywords (Nils Rennebarth)
Charles Coldwell dcc57f
;;   Cleared the Changelog
Charles Coldwell dcc57f
;;   Moved contribution credits into comments above
Charles Coldwell dcc57f
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; Code:
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(require 'speedbar)
Charles Coldwell dcc57f
(require 'font-lock)
Charles Coldwell dcc57f
(require 'cc-mode)
Charles Coldwell dcc57f
(require 'custom)
Charles Coldwell dcc57f
(require 'etags)
Charles Coldwell dcc57f
(eval-when-compile
Charles Coldwell dcc57f
  (require 'regexp-opt))
Charles Coldwell dcc57f

Charles Coldwell dcc57f
;; Local variables
Charles Coldwell dcc57f
(defgroup php nil
Charles Coldwell dcc57f
  "Major mode `php-mode' for editing PHP code."
Charles Coldwell dcc57f
  :prefix "php-"
Charles Coldwell dcc57f
  :group 'languages)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-default-face 'default
Charles Coldwell dcc57f
  "Default face in `php-mode' buffers."
Charles Coldwell dcc57f
  :type 'face
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-speedbar-config t
Charles Coldwell dcc57f
  "When set to true automatically configures Speedbar to observe PHP files.\
Charles Coldwell dcc57f
Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s34]?\\)\""
Charles Coldwell dcc57f
  :type 'boolean
Charles Coldwell dcc57f
  :set (lambda (sym val)
Charles Coldwell dcc57f
         (set-default sym val)
Charles Coldwell dcc57f
         (if (and val (boundp 'speedbar))
Charles Coldwell dcc57f
             (speedbar-add-supported-extension
Charles Coldwell dcc57f
	      "\\.\\(inc\\|php[s34]?\\|phtml\\)")))
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-mode-speedbar-open nil
Charles Coldwell dcc57f
  "Normally `php-mode' starts with the speedbar closed.\
Charles Coldwell dcc57f
Turning this on will open it whenever `php-mode' is loaded."
Charles Coldwell dcc57f
  :type 'boolean
Charles Coldwell dcc57f
  :set (lambda (sym val)
Charles Coldwell dcc57f
         (set-default sym val)
Charles Coldwell dcc57f
         (when val
Charles Coldwell dcc57f
             (speedbar 1)))
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-manual-url "http://www.php.net/manual/en/"
Charles Coldwell dcc57f
  "URL at which to find PHP manual.\
Charles Coldwell dcc57f
You can replace \"en\" with your ISO language code."
Charles Coldwell dcc57f
  :type 'string
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-search-url "http://www.php.net/"
Charles Coldwell dcc57f
  "URL at which to search for documentation on a word"
Charles Coldwell dcc57f
  :type 'string
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-completion-file ""
Charles Coldwell dcc57f
  "Path to the file which contains the function names known to PHP"
Charles Coldwell dcc57f
  :type 'string
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-manual-path ""
Charles Coldwell dcc57f
  "Path to the directory which contains the PHP manual"
Charles Coldwell dcc57f
  :type 'string
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;;###autoload
Charles Coldwell dcc57f
(defcustom php-file-patterns '("\\.php[s34]?\\'" "\\.phtml\\'" "\\.inc\\'")
Charles Coldwell dcc57f
  "List of file patterns for which to automatically invoke `php-mode'."
Charles Coldwell dcc57f
  :type '(repeat (regexp :tag "Pattern"))
Charles Coldwell dcc57f
  :set (lambda (sym val)
Charles Coldwell dcc57f
         (set-default sym val)
Charles Coldwell dcc57f
         (let ((php-file-patterns-temp val))
Charles Coldwell dcc57f
           (while php-file-patterns-temp
Charles Coldwell dcc57f
             (add-to-list 'auto-mode-alist
Charles Coldwell dcc57f
                          (cons (car php-file-patterns-temp) 'php-mode))
Charles Coldwell dcc57f
             (setq php-file-patterns-temp (cdr php-file-patterns-temp)))))
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-mode-hook nil
Charles Coldwell dcc57f
  "List of functions to be executed on entry to `php-mode'."
Charles Coldwell dcc57f
  :type 'hook
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-mode-pear-hook nil
Charles Coldwell dcc57f
  "Hook called when a PHP PEAR file is opened with `php-mode'."
Charles Coldwell dcc57f
  :type 'hook
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defcustom php-mode-force-pear nil
Charles Coldwell dcc57f
  "Normally PEAR coding rules are enforced only when the filename contains \"PEAR\"\
Charles Coldwell dcc57f
Turning this on will force PEAR rules on all PHP files."
Charles Coldwell dcc57f
  :type 'boolean
Charles Coldwell dcc57f
  :group 'php)
Charles Coldwell dcc57f

Charles Coldwell dcc57f
(eval-when-compile
Charles Coldwell dcc57f
  (defconst php-mode-modified
Charles Coldwell dcc57f
    (save-excursion
Charles Coldwell dcc57f
      (and
Charles Coldwell dcc57f
       (re-search-backward "^;; Modified: \\(.*\\)" nil 'noerror)
Charles Coldwell dcc57f
       (match-string-no-properties 1)))
Charles Coldwell dcc57f
    "PHP Mode version number."))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-mode-version ()
Charles Coldwell dcc57f
  "Display string describing the version of PHP mode"
Charles Coldwell dcc57f
  (interactive)
Charles Coldwell dcc57f
  (message "PHP mode %s of %s"
Charles Coldwell dcc57f
	   php-mode-version-number php-mode-modified))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-beginning-of-defun-regexp
Charles Coldwell dcc57f
  "^\\s *function\\s +&?\\(\\(\\sw\\|\\s_\\)+\\)\\s *("
Charles Coldwell dcc57f
  "Regular expression for a PHP function.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-beginning-of-defun (&optional arg)
Charles Coldwell dcc57f
  "Move to the beginning of the ARGth PHP function from point.
Charles Coldwell dcc57f
Implements PHP version of `beginning-of-defun-function'."
Charles Coldwell dcc57f
  (interactive "p")
Charles Coldwell dcc57f
  (let ((arg (or arg 1)))
Charles Coldwell dcc57f
    (while (> arg 0)
Charles Coldwell dcc57f
      (re-search-backward php-beginning-of-defun-regexp
Charles Coldwell dcc57f
			  nil 'noerror)
Charles Coldwell dcc57f
      (setq arg (1- arg)))
Charles Coldwell dcc57f
    (while (< arg 0)
Charles Coldwell dcc57f
      (end-of-line 1)
Charles Coldwell dcc57f
      (let ((opoint (point)))
Charles Coldwell dcc57f
	(beginning-of-defun 1)
Charles Coldwell dcc57f
	(forward-list 2)
Charles Coldwell dcc57f
	(forward-line 1)
Charles Coldwell dcc57f
	(if (eq opoint (point))
Charles Coldwell dcc57f
	    (re-search-forward php-beginning-of-defun-regexp
Charles Coldwell dcc57f
			       nil 'noerror))
Charles Coldwell dcc57f
	(setq arg (1+ arg))))))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-end-of-defun (&optional arg)
Charles Coldwell dcc57f
  "Move the end of the ARGth PHP function from point.
Charles Coldwell dcc57f
Implements PHP befsion of `end-of-defun-function'
Charles Coldwell dcc57f
Charles Coldwell dcc57f
See `php-beginning-of-defun'."
Charles Coldwell dcc57f
  (interactive "p")
Charles Coldwell dcc57f
  (php-beginning-of-defun (- (or arg 1))))
Charles Coldwell dcc57f
Charles Coldwell dcc57f

Charles Coldwell dcc57f
(defvar php-completion-table nil
Charles Coldwell dcc57f
  "Obarray of tag names defined in current tags table and functions know to PHP.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defvar php-warned-bad-indent nil)
Charles Coldwell dcc57f
(make-variable-buffer-local 'php-warned-bad-indent)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Do it but tell it is not good if html tags in buffer.
Charles Coldwell dcc57f
(defun php-check-html-for-indentation ()
Charles Coldwell dcc57f
  (let ((html-tag-re "</?\\sw+.*?>")
Charles Coldwell dcc57f
        (here (point)))
Charles Coldwell dcc57f
    (if (not (or (re-search-forward html-tag-re (line-end-position) t)
Charles Coldwell dcc57f
                 (re-search-backward html-tag-re (line-beginning-position) t)))
Charles Coldwell dcc57f
        t
Charles Coldwell dcc57f
      (goto-char here)
Charles Coldwell dcc57f
      (setq php-warned-bad-indent t)
Charles Coldwell dcc57f
      (lwarn 'php-indent :warning
Charles Coldwell dcc57f
	     "\n\t%s\n\t%s\n\t%s\n"
Charles Coldwell dcc57f
	     "Indentation fails badly with mixed HTML and PHP."
Charles Coldwell dcc57f
	     "Look for an Emacs Lisp library that supports \"multiple"
Charles Coldwell dcc57f
	     "major modes\" like mumamo, mmm-mode or multi-mode.")
Charles Coldwell dcc57f
      nil)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-cautious-indent-region (start end &optional quiet)
Charles Coldwell dcc57f
  (if (or php-warned-bad-indent
Charles Coldwell dcc57f
          (php-check-html-for-indentation))
Charles Coldwell dcc57f
      (funcall 'c-indent-region start end quiet)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-cautious-indent-line ()
Charles Coldwell dcc57f
  (if (or php-warned-bad-indent
Charles Coldwell dcc57f
          (php-check-html-for-indentation))
Charles Coldwell dcc57f
      (funcall 'c-indent-line)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;;###autoload
Charles Coldwell dcc57f
(define-derived-mode php-mode c-mode "PHP"
Charles Coldwell dcc57f
  "Major mode for editing PHP code.\n\n\\{php-mode-map}"
Charles Coldwell dcc57f
;;   (c-add-language 'php-mode 'c-mode)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;   (c-lang-defconst c-block-stmt-1-kwds
Charles Coldwell dcc57f
;;     php php-block-stmt-1-kwds)
Charles Coldwell dcc57f
  (set (make-local-variable 'c-block-stmt-1-key) php-block-stmt-1-key)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;   (c-lang-defconst c-block-stmt-2-kwds
Charles Coldwell dcc57f
;;     php php-block-stmt-2-kwds)
Charles Coldwell dcc57f
  (set (make-local-variable 'c-block-stmt-2-key) php-block-stmt-2-key)
Charles Coldwell dcc57f
  ;; Specify that cc-mode recognize Javadoc comment style
Charles Coldwell dcc57f
  (set (make-local-variable 'c-doc-comment-style)
Charles Coldwell dcc57f
    '((php-mode . javadoc)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;   (c-lang-defconst c-class-decl-kwds
Charles Coldwell dcc57f
;;     php php-class-decl-kwds)
Charles Coldwell dcc57f
  (set (make-local-variable 'c-class-key) php-class-key)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (defvar php-mode-syntax-table php-mode-syntax-table)
Charles Coldwell dcc57f
  ;; this line makes $ into punctuation instead of a word constituent
Charles Coldwell dcc57f
  ;; it used to be active, but it killed indenting of case lines that
Charles Coldwell dcc57f
  ;; begin with '$' (many do).  If anyone has a solution to this
Charles Coldwell dcc57f
  ;; problem, please let me know.  Of course, you're welcome to
Charles Coldwell dcc57f
  ;; uncomment this line in your installation.
Charles Coldwell dcc57f
;  (modify-syntax-entry ?$ "." php-mode-syntax-table)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  ;; The above causes XEmacs to handle shell-style comments correctly,
Charles Coldwell dcc57f
  ;; but fails to work in GNU Emacs which fails to interpret \n as the
Charles Coldwell dcc57f
  ;; end of the comment.
Charles Coldwell dcc57f
  (if (featurep 'xemacs) (progn
Charles Coldwell dcc57f
                (modify-syntax-entry ?# "< b" php-mode-syntax-table)
Charles Coldwell dcc57f
                (modify-syntax-entry ?\n "> b" php-mode-syntax-table)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (make-local-variable 'font-lock-defaults)
Charles Coldwell dcc57f
  (setq font-lock-defaults
Charles Coldwell dcc57f
        '((php-font-lock-keywords-1
Charles Coldwell dcc57f
           php-font-lock-keywords-2
Charles Coldwell dcc57f
           ;; Comment-out the next line if the font-coloring is too
Charles Coldwell dcc57f
           ;; extreme/ugly for you.
Charles Coldwell dcc57f
           php-font-lock-keywords-3)
Charles Coldwell dcc57f
          nil                               ; KEYWORDS-ONLY
Charles Coldwell dcc57f
          t                                 ; CASE-FOLD
Charles Coldwell dcc57f
          nil                               ; SYNTAX-ALIST
Charles Coldwell dcc57f
          nil))                             ; SYNTAX-BEGIN
Charles Coldwell dcc57f
  (modify-syntax-entry ?# "< b" php-mode-syntax-table)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  ;; Electric behaviour must be turned off, they do not work since
Charles Coldwell dcc57f
  ;; they can not find the correct syntax in embedded PHP.
Charles Coldwell dcc57f
  ;;
Charles Coldwell dcc57f
  ;; Seems to work with narrowing so let it be on if the user prefers it.
Charles Coldwell dcc57f
  ;;(setq c-electric-flag nil)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (setq font-lock-maximum-decoration t
Charles Coldwell dcc57f
        case-fold-search t              ; PHP vars are case-sensitive
Charles Coldwell dcc57f
        imenu-generic-expression php-imenu-generic-expression)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  ;; Do not force newline at end of file.  Such newlines can cause
Charles Coldwell dcc57f
  ;; trouble if the PHP file is included in another file before calls
Charles Coldwell dcc57f
  ;; to header() or cookie().
Charles Coldwell dcc57f
  (set (make-local-variable 'require-final-newline) nil)
Charles Coldwell dcc57f
  (set (make-local-variable 'next-line-add-newlines) nil)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  ;; PEAR coding standards
Charles Coldwell dcc57f
  (add-hook 'php-mode-pear-hook
Charles Coldwell dcc57f
	    (lambda ()
Charles Coldwell dcc57f
	      (set (make-local-variable 'tab-width) 4)
Charles Coldwell dcc57f
	      (set (make-local-variable 'c-basic-offset) 4)
Charles Coldwell dcc57f
	      (set (make-local-variable 'indent-tabs-mode) nil)
Charles Coldwell dcc57f
	      (c-set-offset 'block-open' - )
Charles Coldwell dcc57f
	      (c-set-offset 'block-close' 0 )) nil t)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (if (or php-mode-force-pear
Charles Coldwell dcc57f
          (and (stringp buffer-file-name)
Charles Coldwell dcc57f
               (string-match "PEAR\\|pear"
Charles Coldwell dcc57f
                             (buffer-file-name))
Charles Coldwell dcc57f
               (string-match "\\.php$" (buffer-file-name))))
Charles Coldwell dcc57f
      (run-hooks 'php-mode-pear-hook))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (setq indent-line-function 'php-cautious-indent-line)
Charles Coldwell dcc57f
  (setq indent-region-function 'php-cautious-indent-region)
Charles Coldwell dcc57f
  (setq c-special-indent-hook nil)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (set (make-local-variable 'beginning-of-defun-function)
Charles Coldwell dcc57f
       'php-beginning-of-defun)
Charles Coldwell dcc57f
  (set (make-local-variable 'end-of-defun-function)
Charles Coldwell dcc57f
       'php-end-of-defun)
Charles Coldwell dcc57f
  (set (make-local-variable 'open-paren-in-column-0-is-defun-start)
Charles Coldwell dcc57f
       nil)
Charles Coldwell dcc57f
  (set (make-local-variable 'defun-prompt-regexp)
Charles Coldwell dcc57f
       "^\\s *function\\s +&?\\(\\(\\sw\\|\\s_\\)+\\)\\s *")
Charles Coldwell dcc57f
  (set (make-local-variable 'add-log-current-defun-header-regexp)
Charles Coldwell dcc57f
       php-beginning-of-defun-regexp)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
  (run-hooks 'php-mode-hook))
Charles Coldwell dcc57f

Charles Coldwell dcc57f
;; Make a menu keymap (with a prompt string)
Charles Coldwell dcc57f
;; and make it the menu bar item's definition.
Charles Coldwell dcc57f
(define-key php-mode-map [menu-bar] (make-sparse-keymap))
Charles Coldwell dcc57f
(define-key php-mode-map [menu-bar php]
Charles Coldwell dcc57f
  (cons "PHP" (make-sparse-keymap "PHP")))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define specific subcommands in this menu.
Charles Coldwell dcc57f
(define-key php-mode-map [menu-bar php complete-function]
Charles Coldwell dcc57f
  '("Complete function name" . php-complete-function))
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  [menu-bar php browse-manual]
Charles Coldwell dcc57f
  '("Browse manual" . php-browse-manual))
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  [menu-bar php search-documentation]
Charles Coldwell dcc57f
  '("Search documentation" . php-search-documentation))
Charles Coldwell dcc57f

Charles Coldwell dcc57f
;; Define function name completion function
Charles Coldwell dcc57f
(defun php-complete-function ()
Charles Coldwell dcc57f
  "Perform function completion on the text around point.
Charles Coldwell dcc57f
Completes to the set of names listed in the current tags table
Charles Coldwell dcc57f
and the standard php functions.
Charles Coldwell dcc57f
The string to complete is chosen in the same way as the default
Charles Coldwell dcc57f
for \\[find-tag] (which see)."
Charles Coldwell dcc57f
  (interactive)
Charles Coldwell dcc57f
  (let ((pattern (php-get-pattern))
Charles Coldwell dcc57f
        beg
Charles Coldwell dcc57f
        completion
Charles Coldwell dcc57f
        (php-functions (php-completion-table)))
Charles Coldwell dcc57f
    (if (not pattern) (message "Nothing to complete")
Charles Coldwell dcc57f
        (search-backward pattern)
Charles Coldwell dcc57f
        (setq beg (point))
Charles Coldwell dcc57f
        (forward-char (length pattern))
Charles Coldwell dcc57f
        (setq completion (try-completion pattern php-functions nil))
Charles Coldwell dcc57f
        (cond ((eq completion t))
Charles Coldwell dcc57f
              ((null completion)
Charles Coldwell dcc57f
               (message "Can't find completion for \"%s\"" pattern)
Charles Coldwell dcc57f
               (ding))
Charles Coldwell dcc57f
              ((not (string= pattern completion))
Charles Coldwell dcc57f
               (delete-region beg (point))
Charles Coldwell dcc57f
               (insert completion))
Charles Coldwell dcc57f
              (t
Charles Coldwell dcc57f
               (message "Making completion list...")
Charles Coldwell dcc57f
               (with-output-to-temp-buffer "*Completions*"
Charles Coldwell dcc57f
                 (display-completion-list
Charles Coldwell dcc57f
                  (all-completions pattern php-functions)))
Charles Coldwell dcc57f
               (message "Making completion list...%s" "done"))))))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Build php-completion-table on demand.  The table includes the
Charles Coldwell dcc57f
;; PHP functions and the tags from the current tags-file-name
Charles Coldwell dcc57f
(defun php-completion-table ()
Charles Coldwell dcc57f
  (or (and tags-file-name
Charles Coldwell dcc57f
           (save-excursion (tags-verify-table tags-file-name))
Charles Coldwell dcc57f
           php-completion-table)
Charles Coldwell dcc57f
      (let ((tags-table
Charles Coldwell dcc57f
             (if (and tags-file-name
Charles Coldwell dcc57f
                      (functionp 'etags-tags-completion-table))
Charles Coldwell dcc57f
                 (with-current-buffer (get-file-buffer tags-file-name)
Charles Coldwell dcc57f
                   (etags-tags-completion-table))
Charles Coldwell dcc57f
               nil))
Charles Coldwell dcc57f
            (php-table
Charles Coldwell dcc57f
             (cond ((and (not (string= "" php-completion-file))
Charles Coldwell dcc57f
                         (file-readable-p php-completion-file))
Charles Coldwell dcc57f
                    (php-build-table-from-file php-completion-file))
Charles Coldwell dcc57f
                   (php-manual-path
Charles Coldwell dcc57f
                    (php-build-table-from-path php-manual-path))
Charles Coldwell dcc57f
                   (t nil))))
Charles Coldwell dcc57f
        (unless (or php-table tags-table)
Charles Coldwell dcc57f
          (error
Charles Coldwell dcc57f
           (concat "No TAGS file active nor are "
Charles Coldwell dcc57f
                   "`php-completion-file' or `php-manual-path' set")))
Charles Coldwell dcc57f
        (when tags-table
Charles Coldwell dcc57f
          ;; Combine the tables.
Charles Coldwell dcc57f
          (mapatoms (lambda (sym) (intern (symbol-name sym) php-table))
Charles Coldwell dcc57f
                    tags-table))
Charles Coldwell dcc57f
        (setq php-completion-table php-table))))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-build-table-from-file (filename)
Charles Coldwell dcc57f
  (let ((table (make-vector 1022 0))
Charles Coldwell dcc57f
        (buf (find-file-noselect filename)))
Charles Coldwell dcc57f
    (save-excursion
Charles Coldwell dcc57f
      (set-buffer buf)
Charles Coldwell dcc57f
      (goto-char (point-min))
Charles Coldwell dcc57f
      (while (re-search-forward
Charles Coldwell dcc57f
              "^\\([-a-zA-Z0-9_.]+\\)\n"
Charles Coldwell dcc57f
              nil t)
Charles Coldwell dcc57f
        (intern (buffer-substring (match-beginning 1) (match-end 1))
Charles Coldwell dcc57f
                table)))
Charles Coldwell dcc57f
    (kill-buffer buf)
Charles Coldwell dcc57f
    table))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-build-table-from-path (path)
Charles Coldwell dcc57f
  (let ((table (make-vector 1022 0))
Charles Coldwell dcc57f
        (files (directory-files
Charles Coldwell dcc57f
                path
Charles Coldwell dcc57f
                nil
Charles Coldwell dcc57f
                "^function\\..+\\.html$")))
Charles Coldwell dcc57f
    (mapc (lambda (file)
Charles Coldwell dcc57f
            (string-match "\\.\\([-a-zA-Z_0-9]+\\)\\.html$" file)
Charles Coldwell dcc57f
            (intern
Charles Coldwell dcc57f
             (replace-regexp-in-string
Charles Coldwell dcc57f
              "-" "_" (substring file (match-beginning 1) (match-end 1)) t)
Charles Coldwell dcc57f
             table))
Charles Coldwell dcc57f
          files)
Charles Coldwell dcc57f
    table))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Find the pattern we want to complete
Charles Coldwell dcc57f
;; find-tag-default from GNU Emacs etags.el
Charles Coldwell dcc57f
(defun php-get-pattern ()
Charles Coldwell dcc57f
  (save-excursion
Charles Coldwell dcc57f
    (while (looking-at "\\sw\\|\\s_")
Charles Coldwell dcc57f
      (forward-char 1))
Charles Coldwell dcc57f
    (if (or (re-search-backward "\\sw\\|\\s_"
Charles Coldwell dcc57f
				(save-excursion (beginning-of-line) (point))
Charles Coldwell dcc57f
				t)
Charles Coldwell dcc57f
	    (re-search-forward "\\(\\sw\\|\\s_\\)+"
Charles Coldwell dcc57f
			       (save-excursion (end-of-line) (point))
Charles Coldwell dcc57f
			       t))
Charles Coldwell dcc57f
	(progn (goto-char (match-end 0))
Charles Coldwell dcc57f
	       (buffer-substring-no-properties
Charles Coldwell dcc57f
                (point)
Charles Coldwell dcc57f
                (progn (forward-sexp -1)
Charles Coldwell dcc57f
                       (while (looking-at "\\s'")
Charles Coldwell dcc57f
                         (forward-char 1))
Charles Coldwell dcc57f
                       (point))))
Charles Coldwell dcc57f
      nil)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defun php-show-arglist ()
Charles Coldwell dcc57f
  (interactive)
Charles Coldwell dcc57f
  (let* ((tagname (php-get-pattern))
Charles Coldwell dcc57f
         (buf (find-tag-noselect tagname nil nil))
Charles Coldwell dcc57f
         arglist)
Charles Coldwell dcc57f
    (save-excursion
Charles Coldwell dcc57f
      (set-buffer buf)
Charles Coldwell dcc57f
      (goto-char (point-min))
Charles Coldwell dcc57f
      (when (re-search-forward
Charles Coldwell dcc57f
             (format "function[ \t]+%s[ \t]*(\\([^{]*\\))" tagname)
Charles Coldwell dcc57f
             nil t)
Charles Coldwell dcc57f
        (setq arglist (buffer-substring-no-properties
Charles Coldwell dcc57f
                       (match-beginning 1) (match-end 1)))))
Charles Coldwell dcc57f
    (if arglist
Charles Coldwell dcc57f
        (message "Arglist for %s: %s" tagname arglist)
Charles Coldwell dcc57f
        (message "unknown function: %s" tagname))))
Charles Coldwell dcc57f

Charles Coldwell dcc57f
;; Define function documentation function
Charles Coldwell dcc57f
(defun php-search-documentation ()
Charles Coldwell dcc57f
  "Search PHP documentation for the word at the point."
Charles Coldwell dcc57f
  (interactive)
Charles Coldwell dcc57f
  (browse-url (concat php-search-url (current-word t))))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define function for browsing manual
Charles Coldwell dcc57f
(defun php-browse-manual ()
Charles Coldwell dcc57f
  "Bring up manual for PHP."
Charles Coldwell dcc57f
  (interactive)
Charles Coldwell dcc57f
  (browse-url php-manual-url))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define shortcut
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  "\C-c\C-f"
Charles Coldwell dcc57f
  'php-search-documentation)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define shortcut
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  [(meta tab)]
Charles Coldwell dcc57f
  'php-complete-function)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define shortcut
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  "\C-c\C-m"
Charles Coldwell dcc57f
  'php-browse-manual)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define shortcut
Charles Coldwell dcc57f
(define-key php-mode-map
Charles Coldwell dcc57f
  '[(control .)]
Charles Coldwell dcc57f
  'php-show-arglist)
Charles Coldwell dcc57f

Charles Coldwell dcc57f
(defconst php-constants
Charles Coldwell dcc57f
  (eval-when-compile
Charles Coldwell dcc57f
    (regexp-opt
Charles Coldwell dcc57f
     '(;; core constants
Charles Coldwell dcc57f
       "__LINE__" "__FILE__"
Charles Coldwell dcc57f
       "__FUNCTION__" "__CLASS__" "__METHOD__"
Charles Coldwell dcc57f
       "PHP_OS" "PHP_VERSION"
Charles Coldwell dcc57f
       "TRUE" "FALSE" "NULL"
Charles Coldwell dcc57f
       "E_ERROR" "E_NOTICE" "E_PARSE" "E_WARNING" "E_ALL" "E_STRICT"
Charles Coldwell dcc57f
       "E_USER_ERROR" "E_USER_WARNING" "E_USER_NOTICE"
Charles Coldwell dcc57f
       "DEFAULT_INCLUDE_PATH" "PEAR_INSTALL_DIR" "PEAR_EXTENSION_DIR"
Charles Coldwell dcc57f
       "PHP_BINDIR" "PHP_LIBDIR" "PHP_DATADIR" "PHP_SYSCONFDIR"
Charles Coldwell dcc57f
       "PHP_LOCALSTATEDIR" "PHP_CONFIG_FILE_PATH"
Charles Coldwell dcc57f
       "PHP_EOL"
Charles Coldwell dcc57f
Charles Coldwell dcc57f
       ;; from ext/standard:
Charles Coldwell dcc57f
       "EXTR_OVERWRITE" "EXTR_SKIP" "EXTR_PREFIX_SAME"
Charles Coldwell dcc57f
       "EXTR_PREFIX_ALL" "EXTR_PREFIX_INVALID" "SORT_ASC" "SORT_DESC"
Charles Coldwell dcc57f
       "SORT_REGULAR" "SORT_NUMERIC" "SORT_STRING" "ASSERT_ACTIVE"
Charles Coldwell dcc57f
       "ASSERT_CALLBACK" "ASSERT_BAIL" "ASSERT_WARNING"
Charles Coldwell dcc57f
       "ASSERT_QUIET_EVAL" "CONNECTION_ABORTED" "CONNECTION_NORMAL"
Charles Coldwell dcc57f
       "CONNECTION_TIMEOUT" "M_E" "M_LOG2E" "M_LOG10E" "M_LN2"
Charles Coldwell dcc57f
       "M_LN10" "M_PI" "M_PI_2" "M_PI_4" "M_1_PI" "M_2_PI"
Charles Coldwell dcc57f
       "M_2_SQRTPI" "M_SQRT2" "M_SQRT1_2" "CRYPT_SALT_LENGTH"
Charles Coldwell dcc57f
       "CRYPT_STD_DES" "CRYPT_EXT_DES" "CRYPT_MD5" "CRYPT_BLOWFISH"
Charles Coldwell dcc57f
       "DIRECTORY_SEPARATOR" "SEEK_SET" "SEEK_CUR" "SEEK_END"
Charles Coldwell dcc57f
       "LOCK_SH" "LOCK_EX" "LOCK_UN" "LOCK_NB" "HTML_SPECIALCHARS"
Charles Coldwell dcc57f
       "HTML_ENTITIES" "ENT_COMPAT" "ENT_QUOTES" "ENT_NOQUOTES"
Charles Coldwell dcc57f
       "INFO_GENERAL" "INFO_CREDITS" "INFO_CONFIGURATION"
Charles Coldwell dcc57f
       "INFO_ENVIRONMENT" "INFO_VARIABLES" "INFO_LICENSE" "INFO_ALL"
Charles Coldwell dcc57f
       "CREDITS_GROUP" "CREDITS_GENERAL" "CREDITS_SAPI"
Charles Coldwell dcc57f
       "CREDITS_MODULES" "CREDITS_DOCS" "CREDITS_FULLPAGE"
Charles Coldwell dcc57f
       "CREDITS_QA" "CREDITS_ALL" "PHP_OUTPUT_HANDLER_START"
Charles Coldwell dcc57f
       "PHP_OUTPUT_HANDLER_CONT" "PHP_OUTPUT_HANDLER_END"
Charles Coldwell dcc57f
       "STR_PAD_LEFT" "STR_PAD_RIGHT" "STR_PAD_BOTH"
Charles Coldwell dcc57f
       "PATHINFO_DIRNAME" "PATHINFO_BASENAME" "PATHINFO_EXTENSION"
Charles Coldwell dcc57f
       "CHAR_MAX" "LC_CTYPE" "LC_NUMERIC" "LC_TIME" "LC_COLLATE"
Charles Coldwell dcc57f
       "LC_MONETARY" "LC_ALL" "LC_MESSAGES" "LOG_EMERG" "LOG_ALERT"
Charles Coldwell dcc57f
       "LOG_CRIT" "LOG_ERR" "LOG_WARNING" "LOG_NOTICE" "LOG_INFO"
Charles Coldwell dcc57f
       "LOG_DEBUG" "LOG_KERN" "LOG_USER" "LOG_MAIL" "LOG_DAEMON"
Charles Coldwell dcc57f
       "LOG_AUTH" "LOG_SYSLOG" "LOG_LPR" "LOG_NEWS" "LOG_UUCP"
Charles Coldwell dcc57f
       "LOG_CRON" "LOG_AUTHPRIV" "LOG_LOCAL0" "LOG_LOCAL1"
Charles Coldwell dcc57f
       "LOG_LOCAL2" "LOG_LOCAL3" "LOG_LOCAL4" "LOG_LOCAL5"
Charles Coldwell dcc57f
       "LOG_LOCAL6" "LOG_LOCAL7" "LOG_PID" "LOG_CONS" "LOG_ODELAY"
Charles Coldwell dcc57f
       "LOG_NDELAY" "LOG_NOWAIT" "LOG_PERROR"
Charles Coldwell dcc57f
Charles Coldwell dcc57f
       ;; Disabled by default because they slow buffer loading
Charles Coldwell dcc57f
       ;; If you have use for them, uncomment the strings
Charles Coldwell dcc57f
       ;; that you want colored.
Charles Coldwell dcc57f
       ;; To compile, you may have to increase 'max-specpdl-size'
Charles Coldwell dcc57f
Charles Coldwell dcc57f
       ;; from other bundled extensions:
Charles Coldwell dcc57f
;        "CAL_EASTER_TO_xxx" "VT_NULL" "VT_EMPTY" "VT_UI1" "VT_I2"
Charles Coldwell dcc57f
;        "VT_I4" "VT_R4" "VT_R8" "VT_BOOL" "VT_ERROR" "VT_CY" "VT_DATE"
Charles Coldwell dcc57f
;        "VT_BSTR" "VT_DECIMAL" "VT_UNKNOWN" "VT_DISPATCH" "VT_VARIANT"
Charles Coldwell dcc57f
;        "VT_I1" "VT_UI2" "VT_UI4" "VT_INT" "VT_UINT" "VT_ARRAY"
Charles Coldwell dcc57f
;        "VT_BYREF" "CP_ACP" "CP_MACCP" "CP_OEMCP" "CP_SYMBOL"
Charles Coldwell dcc57f
;        "CP_THREAD_ACP" "CP_UTF7" "CP_UTF8" "CPDF_PM_NONE"
Charles Coldwell dcc57f
;        "CPDF_PM_OUTLINES" "CPDF_PM_THUMBS" "CPDF_PM_FULLSCREEN"
Charles Coldwell dcc57f
;        "CPDF_PL_SINGLE" "CPDF_PL_1COLUMN" "CPDF_PL_2LCOLUMN"
Charles Coldwell dcc57f
;        "CPDF_PL_2RCOLUMN" "CURLOPT_PORT" "CURLOPT_FILE"
Charles Coldwell dcc57f
;        "CURLOPT_INFILE" "CURLOPT_INFILESIZE" "CURLOPT_URL"
Charles Coldwell dcc57f
;        "CURLOPT_PROXY" "CURLOPT_VERBOSE" "CURLOPT_HEADER"
Charles Coldwell dcc57f
;        "CURLOPT_HTTPHEADER" "CURLOPT_NOPROGRESS" "CURLOPT_NOBODY"
Charles Coldwell dcc57f
;        "CURLOPT_FAILONERROR" "CURLOPT_UPLOAD" "CURLOPT_POST"
Charles Coldwell dcc57f
;        "CURLOPT_FTPLISTONLY" "CURLOPT_FTPAPPEND" "CURLOPT_NETRC"
Charles Coldwell dcc57f
;        "CURLOPT_FOLLOWLOCATION" "CURLOPT_FTPASCII" "CURLOPT_PUT"
Charles Coldwell dcc57f
;        "CURLOPT_MUTE" "CURLOPT_USERPWD" "CURLOPT_PROXYUSERPWD"
Charles Coldwell dcc57f
;        "CURLOPT_RANGE" "CURLOPT_TIMEOUT" "CURLOPT_POSTFIELDS"
Charles Coldwell dcc57f
;        "CURLOPT_REFERER" "CURLOPT_USERAGENT" "CURLOPT_FTPPORT"
Charles Coldwell dcc57f
;        "CURLOPT_LOW_SPEED_LIMIT" "CURLOPT_LOW_SPEED_TIME"
Charles Coldwell dcc57f
;        "CURLOPT_RESUME_FROM" "CURLOPT_COOKIE" "CURLOPT_SSLCERT"
Charles Coldwell dcc57f
;        "CURLOPT_SSLCERTPASSWD" "CURLOPT_WRITEHEADER"
Charles Coldwell dcc57f
;        "CURLOPT_COOKIEFILE" "CURLOPT_SSLVERSION"
Charles Coldwell dcc57f
;        "CURLOPT_TIMECONDITION" "CURLOPT_TIMEVALUE"
Charles Coldwell dcc57f
;        "CURLOPT_CUSTOMREQUEST" "CURLOPT_STDERR" "CURLOPT_TRANSFERTEXT"
Charles Coldwell dcc57f
;        "CURLOPT_RETURNTRANSFER" "CURLOPT_QUOTE" "CURLOPT_POSTQUOTE"
Charles Coldwell dcc57f
;        "CURLOPT_INTERFACE" "CURLOPT_KRB4LEVEL"
Charles Coldwell dcc57f
;        "CURLOPT_HTTPPROXYTUNNEL" "CURLOPT_FILETIME"
Charles Coldwell dcc57f
;        "CURLOPT_WRITEFUNCTION" "CURLOPT_READFUNCTION"
Charles Coldwell dcc57f
;        "CURLOPT_PASSWDFUNCTION" "CURLOPT_HEADERFUNCTION"
Charles Coldwell dcc57f
;        "CURLOPT_MAXREDIRS" "CURLOPT_MAXCONNECTS" "CURLOPT_CLOSEPOLICY"
Charles Coldwell dcc57f
;        "CURLOPT_FRESH_CONNECT" "CURLOPT_FORBID_REUSE"
Charles Coldwell dcc57f
;        "CURLOPT_RANDOM_FILE" "CURLOPT_EGDSOCKET"
Charles Coldwell dcc57f
;        "CURLOPT_CONNECTTIMEOUT" "CURLOPT_SSL_VERIFYPEER"
Charles Coldwell dcc57f
;        "CURLOPT_CAINFO" "CURLOPT_BINARYTRANSER"
Charles Coldwell dcc57f
;        "CURLCLOSEPOLICY_LEAST_RECENTLY_USED" "CURLCLOSEPOLICY_OLDEST"
Charles Coldwell dcc57f
;        "CURLINFO_EFFECTIVE_URL" "CURLINFO_HTTP_CODE"
Charles Coldwell dcc57f
;        "CURLINFO_HEADER_SIZE" "CURLINFO_REQUEST_SIZE"
Charles Coldwell dcc57f
;        "CURLINFO_TOTAL_TIME" "CURLINFO_NAMELOOKUP_TIME"
Charles Coldwell dcc57f
;        "CURLINFO_CONNECT_TIME" "CURLINFO_PRETRANSFER_TIME"
Charles Coldwell dcc57f
;        "CURLINFO_SIZE_UPLOAD" "CURLINFO_SIZE_DOWNLOAD"
Charles Coldwell dcc57f
;        "CURLINFO_SPEED_DOWNLOAD" "CURLINFO_SPEED_UPLOAD"
Charles Coldwell dcc57f
;        "CURLINFO_FILETIME" "CURLE_OK" "CURLE_UNSUPPORTED_PROTOCOL"
Charles Coldwell dcc57f
;        "CURLE_FAILED_INIT" "CURLE_URL_MALFORMAT"
Charles Coldwell dcc57f
;        "CURLE_URL_MALFORMAT_USER" "CURLE_COULDNT_RESOLVE_PROXY"
Charles Coldwell dcc57f
;        "CURLE_COULDNT_RESOLVE_HOST" "CURLE_COULDNT_CONNECT"
Charles Coldwell dcc57f
;        "CURLE_FTP_WEIRD_SERVER_REPLY" "CURLE_FTP_ACCESS_DENIED"
Charles Coldwell dcc57f
;        "CURLE_FTP_USER_PASSWORD_INCORRECT"
Charles Coldwell dcc57f
;        "CURLE_FTP_WEIRD_PASS_REPLY" "CURLE_FTP_WEIRD_USER_REPLY"
Charles Coldwell dcc57f
;        "CURLE_FTP_WEIRD_PASV_REPLY" "CURLE_FTP_WEIRD_227_FORMAT"
Charles Coldwell dcc57f
;        "CURLE_FTP_CANT_GET_HOST" "CURLE_FTP_CANT_RECONNECT"
Charles Coldwell dcc57f
;        "CURLE_FTP_COULDNT_SET_BINARY" "CURLE_PARTIAL_FILE"
Charles Coldwell dcc57f
;        "CURLE_FTP_COULDNT_RETR_FILE" "CURLE_FTP_WRITE_ERROR"
Charles Coldwell dcc57f
;        "CURLE_FTP_QUOTE_ERROR" "CURLE_HTTP_NOT_FOUND"
Charles Coldwell dcc57f
;        "CURLE_WRITE_ERROR" "CURLE_MALFORMAT_USER"
Charles Coldwell dcc57f
;        "CURLE_FTP_COULDNT_STOR_FILE" "CURLE_READ_ERROR"
Charles Coldwell dcc57f
;        "CURLE_OUT_OF_MEMORY" "CURLE_OPERATION_TIMEOUTED"
Charles Coldwell dcc57f
;        "CURLE_FTP_COULDNT_SET_ASCII" "CURLE_FTP_PORT_FAILED"
Charles Coldwell dcc57f
;        "CURLE_FTP_COULDNT_USE_REST" "CURLE_FTP_COULDNT_GET_SIZE"
Charles Coldwell dcc57f
;        "CURLE_HTTP_RANGE_ERROR" "CURLE_HTTP_POST_ERROR"
Charles Coldwell dcc57f
;        "CURLE_SSL_CONNECT_ERROR" "CURLE_FTP_BAD_DOWNLOAD_RESUME"
Charles Coldwell dcc57f
;        "CURLE_FILE_COULDNT_READ_FILE" "CURLE_LDAP_CANNOT_BIND"
Charles Coldwell dcc57f
;        "CURLE_LDAP_SEARCH_FAILED" "CURLE_LIBRARY_NOT_FOUND"
Charles Coldwell dcc57f
;        "CURLE_FUNCTION_NOT_FOUND" "CURLE_ABORTED_BY_CALLBACK"
Charles Coldwell dcc57f
;        "CURLE_BAD_FUNCTION_ARGUMENT" "CURLE_BAD_CALLING_ORDER"
Charles Coldwell dcc57f
;        "CURLE_HTTP_PORT_FAILED" "CURLE_BAD_PASSWORD_ENTERED"
Charles Coldwell dcc57f
;        "CURLE_TOO_MANY_REDIRECTS" "CURLE_UNKOWN_TELNET_OPTION"
Charles Coldwell dcc57f
;        "CURLE_TELNET_OPTION_SYNTAX" "CURLE_ALREADY_COMPLETE"
Charles Coldwell dcc57f
;        "DBX_MYSQL" "DBX_ODBC" "DBX_PGSQL" "DBX_MSSQL" "DBX_PERSISTENT"
Charles Coldwell dcc57f
;        "DBX_RESULT_INFO" "DBX_RESULT_INDEX" "DBX_RESULT_ASSOC"
Charles Coldwell dcc57f
;        "DBX_CMP_TEXT" "DBX_CMP_NUMBER" "XML_ELEMENT_NODE"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_NODE" "XML_TEXT_NODE" "XML_CDATA_SECTION_NODE"
Charles Coldwell dcc57f
;        "XML_ENTITY_REF_NODE" "XML_ENTITY_NODE" "XML_PI_NODE"
Charles Coldwell dcc57f
;        "XML_COMMENT_NODE" "XML_DOCUMENT_NODE" "XML_DOCUMENT_TYPE_NODE"
Charles Coldwell dcc57f
;        "XML_DOCUMENT_FRAG_NODE" "XML_NOTATION_NODE"
Charles Coldwell dcc57f
;        "XML_HTML_DOCUMENT_NODE" "XML_DTD_NODE" "XML_ELEMENT_DECL_NODE"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_DECL_NODE" "XML_ENTITY_DECL_NODE"
Charles Coldwell dcc57f
;        "XML_NAMESPACE_DECL_NODE" "XML_GLOBAL_NAMESPACE"
Charles Coldwell dcc57f
;        "XML_LOCAL_NAMESPACE" "XML_ATTRIBUTE_CDATA" "XML_ATTRIBUTE_ID"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_IDREF" "XML_ATTRIBUTE_IDREFS"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_ENTITY" "XML_ATTRIBUTE_NMTOKEN"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_NMTOKENS" "XML_ATTRIBUTE_ENUMERATION"
Charles Coldwell dcc57f
;        "XML_ATTRIBUTE_NOTATION" "XPATH_UNDEFINED" "XPATH_NODESET"
Charles Coldwell dcc57f
;        "XPATH_BOOLEAN" "XPATH_NUMBER" "XPATH_STRING" "XPATH_POINT"
Charles Coldwell dcc57f
;        "XPATH_RANGE" "XPATH_LOCATIONSET" "XPATH_USERS" "FBSQL_ASSOC"
Charles Coldwell dcc57f
;        "FBSQL_NUM" "FBSQL_BOTH" "FDFValue" "FDFStatus" "FDFFile"
Charles Coldwell dcc57f
;        "FDFID" "FDFFf" "FDFSetFf" "FDFClearFf" "FDFFlags" "FDFSetF"
Charles Coldwell dcc57f
;        "FDFClrF" "FDFAP" "FDFAS" "FDFAction" "FDFAA" "FDFAPRef"
Charles Coldwell dcc57f
;        "FDFIF" "FDFEnter" "FDFExit" "FDFDown" "FDFUp" "FDFFormat"
Charles Coldwell dcc57f
;        "FDFValidate" "FDFKeystroke" "FDFCalculate"
Charles Coldwell dcc57f
;        "FRIBIDI_CHARSET_UTF8" "FRIBIDI_CHARSET_8859_6"
Charles Coldwell dcc57f
;        "FRIBIDI_CHARSET_8859_8" "FRIBIDI_CHARSET_CP1255"
Charles Coldwell dcc57f
;        "FRIBIDI_CHARSET_CP1256" "FRIBIDI_CHARSET_ISIRI_3342"
Charles Coldwell dcc57f
;        "FTP_ASCII" "FTP_BINARY" "FTP_IMAGE" "FTP_TEXT" "IMG_GIF"
Charles Coldwell dcc57f
;        "IMG_JPG" "IMG_JPEG" "IMG_PNG" "IMG_WBMP" "IMG_COLOR_TILED"
Charles Coldwell dcc57f
;        "IMG_COLOR_STYLED" "IMG_COLOR_BRUSHED"
Charles Coldwell dcc57f
;        "IMG_COLOR_STYLEDBRUSHED" "IMG_COLOR_TRANSPARENT"
Charles Coldwell dcc57f
;        "IMG_ARC_ROUNDED" "IMG_ARC_PIE" "IMG_ARC_CHORD"
Charles Coldwell dcc57f
;        "IMG_ARC_NOFILL" "IMG_ARC_EDGED" "GMP_ROUND_ZERO"
Charles Coldwell dcc57f
;        "GMP_ROUND_PLUSINF" "GMP_ROUND_MINUSINF" "HW_ATTR_LANG"
Charles Coldwell dcc57f
;        "HW_ATTR_NR" "HW_ATTR_NONE" "IIS_READ" "IIS_WRITE"
Charles Coldwell dcc57f
;        "IIS_EXECUTE" "IIS_SCRIPT" "IIS_ANONYMOUS" "IIS_BASIC"
Charles Coldwell dcc57f
;        "IIS_NTLM" "NIL" "OP_DEBUG" "OP_READONLY" "OP_ANONYMOUS"
Charles Coldwell dcc57f
;        "OP_SHORTCACHE" "OP_SILENT" "OP_PROTOTYPE" "OP_HALFOPEN"
Charles Coldwell dcc57f
;        "OP_EXPUNGE" "OP_SECURE" "CL_EXPUNGE" "FT_UID" "FT_PEEK"
Charles Coldwell dcc57f
;        "FT_NOT" "FT_INTERNAL" "FT_PREFETCHTEXT" "ST_UID" "ST_SILENT"
Charles Coldwell dcc57f
;        "ST_SET" "CP_UID" "CP_MOVE" "SE_UID" "SE_FREE" "SE_NOPREFETCH"
Charles Coldwell dcc57f
;        "SO_FREE" "SO_NOSERVER" "SA_MESSAGES" "SA_RECENT" "SA_UNSEEN"
Charles Coldwell dcc57f
;        "SA_UIDNEXT" "SA_UIDVALIDITY" "SA_ALL" "LATT_NOINFERIORS"
Charles Coldwell dcc57f
;        "LATT_NOSELECT" "LATT_MARKED" "LATT_UNMARKED" "SORTDATE"
Charles Coldwell dcc57f
;        "SORTARRIVAL" "SORTFROM" "SORTSUBJECT" "SORTTO" "SORTCC"
Charles Coldwell dcc57f
;        "SORTSIZE" "TYPETEXT" "TYPEMULTIPART" "TYPEMESSAGE"
Charles Coldwell dcc57f
;        "TYPEAPPLICATION" "TYPEAUDIO" "TYPEIMAGE" "TYPEVIDEO"
Charles Coldwell dcc57f
;        "TYPEOTHER" "ENC7BIT" "ENC8BIT" "ENCBINARY" "ENCBASE64"
Charles Coldwell dcc57f
;        "ENCQUOTEDPRINTABLE" "ENCOTHER" "INGRES_ASSOC" "INGRES_NUM"
Charles Coldwell dcc57f
;        "INGRES_BOTH" "IBASE_DEFAULT" "IBASE_TEXT" "IBASE_UNIXTIME"
Charles Coldwell dcc57f
;        "IBASE_READ" "IBASE_COMMITTED" "IBASE_CONSISTENCY"
Charles Coldwell dcc57f
;        "IBASE_NOWAIT" "IBASE_TIMESTAMP" "IBASE_DATE" "IBASE_TIME"
Charles Coldwell dcc57f
;        "LDAP_DEREF_NEVER" "LDAP_DEREF_SEARCHING" "LDAP_DEREF_FINDING"
Charles Coldwell dcc57f
;        "LDAP_DEREF_ALWAYS" "LDAP_OPT_DEREF" "LDAP_OPT_SIZELIMIT"
Charles Coldwell dcc57f
;        "LDAP_OPT_TIMELIMIT" "LDAP_OPT_PROTOCOL_VERSION"
Charles Coldwell dcc57f
;        "LDAP_OPT_ERROR_NUMBER" "LDAP_OPT_REFERRALS" "LDAP_OPT_RESTART"
Charles Coldwell dcc57f
;        "LDAP_OPT_HOST_NAME" "LDAP_OPT_ERROR_STRING"
Charles Coldwell dcc57f
;        "LDAP_OPT_MATCHED_DN" "LDAP_OPT_SERVER_CONTROLS"
Charles Coldwell dcc57f
;        "LDAP_OPT_CLIENT_CONTROLS" "GSLC_SSL_NO_AUTH"
Charles Coldwell dcc57f
;        "GSLC_SSL_ONEWAY_AUTH" "GSLC_SSL_TWOWAY_AUTH" "MCAL_SUNDAY"
Charles Coldwell dcc57f
;        "MCAL_MONDAY" "MCAL_TUESDAY" "MCAL_WEDNESDAY" "MCAL_THURSDAY"
Charles Coldwell dcc57f
;        "MCAL_FRIDAY" "MCAL_SATURDAY" "MCAL_JANUARY" "MCAL_FEBRUARY"
Charles Coldwell dcc57f
;        "MCAL_MARCH" "MCAL_APRIL" "MCAL_MAY" "MCAL_JUNE" "MCAL_JULY"
Charles Coldwell dcc57f
;        "MCAL_AUGUST" "MCAL_SEPTEMBER" "MCAL_OCTOBER" "MCAL_NOVEMBER"
Charles Coldwell dcc57f
;        "MCAL_RECUR_NONE" "MCAL_RECUR_DAILY" "MCAL_RECUR_WEEKLY"
Charles Coldwell dcc57f
;        "MCAL_RECUR_MONTHLY_MDAY" "MCAL_RECUR_MONTHLY_WDAY"
Charles Coldwell dcc57f
;        "MCAL_RECUR_YEARLY" "MCAL_M_SUNDAY" "MCAL_M_MONDAY"
Charles Coldwell dcc57f
;        "MCAL_M_TUESDAY" "MCAL_M_WEDNESDAY" "MCAL_M_THURSDAY"
Charles Coldwell dcc57f
;        "MCAL_M_FRIDAY" "MCAL_M_SATURDAY" "MCAL_M_WEEKDAYS"
Charles Coldwell dcc57f
;        "MCAL_M_WEEKEND" "MCAL_M_ALLDAYS" "MCRYPT_" "MCRYPT_"
Charles Coldwell dcc57f
;        "MCRYPT_ENCRYPT" "MCRYPT_DECRYPT" "MCRYPT_DEV_RANDOM"
Charles Coldwell dcc57f
;        "MCRYPT_DEV_URANDOM" "MCRYPT_RAND" "SWFBUTTON_HIT"
Charles Coldwell dcc57f
;        "SWFBUTTON_DOWN" "SWFBUTTON_OVER" "SWFBUTTON_UP"
Charles Coldwell dcc57f
;        "SWFBUTTON_MOUSEUPOUTSIDE" "SWFBUTTON_DRAGOVER"
Charles Coldwell dcc57f
;        "SWFBUTTON_DRAGOUT" "SWFBUTTON_MOUSEUP" "SWFBUTTON_MOUSEDOWN"
Charles Coldwell dcc57f
;        "SWFBUTTON_MOUSEOUT" "SWFBUTTON_MOUSEOVER"
Charles Coldwell dcc57f
;        "SWFFILL_RADIAL_GRADIENT" "SWFFILL_LINEAR_GRADIENT"
Charles Coldwell dcc57f
;        "SWFFILL_TILED_BITMAP" "SWFFILL_CLIPPED_BITMAP"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_HASLENGTH" "SWFTEXTFIELD_NOEDIT"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_PASSWORD" "SWFTEXTFIELD_MULTILINE"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_WORDWRAP" "SWFTEXTFIELD_DRAWBOX"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_NOSELECT" "SWFTEXTFIELD_HTML"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_ALIGN_LEFT" "SWFTEXTFIELD_ALIGN_RIGHT"
Charles Coldwell dcc57f
;        "SWFTEXTFIELD_ALIGN_CENTER" "SWFTEXTFIELD_ALIGN_JUSTIFY"
Charles Coldwell dcc57f
;        "UDM_FIELD_URLID" "UDM_FIELD_URL" "UDM_FIELD_CONTENT"
Charles Coldwell dcc57f
;        "UDM_FIELD_TITLE" "UDM_FIELD_KEYWORDS" "UDM_FIELD_DESC"
Charles Coldwell dcc57f
;        "UDM_FIELD_DESCRIPTION" "UDM_FIELD_TEXT" "UDM_FIELD_SIZE"
Charles Coldwell dcc57f
;        "UDM_FIELD_RATING" "UDM_FIELD_SCORE" "UDM_FIELD_MODIFIED"
Charles Coldwell dcc57f
;        "UDM_FIELD_ORDER" "UDM_FIELD_CRC" "UDM_FIELD_CATEGORY"
Charles Coldwell dcc57f
;        "UDM_PARAM_PAGE_SIZE" "UDM_PARAM_PAGE_NUM"
Charles Coldwell dcc57f
;        "UDM_PARAM_SEARCH_MODE" "UDM_PARAM_CACHE_MODE"
Charles Coldwell dcc57f
;        "UDM_PARAM_TRACK_MODE" "UDM_PARAM_PHRASE_MODE"
Charles Coldwell dcc57f
;        "UDM_PARAM_CHARSET" "UDM_PARAM_STOPTABLE"
Charles Coldwell dcc57f
;        "UDM_PARAM_STOP_TABLE" "UDM_PARAM_STOPFILE"
Charles Coldwell dcc57f
;        "UDM_PARAM_STOP_FILE" "UDM_PARAM_WEIGHT_FACTOR"
Charles Coldwell dcc57f
;        "UDM_PARAM_WORD_MATCH" "UDM_PARAM_MAX_WORD_LEN"
Charles Coldwell dcc57f
;        "UDM_PARAM_MAX_WORDLEN" "UDM_PARAM_MIN_WORD_LEN"
Charles Coldwell dcc57f
;        "UDM_PARAM_MIN_WORDLEN" "UDM_PARAM_ISPELL_PREFIXES"
Charles Coldwell dcc57f
;        "UDM_PARAM_ISPELL_PREFIX" "UDM_PARAM_PREFIXES"
Charles Coldwell dcc57f
;        "UDM_PARAM_PREFIX" "UDM_PARAM_CROSS_WORDS"
Charles Coldwell dcc57f
;        "UDM_PARAM_CROSSWORDS" "UDM_LIMIT_CAT" "UDM_LIMIT_URL"
Charles Coldwell dcc57f
;        "UDM_LIMIT_TAG" "UDM_LIMIT_LANG" "UDM_LIMIT_DATE"
Charles Coldwell dcc57f
;        "UDM_PARAM_FOUND" "UDM_PARAM_NUM_ROWS" "UDM_PARAM_WORDINFO"
Charles Coldwell dcc57f
;        "UDM_PARAM_WORD_INFO" "UDM_PARAM_SEARCHTIME"
Charles Coldwell dcc57f
;        "UDM_PARAM_SEARCH_TIME" "UDM_PARAM_FIRST_DOC"
Charles Coldwell dcc57f
;        "UDM_PARAM_LAST_DOC" "UDM_MODE_ALL" "UDM_MODE_ANY"
Charles Coldwell dcc57f
;        "UDM_MODE_BOOL" "UDM_MODE_PHRASE" "UDM_CACHE_ENABLED"
Charles Coldwell dcc57f
;        "UDM_CACHE_DISABLED" "UDM_TRACK_ENABLED" "UDM_TRACK_DISABLED"
Charles Coldwell dcc57f
;        "UDM_PHRASE_ENABLED" "UDM_PHRASE_DISABLED"
Charles Coldwell dcc57f
;        "UDM_CROSS_WORDS_ENABLED" "UDM_CROSSWORDS_ENABLED"
Charles Coldwell dcc57f
;        "UDM_CROSS_WORDS_DISABLED" "UDM_CROSSWORDS_DISABLED"
Charles Coldwell dcc57f
;        "UDM_PREFIXES_ENABLED" "UDM_PREFIX_ENABLED"
Charles Coldwell dcc57f
;        "UDM_ISPELL_PREFIXES_ENABLED" "UDM_ISPELL_PREFIX_ENABLED"
Charles Coldwell dcc57f
;        "UDM_PREFIXES_DISABLED" "UDM_PREFIX_DISABLED"
Charles Coldwell dcc57f
;        "UDM_ISPELL_PREFIXES_DISABLED" "UDM_ISPELL_PREFIX_DISABLED"
Charles Coldwell dcc57f
;        "UDM_ISPELL_TYPE_AFFIX" "UDM_ISPELL_TYPE_SPELL"
Charles Coldwell dcc57f
;        "UDM_ISPELL_TYPE_DB" "UDM_ISPELL_TYPE_SERVER" "UDM_MATCH_WORD"
Charles Coldwell dcc57f
;        "UDM_MATCH_BEGIN" "UDM_MATCH_SUBSTR" "UDM_MATCH_END"
Charles Coldwell dcc57f
;        "MSQL_ASSOC" "MSQL_NUM" "MSQL_BOTH" "MYSQL_ASSOC" "MYSQL_NUM"
Charles Coldwell dcc57f
;        "MYSQL_BOTH" "MYSQL_USE_RESULT" "MYSQL_STORE_RESULT"
Charles Coldwell dcc57f
;        "OCI_DEFAULT" "OCI_DESCRIBE_ONLY" "OCI_COMMIT_ON_SUCCESS"
Charles Coldwell dcc57f
;        "OCI_EXACT_FETCH" "SQLT_BFILEE" "SQLT_CFILEE" "SQLT_CLOB"
Charles Coldwell dcc57f
;        "SQLT_BLOB" "SQLT_RDD" "OCI_B_SQLT_NTY" "OCI_SYSDATE"
Charles Coldwell dcc57f
;        "OCI_B_BFILE" "OCI_B_CFILEE" "OCI_B_CLOB" "OCI_B_BLOB"
Charles Coldwell dcc57f
;        "OCI_B_ROWID" "OCI_B_CURSOR" "OCI_B_BIN" "OCI_ASSOC" "OCI_NUM"
Charles Coldwell dcc57f
;        "OCI_BOTH" "OCI_RETURN_NULLS" "OCI_RETURN_LOBS"
Charles Coldwell dcc57f
;        "OCI_DTYPE_FILE" "OCI_DTYPE_LOB" "OCI_DTYPE_ROWID" "OCI_D_FILE"
Charles Coldwell dcc57f
;        "OCI_D_LOB" "OCI_D_ROWID" "ODBC_TYPE" "ODBC_BINMODE_PASSTHRU"
Charles Coldwell dcc57f
;        "ODBC_BINMODE_RETURN" "ODBC_BINMODE_CONVERT" "SQL_ODBC_CURSORS"
Charles Coldwell dcc57f
;        "SQL_CUR_USE_DRIVER" "SQL_CUR_USE_IF_NEEDED" "SQL_CUR_USE_ODBC"
Charles Coldwell dcc57f
;        "SQL_CONCURRENCY" "SQL_CONCUR_READ_ONLY" "SQL_CONCUR_LOCK"
Charles Coldwell dcc57f
;        "SQL_CONCUR_ROWVER" "SQL_CONCUR_VALUES" "SQL_CURSOR_TYPE"
Charles Coldwell dcc57f
;        "SQL_CURSOR_FORWARD_ONLY" "SQL_CURSOR_KEYSET_DRIVEN"
Charles Coldwell dcc57f
;        "SQL_CURSOR_DYNAMIC" "SQL_CURSOR_STATIC" "SQL_KEYSET_SIZE"
Charles Coldwell dcc57f
;        "SQL_CHAR" "SQL_VARCHAR" "SQL_LONGVARCHAR" "SQL_DECIMAL"
Charles Coldwell dcc57f
;        "SQL_NUMERIC" "SQL_BIT" "SQL_TINYINT" "SQL_SMALLINT"
Charles Coldwell dcc57f
;        "SQL_INTEGER" "SQL_BIGINT" "SQL_REAL" "SQL_FLOAT" "SQL_DOUBLE"
Charles Coldwell dcc57f
;        "SQL_BINARY" "SQL_VARBINARY" "SQL_LONGVARBINARY" "SQL_DATE"
Charles Coldwell dcc57f
;        "SQL_TIME" "SQL_TIMESTAMP" "SQL_TYPE_DATE" "SQL_TYPE_TIME"
Charles Coldwell dcc57f
;        "SQL_TYPE_TIMESTAMP" "SQL_BEST_ROWID" "SQL_ROWVER"
Charles Coldwell dcc57f
;        "SQL_SCOPE_CURROW" "SQL_SCOPE_TRANSACTION" "SQL_SCOPE_SESSION"
Charles Coldwell dcc57f
;        "SQL_NO_NULLS" "SQL_NULLABLE" "SQL_INDEX_UNIQUE"
Charles Coldwell dcc57f
;        "SQL_INDEX_ALL" "SQL_ENSURE" "SQL_QUICK"
Charles Coldwell dcc57f
;        "X509_PURPOSE_SSL_CLIENT" "X509_PURPOSE_SSL_SERVER"
Charles Coldwell dcc57f
;        "X509_PURPOSE_NS_SSL_SERVER" "X509_PURPOSE_SMIME_SIGN"
Charles Coldwell dcc57f
;        "X509_PURPOSE_SMIME_ENCRYPT" "X509_PURPOSE_CRL_SIGN"
Charles Coldwell dcc57f
;        "X509_PURPOSE_ANY" "PKCS7_DETACHED" "PKCS7_TEXT"
Charles Coldwell dcc57f
;        "PKCS7_NOINTERN" "PKCS7_NOVERIFY" "PKCS7_NOCHAIN"
Charles Coldwell dcc57f
;        "PKCS7_NOCERTS" "PKCS7_NOATTR" "PKCS7_BINARY" "PKCS7_NOSIGS"
Charles Coldwell dcc57f
;        "OPENSSL_PKCS1_PADDING" "OPENSSL_SSLV23_PADDING"
Charles Coldwell dcc57f
;        "OPENSSL_NO_PADDING" "OPENSSL_PKCS1_OAEP_PADDING"
Charles Coldwell dcc57f
;        "ORA_BIND_INOUT" "ORA_BIND_IN" "ORA_BIND_OUT"
Charles Coldwell dcc57f
;        "ORA_FETCHINTO_ASSOC" "ORA_FETCHINTO_NULLS"
Charles Coldwell dcc57f
;        "PREG_PATTERN_ORDER" "PREG_SET_ORDER" "PREG_SPLIT_NO_EMPTY"
Charles Coldwell dcc57f
;        "PREG_SPLIT_DELIM_CAPTURE"
Charles Coldwell dcc57f
;        "PGSQL_ASSOC" "PGSQL_NUM" "PGSQL_BOTH"
Charles Coldwell dcc57f
;        "PRINTER_COPIES" "PRINTER_MODE" "PRINTER_TITLE"
Charles Coldwell dcc57f
;        "PRINTER_DEVICENAME" "PRINTER_DRIVERVERSION"
Charles Coldwell dcc57f
;        "PRINTER_RESOLUTION_Y" "PRINTER_RESOLUTION_X" "PRINTER_SCALE"
Charles Coldwell dcc57f
;        "PRINTER_BACKGROUND_COLOR" "PRINTER_PAPER_LENGTH"
Charles Coldwell dcc57f
;        "PRINTER_PAPER_WIDTH" "PRINTER_PAPER_FORMAT"
Charles Coldwell dcc57f
;        "PRINTER_FORMAT_CUSTOM" "PRINTER_FORMAT_LETTER"
Charles Coldwell dcc57f
;        "PRINTER_FORMAT_LEGAL" "PRINTER_FORMAT_A3" "PRINTER_FORMAT_A4"
Charles Coldwell dcc57f
;        "PRINTER_FORMAT_A5" "PRINTER_FORMAT_B4" "PRINTER_FORMAT_B5"
Charles Coldwell dcc57f
;        "PRINTER_FORMAT_FOLIO" "PRINTER_ORIENTATION"
Charles Coldwell dcc57f
;        "PRINTER_ORIENTATION_PORTRAIT" "PRINTER_ORIENTATION_LANDSCAPE"
Charles Coldwell dcc57f
;        "PRINTER_TEXT_COLOR" "PRINTER_TEXT_ALIGN" "PRINTER_TA_BASELINE"
Charles Coldwell dcc57f
;        "PRINTER_TA_BOTTOM" "PRINTER_TA_TOP" "PRINTER_TA_CENTER"
Charles Coldwell dcc57f
;        "PRINTER_TA_LEFT" "PRINTER_TA_RIGHT" "PRINTER_PEN_SOLID"
Charles Coldwell dcc57f
;        "PRINTER_PEN_DASH" "PRINTER_PEN_DOT" "PRINTER_PEN_DASHDOT"
Charles Coldwell dcc57f
;        "PRINTER_PEN_DASHDOTDOT" "PRINTER_PEN_INVISIBLE"
Charles Coldwell dcc57f
;        "PRINTER_BRUSH_SOLID" "PRINTER_BRUSH_CUSTOM"
Charles Coldwell dcc57f
;        "PRINTER_BRUSH_DIAGONAL" "PRINTER_BRUSH_CROSS"
Charles Coldwell dcc57f
;        "PRINTER_BRUSH_DIAGCROSS" "PRINTER_BRUSH_FDIAGONAL"
Charles Coldwell dcc57f
;        "PRINTER_BRUSH_HORIZONTAL" "PRINTER_BRUSH_VERTICAL"
Charles Coldwell dcc57f
;        "PRINTER_FW_THIN" "PRINTER_FW_ULTRALIGHT" "PRINTER_FW_LIGHT"
Charles Coldwell dcc57f
;        "PRINTER_FW_NORMAL" "PRINTER_FW_MEDIUM" "PRINTER_FW_BOLD"
Charles Coldwell dcc57f
;        "PRINTER_FW_ULTRABOLD" "PRINTER_FW_HEAVY" "PRINTER_ENUM_LOCAL"
Charles Coldwell dcc57f
;        "PRINTER_ENUM_NAME" "PRINTER_ENUM_SHARED"
Charles Coldwell dcc57f
;        "PRINTER_ENUM_DEFAULT" "PRINTER_ENUM_CONNECTIONS"
Charles Coldwell dcc57f
;        "PRINTER_ENUM_NETWORK" "PRINTER_ENUM_REMOTE" "PSPELL_FAST"
Charles Coldwell dcc57f
;        "PSPELL_NORMAL" "PSPELL_BAD_SPELLERS" "PSPELL_RUN_TOGETHER"
Charles Coldwell dcc57f
;        "SID" "SID" "AF_UNIX" "AF_INET" "SOCK_STREAM" "SOCK_DGRAM"
Charles Coldwell dcc57f
;        "SOCK_RAW" "SOCK_SEQPACKET" "SOCK_RDM" "MSG_OOB" "MSG_WAITALL"
Charles Coldwell dcc57f
;        "MSG_PEEK" "MSG_DONTROUTE" "SO_DEBUG" "SO_REUSEADDR"
Charles Coldwell dcc57f
;        "SO_KEEPALIVE" "SO_DONTROUTE" "SO_LINGER" "SO_BROADCAST"
Charles Coldwell dcc57f
;        "SO_OOBINLINE" "SO_SNDBUF" "SO_RCVBUF" "SO_SNDLOWAT"
Charles Coldwell dcc57f
;        "SO_RCVLOWAT" "SO_SNDTIMEO" "SO_RCVTIMEO" "SO_TYPE" "SO_ERROR"
Charles Coldwell dcc57f
;        "SOL_SOCKET" "PHP_NORMAL_READ" "PHP_BINARY_READ"
Charles Coldwell dcc57f
;        "PHP_SYSTEM_READ" "SOL_TCP" "SOL_UDP" "MOD_COLOR" "MOD_MATRIX"
Charles Coldwell dcc57f
;        "TYPE_PUSHBUTTON" "TYPE_MENUBUTTON" "BSHitTest" "BSDown"
Charles Coldwell dcc57f
;        "BSOver" "BSUp" "OverDowntoIdle" "IdletoOverDown"
Charles Coldwell dcc57f
;        "OutDowntoIdle" "OutDowntoOverDown" "OverDowntoOutDown"
Charles Coldwell dcc57f
;        "OverUptoOverDown" "OverUptoIdle" "IdletoOverUp" "ButtonEnter"
Charles Coldwell dcc57f
;        "ButtonExit" "MenuEnter" "MenuExit" "XML_ERROR_NONE"
Charles Coldwell dcc57f
;        "XML_ERROR_NO_MEMORY" "XML_ERROR_SYNTAX"
Charles Coldwell dcc57f
;        "XML_ERROR_NO_ELEMENTS" "XML_ERROR_INVALID_TOKEN"
Charles Coldwell dcc57f
;        "XML_ERROR_UNCLOSED_TOKEN" "XML_ERROR_PARTIAL_CHAR"
Charles Coldwell dcc57f
;        "XML_ERROR_TAG_MISMATCH" "XML_ERROR_DUPLICATE_ATTRIBUTE"
Charles Coldwell dcc57f
;        "XML_ERROR_JUNK_AFTER_DOC_ELEMENT" "XML_ERROR_PARAM_ENTITY_REF"
Charles Coldwell dcc57f
;        "XML_ERROR_UNDEFINED_ENTITY" "XML_ERROR_RECURSIVE_ENTITY_REF"
Charles Coldwell dcc57f
;        "XML_ERROR_ASYNC_ENTITY" "XML_ERROR_BAD_CHAR_REF"
Charles Coldwell dcc57f
;        "XML_ERROR_BINARY_ENTITY_REF"
Charles Coldwell dcc57f
;        "XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF"
Charles Coldwell dcc57f
;        "XML_ERROR_MISPLACED_XML_PI" "XML_ERROR_UNKNOWN_ENCODING"
Charles Coldwell dcc57f
;        "XML_ERROR_INCORRECT_ENCODING"
Charles Coldwell dcc57f
;        "XML_ERROR_UNCLOSED_CDATA_SECTION"
Charles Coldwell dcc57f
;        "XML_ERROR_EXTERNAL_ENTITY_HANDLING" "XML_OPTION_CASE_FOLDING"
Charles Coldwell dcc57f
;        "XML_OPTION_TARGET_ENCODING" "XML_OPTION_SKIP_TAGSTART"
Charles Coldwell dcc57f
;        "XML_OPTION_SKIP_WHITE" "YPERR_BADARGS" "YPERR_BADDB"
Charles Coldwell dcc57f
;        "YPERR_BUSY" "YPERR_DOMAIN" "YPERR_KEY" "YPERR_MAP"
Charles Coldwell dcc57f
;        "YPERR_NODOM" "YPERR_NOMORE" "YPERR_PMAP" "YPERR_RESRC"
Charles Coldwell dcc57f
;        "YPERR_RPC" "YPERR_YPBIND" "YPERR_YPERR" "YPERR_YPSERV"
Charles Coldwell dcc57f
;        "YPERR_VERS" "FORCE_GZIP" "FORCE_DEFLATE"
Charles Coldwell dcc57f
Charles Coldwell dcc57f
       ;; PEAR constants
Charles Coldwell dcc57f
;        "PEAR_ERROR_RETURN" "PEAR_ERROR_PRINT" "PEAR_ERROR_TRIGGER"
Charles Coldwell dcc57f
;        "PEAR_ERROR_DIE" "PEAR_ERROR_CALLBACK" "OS_WINDOWS" "OS_UNIX"
Charles Coldwell dcc57f
;        "PEAR_OS" "DB_OK" "DB_ERROR" "DB_ERROR_SYNTAX"
Charles Coldwell dcc57f
;        "DB_ERROR_CONSTRAINT" "DB_ERROR_NOT_FOUND"
Charles Coldwell dcc57f
;        "DB_ERROR_ALREADY_EXISTS" "DB_ERROR_UNSUPPORTED"
Charles Coldwell dcc57f
;        "DB_ERROR_MISMATCH" "DB_ERROR_INVALID" "DB_ERROR_NOT_CAPABLE"
Charles Coldwell dcc57f
;        "DB_ERROR_TRUNCATED" "DB_ERROR_INVALID_NUMBER"
Charles Coldwell dcc57f
;        "DB_ERROR_INVALID_DATE" "DB_ERROR_DIVZERO"
Charles Coldwell dcc57f
;        "DB_ERROR_NODBSELECTED" "DB_ERROR_CANNOT_CREATE"
Charles Coldwell dcc57f
;        "DB_ERROR_CANNOT_DELETE" "DB_ERROR_CANNOT_DROP"
Charles Coldwell dcc57f
;        "DB_ERROR_NOSUCHTABLE" "DB_ERROR_NOSUCHFIELD"
Charles Coldwell dcc57f
;        "DB_ERROR_NEED_MORE_DATA" "DB_ERROR_NOT_LOCKED"
Charles Coldwell dcc57f
;        "DB_ERROR_VALUE_COUNT_ON_ROW" "DB_ERROR_INVALID_DSN"
Charles Coldwell dcc57f
;        "DB_ERROR_CONNECT_FAILED" "DB_WARNING" "DB_WARNING_READ_ONLY"
Charles Coldwell dcc57f
;        "DB_PARAM_SCALAR" "DB_PARAM_OPAQUE" "DB_BINMODE_PASSTHRU"
Charles Coldwell dcc57f
;        "DB_BINMODE_RETURN" "DB_BINMODE_CONVERT" "DB_FETCHMODE_DEFAULT"
Charles Coldwell dcc57f
;        "DB_FETCHMODE_ORDERED" "DB_FETCHMODE_ASSOC"
Charles Coldwell dcc57f
;        "DB_FETCHMODE_FLIPPED" "DB_GETMODE_ORDERED" "DB_GETMODE_ASSOC"
Charles Coldwell dcc57f
;        "DB_GETMODE_FLIPPED" "DB_TABLEINFO_ORDER"
Charles Coldwell dcc57f
;        "DB_TABLEINFO_ORDERTABLE" "DB_TABLEINFO_FULL"
Charles Coldwell dcc57f
Charles Coldwell dcc57f
       )))
Charles Coldwell dcc57f
  "PHP constants.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-keywords
Charles Coldwell dcc57f
  (eval-when-compile
Charles Coldwell dcc57f
    (regexp-opt
Charles Coldwell dcc57f
     ;; "class", "new" and "extends" get special treatment
Charles Coldwell dcc57f
     ;; "case" and  "default" get special treatment elsewhere
Charles Coldwell dcc57f
     '("and" "as" "break" "continue" "declare" "do" "echo" "else" "elseif"
Charles Coldwell dcc57f
       "endfor" "endforeach" "endif" "endswitch" "endwhile" "exit"
Charles Coldwell dcc57f
       "extends" "for" "foreach" "global" "if" "include" "include_once"
Charles Coldwell dcc57f
       "next" "or" "require" "require_once" "return" "static" "switch"
Charles Coldwell dcc57f
       "then" "var" "while" "xor" "private" "throw" "catch" "try"
Charles Coldwell dcc57f
       "instanceof" "catch all" "finally")))
Charles Coldwell dcc57f
  "PHP keywords.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-identifier
Charles Coldwell dcc57f
  (eval-when-compile
Charles Coldwell dcc57f
    '"[a-zA-Z\_\x7f-\xff][a-zA-Z0-9\_\x7f-\xff]*")
Charles Coldwell dcc57f
  "Characters in a PHP identifier.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-types
Charles Coldwell dcc57f
  (eval-when-compile
Charles Coldwell dcc57f
    (regexp-opt '("array" "bool" "boolean" "char" "const" "double" "float"
Charles Coldwell dcc57f
		  "int" "integer" "long" "mixed" "object" "real"
Charles Coldwell dcc57f
		  "string")))
Charles Coldwell dcc57f
  "PHP types.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-superglobals
Charles Coldwell dcc57f
  (eval-when-compile
Charles Coldwell dcc57f
    (regexp-opt '("_GET" "_POST" "_COOKIE" "_SESSION" "_ENV" "GLOBALS"
Charles Coldwell dcc57f
		  "_SERVER" "_FILES" "_REQUEST")))
Charles Coldwell dcc57f
  "PHP superglobal variables.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Set up font locking
Charles Coldwell dcc57f
(defconst php-font-lock-keywords-1
Charles Coldwell dcc57f
  (list
Charles Coldwell dcc57f
   ;; Fontify constants
Charles Coldwell dcc57f
   (cons
Charles Coldwell dcc57f
    (concat "\\<\\(" php-constants "\\)\\>")
Charles Coldwell dcc57f
    'font-lock-constant-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   ;; Fontify keywords
Charles Coldwell dcc57f
   (cons
Charles Coldwell dcc57f
    (concat "\\<\\(" php-keywords "\\)\\>")
Charles Coldwell dcc57f
    'font-lock-keyword-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   ;; Fontify keywords and targets, and case default tags.
Charles Coldwell dcc57f
   (list "\\<\\(break\\|case\\|continue\\)\\>[ \t]*\\(-?\\(?:\\sw\\|\\s_\\)+\\)?"
Charles Coldwell dcc57f
	 '(1 font-lock-keyword-face) '(2 font-lock-constant-face t t))
Charles Coldwell dcc57f
   ;; This must come after the one for keywords and targets.
Charles Coldwell dcc57f
   '(":" ("^[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)[ \t]*:[ \t]*$"
Charles Coldwell dcc57f
	  (beginning-of-line) (end-of-line)
Charles Coldwell dcc57f
	  (1 font-lock-constant-face)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   ;; treat 'print' as keyword only when not used like a function name
Charles Coldwell dcc57f
   '("\\
Charles Coldwell dcc57f
   '("\\<print\\>" . font-lock-keyword-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   ;; Fontify PHP tag
Charles Coldwell dcc57f
   '("<\\?\\(php\\)?" . font-lock-constant-face)
Charles Coldwell dcc57f
   '("\\?>" . font-lock-constant-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   ;; Fontify ASP-style tag
Charles Coldwell dcc57f
   '("<\\%\\(=\\)?" . font-lock-constant-face)
Charles Coldwell dcc57f
   '("\\%>" . font-lock-constant-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
   )
Charles Coldwell dcc57f
  "Subdued level highlighting for PHP mode.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-font-lock-keywords-2
Charles Coldwell dcc57f
  (append
Charles Coldwell dcc57f
   php-font-lock-keywords-1
Charles Coldwell dcc57f
   (list
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; class declaration
Charles Coldwell dcc57f
    '("[^_]\\<\\(class\\|interface\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
Charles Coldwell dcc57f
      (1 font-lock-keyword-face) (2 font-lock-type-face nil t))
Charles Coldwell dcc57f
    ;; handle several words specially, to include following word,
Charles Coldwell dcc57f
    ;; thereby excluding it from unknown-symbol checks later
Charles Coldwell dcc57f
    ;; FIX to handle implementing multiple
Charles Coldwell dcc57f
    ;; currently breaks on "class Foo implements Bar, Baz"
Charles Coldwell dcc57f
    '("\\<\\(new\\|extends\\|implements\\)\\s-+\\$?\\(\\(?:\\sw\\|\\s_\\)+\\)"
Charles Coldwell dcc57f
      (1 font-lock-keyword-face) (2 font-lock-type-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; function declaration
Charles Coldwell dcc57f
    '("\\<\\(function\\)\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*("
Charles Coldwell dcc57f
      (1 font-lock-keyword-face)
Charles Coldwell dcc57f
      (2 font-lock-function-name-face nil t))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; class hierarchy
Charles Coldwell dcc57f
    '("\\(self\\|parent\\)\\W" (1 font-lock-constant-face nil nil))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; method and variable features
Charles Coldwell dcc57f
    '("\\<\\(private\\|protected\\|public\\)\\s-+\\$?\\(?:\\sw\\|\\s_\\)+"
Charles Coldwell dcc57f
      (1 font-lock-keyword-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; method features
Charles Coldwell dcc57f
    '("^[ \t]*\\(abstract\\|static\\|final\\)\\s-+\\$?\\(?:\\sw\\|\\s_\\)+"
Charles Coldwell dcc57f
      (1 font-lock-keyword-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; variable features
Charles Coldwell dcc57f
    '("^[ \t]*\\(static\\|const\\)\\s-+\\$?\\(?:\\sw\\|\\s_\\)+"
Charles Coldwell dcc57f
      (1 font-lock-keyword-face))
Charles Coldwell dcc57f
    ))
Charles Coldwell dcc57f
  "Medium level highlighting for PHP mode.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-font-lock-keywords-3
Charles Coldwell dcc57f
  (append
Charles Coldwell dcc57f
   php-font-lock-keywords-2
Charles Coldwell dcc57f
   (list
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; <word> or </word> for HTML
Charles Coldwell dcc57f
    ;;'("</?\\sw+[^> ]*>" . font-lock-constant-face)
Charles Coldwell dcc57f
    ;;'("</?\\sw+[^>]*" . font-lock-constant-face)
Charles Coldwell dcc57f
    ;;'("
Charles Coldwell dcc57f
    '("</?[a-z!:]+" . font-lock-constant-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; HTML >
Charles Coldwell dcc57f
    '("<[^>]*\\(>\\)" (1 font-lock-constant-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; HTML tags
Charles Coldwell dcc57f
    '("\\(<[a-z]+\\)[[:space:]]+\\([a-z:]+=\\)[^>]*?" (1 font-lock-constant-face) (2 font-lock-constant-face) )
Charles Coldwell dcc57f
    '("\"[[:space:]]+\\([a-z:]+=\\)" (1 font-lock-constant-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; HTML entities
Charles Coldwell dcc57f
    ;;'("&\\w+;" . font-lock-variable-name-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; warn about '$' immediately after ->
Charles Coldwell dcc57f
    '("\\$\\(?:\\sw\\|\\s_\\)+->\\s-*\\(\\$\\)\\(\\(?:\\sw\\|\\s_\\)+\\)"
Charles Coldwell dcc57f
      (1 font-lock-warning-face) (2 php-default-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; warn about $word.word -- it could be a valid concatenation,
Charles Coldwell dcc57f
    ;; but without any spaces we'll assume $word->word was meant.
Charles Coldwell dcc57f
    '("\\$\\(?:\\sw\\|\\s_\\)+\\(\\.\\)\\sw"
Charles Coldwell dcc57f
      1 font-lock-warning-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; Warn about ==> instead of =>
Charles Coldwell dcc57f
    '("==+>" . font-lock-warning-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; exclude casts from bare-word treatment (may contain spaces)
Charles Coldwell dcc57f
    `(,(concat "(\\s-*\\(" php-types "\\)\\s-*)")
Charles Coldwell dcc57f
      1 font-lock-type-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; PHP5: function declarations may contain classes as parameters type
Charles Coldwell dcc57f
    `(,(concat "[(,]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-+&?\\$\\(?:\\sw\\|\\s_\\)+\\>")
Charles Coldwell dcc57f
      1 font-lock-type-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; Fontify variables and function calls
Charles Coldwell dcc57f
    '("\\$\\(this\\|that\\)\\W" (1 font-lock-constant-face nil nil))
Charles Coldwell dcc57f
    `(,(concat "\\$\\(" php-superglobals "\\)\\W")
Charles Coldwell dcc57f
      (1 font-lock-constant-face nil nil)) ; $_GET & co
Charles Coldwell dcc57f
    '("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-variable-name-face)) ; $variable
Charles Coldwell dcc57f
    '("->\\(\\(?:\\sw\\|\\s_\\)+\\)" (1 font-lock-variable-name-face t t)) ; ->variable
Charles Coldwell dcc57f
    '("->\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" . (1 php-default-face t t)) ; ->function_call
Charles Coldwell dcc57f
    '("\\(\\(?:\\sw\\|\\s_\\)+\\)::\\(?:\\sw\\|\\s_\\)+\\s-*(?" . (1 font-lock-type-face)) ; class::member
Charles Coldwell dcc57f
    '("::\\(\\(?:\\sw\\|\\s_\\)+\\>[^(]\\)" . (1 php-default-face)) ; class::constant
Charles Coldwell dcc57f
    '("\\<\\(?:\\sw\\|\\s_\\)+\\s-*[[(]" . php-default-face)	; word( or word[
Charles Coldwell dcc57f
    '("\\<[0-9]+" . php-default-face)		; number (also matches word)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ;; Warn on any words not already fontified
Charles Coldwell dcc57f
    '("\\<\\(?:\\sw\\|\\s_\\)+\\>" . font-lock-warning-face)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
    ))
Charles Coldwell dcc57f
  "Gauchy level highlighting for PHP mode.")
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Define the imenu-generic-expression for PHP mode.
Charles Coldwell dcc57f
;; To use, execute M-x imenu, then click on Functions or Classes,
Charles Coldwell dcc57f
;; then select given function/class name to go to its definition.
Charles Coldwell dcc57f
;; [Contributed by Gerrit Riessen]
Charles Coldwell dcc57f
(defvar php-imenu-generic-expression
Charles Coldwell dcc57f
 '(
Charles Coldwell dcc57f
   ("All Functions"
Charles Coldwell dcc57f
    "^\\s-*function\\s-+\\([[:alnum:]_]+\\)\\s-*(" 1)
Charles Coldwell dcc57f
   ("Classes"
Charles Coldwell dcc57f
    "^\\s-*class\\s-+\\([[:alnum:]_]+\\)\\s-*" 1)
Charles Coldwell dcc57f
   ("Public Methods"
Charles Coldwell dcc57f
    "^\\s-*public function\\s-+\\([[:alnum:]_]+\\)\\s-*(" 1)
Charles Coldwell dcc57f
   ("Protected Methods"
Charles Coldwell dcc57f
    "^\\s-*protected function\\s-+\\([[:alnum:]_]+\\)\\s-*(" 1)
Charles Coldwell dcc57f
   ("Private Methods"
Charles Coldwell dcc57f
    "^\\s-*private function\\s-+\\([[:alnum:]_]+\\)\\s-*(" 1)
Charles Coldwell dcc57f
   )
Charles Coldwell dcc57f
 "Imenu generic expression for PHP Mode. See `imenu-generic-expression'."
Charles Coldwell dcc57f
 )
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-block-stmt-1-kwds '("do" "else" "finally" "try"))
Charles Coldwell dcc57f
(defconst php-block-stmt-2-kwds
Charles Coldwell dcc57f
  '("for" "if" "while" "switch" "foreach" "elseif"  "catch all"))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-block-stmt-1-key
Charles Coldwell dcc57f
  (regexp-opt php-block-stmt-1-kwds))
Charles Coldwell dcc57f
(defconst php-block-stmt-2-key
Charles Coldwell dcc57f
  (regexp-opt php-block-stmt-2-kwds))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-class-decl-kwds '("class" "interface"))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(defconst php-class-key
Charles Coldwell dcc57f
  (concat
Charles Coldwell dcc57f
   "\\(" (regexp-opt php-class-decl-kwds) "\\)\\s +"
Charles Coldwell dcc57f
   c-symbol-key					;; Class name.
Charles Coldwell dcc57f
   "\\(\\s *extends\\s *" c-symbol-key "\\)?"	;; Name of superclass.
Charles Coldwell dcc57f
   "\\(\\s *implements *[^{]+{\\)?")) ;; List of any adopted protocols.
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Create "php-default-face" symbol for GNU Emacs so that both XEmacs
Charles Coldwell dcc57f
;; and GNU emacs can refer to the default face.
Charles Coldwell dcc57f
(unless (boundp 'php-default-face)
Charles Coldwell dcc57f
   (defvar php-default-face 'php-default-face))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;; Create faces for XEmacs
Charles Coldwell dcc57f
(when (featurep 'xemacs)
Charles Coldwell dcc57f
  (unless (boundp 'font-lock-keyword-face)
Charles Coldwell dcc57f
    (copy-face 'bold 'font-lock-keyword-face))
Charles Coldwell dcc57f
  (unless (boundp 'font-lock-constant-face)
Charles Coldwell dcc57f
    (copy-face 'font-lock-keyword-face 'font-lock-constant-face)))
Charles Coldwell dcc57f
Charles Coldwell dcc57f
(provide 'php-mode)
Charles Coldwell dcc57f
Charles Coldwell dcc57f
;;; php-mode.el ends here