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