   (setq *ojs-buffers-functions-cache-regexp*
 	(format "\\(%s\\)" (js--regexp-opt-symbol (loop for item in *ojs-buffers-functions-cache*
 							 collect (car item))))))
-
+;;;;; class members in ojs2
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defconst *pjs-namespace-definition*
+  "^\\s-*namespace\\s-+\\(\\w+\\);")
+
+;; return the current namespace 
+(defun pjs-current-namespace ()
+  (save-excursion
+    (let* ((found (re-search-backward *pjs-namespace-definition* nil t))
+	   (namespace (when found (match-string-no-properties 1))))
+      (while (and found
+		  (not (eq (get-text-property (point) 'face) 'font-lock-keyword-face)))
+	(setq found (re-search-backward *pjs-namespace-definition* nil t))
+	(when found
+	  (setq namespace (match-string-no-properties 1))))
+      (if found namespace "plw"))))
+  
+
+;; contains list of cons (name . documentation)
+;; used for autocomplete 
+(defvar *pjs-buffers-class-members-cache* nil)
+;; contains the master regexp for syntax highlighting
+(defvar *pjs-buffers-class-members-cache-regexp* nil)
+
+
+(defconst *pjs-class-declaration-regexp*
+  "^\\s-*class\\s-+\\(\\w+\\)\\s-*{")
+
+(defun pjs-class-members ()
+  (or *pjs-buffers-class-members-cache*
+      (progn (generate-pjs-class-members-cache)
+	     *pjs-buffers-class-members-cache*)))
+
+(defun pjs-class-members-regexp ()
+  (or *pjs-buffers-class-members-cache-regexp*
+      (progn (generate-pjs-class-members-cache)
+	     *pjs-buffers-class-members-cache-regexp*)))
+
+(defun generate-pjs-class-members-cache ()
+  (save-excursion
+    (goto-char (point-min))
+    (unless (hash-table-p *pjs-buffers-class-members-cache*)
+      (setq *pjs-buffers-class-members-cache* (make-hash-table :test 'equal)))
+    (unless (hash-table-p *pjs-buffers-class-members-cache-regexp*)
+      (setq *pjs-buffers-class-members-cache-regexp* (make-hash-table :test 'equal)))
+    
+    (while (re-search-forward *pjs-class-declaration-regexp* nil t)
+      ;; we are at the beginning of a class
+      (let* ((class-name (match-string-no-properties 1))
+	     (namespace  (pjs-current-namespace))
+	     (members    (when (fi::lep-open-connection-p) (fi:eval-in-lisp (format "(when (fboundp 'jvs::get-pjs-class-members) (jvs::get-pjs-class-members \"%s\" \"%s\"))" class-name namespace))))
+	     )
+	(when members
+	  (puthash (format "%s.%s" namespace class-name) members *pjs-buffers-class-members-cache*)
+	  (puthash (format "%s.%s" namespace class-name) (js--regexp-opt-symbol (loop for item in members
+										      collect item))
+		   *pjs-buffers-class-members-cache-regexp*)
+	  )))))
+	 
+	 
 ;;;;; buffer dependant cache for script-level var definitions and global vars
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defconst *ojs-file-vars-regexp*  
-  "^var[ \t]+\\(\\w+\\)[ \t]*\\(=\\|in\\|;\\).*$")
+  "^var\\s-+\\(\\w+\\)\\s-*\\(=\\|in\\|;\\).*$")
+
+(defconst *pjs-file-vars-regexp*
+  "^var\\s-*\\(?:[[:word:].]+\\)?\\s-+\\(\\w+\\)\\s-*[=;].*$")
+;;  "^var\\s-+\\(\\w+\\)\\s-*\\(=\\|in\\|;\\).*$")
 
 (defconst *ojs-global-vars-regexp*  
-  "^[ \t]*global[ \t]+var[ \t]+\\(\\w+\\)[ \t]*\\(=\\|in\\|;\\).*$")
+  "^\\s-*global\\s-+var\\s-+\\(\\w+\\)\\s-*\\(=\\|in\\|;\\).*$")
 
 ;; used for autocomplete 
 (defvar *ojs-buffers-vars-cache* nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defconst *ojs-function-method-definition-regexp* 
  "^[ \t]*\\(?:function\\|method\\)[ \t]+\\(\\w+\\).*$")

;; contains list of cons (name . documentation)
;; used for autocomplete 

;;;; (:require-patch "")
;;;; HISTORY :
;;;; $Log$
;;;; Revision 3.5  2015/12/14 10:41:09  troche
;;;; * pjs class members cache
;;;;
;;;; Revision 3.4  2015/06/18 08:32:28  troche
;;;; * configuration
;;;;
