 
 ;; function or method regexp
 (defconst *ojs-function-or-method-regexp*
-  "^[ \t]*\\(\\<function\\>\\|\\<method\\>[ \t]+\\w+[ \t]+\\<on\\>[ \t]+\\w+\\)([ \t]*\\w*)")
+  "^\\s-*\\(?:\\<function\\>\\s-+\\([[:word:]_]+\\)\\|\\<method\\>\\s-+\\([[:word:]_]+\\)\\s-+\\<on\\>\\s-+\\([[:word:]_]+\\)\\)\\s-*([[:word:]_,]*)")
 
 (defconst *arguments-end*
   "\\(\\w+\\)\\([ \t]*).*\\)?")

	(start (point)))
    (dolist (regexp (list-ojs-kernel-functions))
      (goto-char start)
      (setq found (or (re-search-forward regexp found t)
		      found)))
    (if (eq found end)
	nil

			(er--point-is-in-string-p)))
	  (setq last-point found-point)
	  (setq found-point (re-search-forward regexp limit errorp)))
	(if found-point
	    found-point
	  ;; reset everything
	  (progn (goto-char orig-point)
		 (set-match-data original-match-data)
		 nil)))
    (re-search-forward regexp limit errorp)))

(defun function-boundaries ()
  ;; returns either a cons of (start end) containing the beginning and the end of the function
