 ;; Factor mode:
 (defvar factor-mode-map (make-sparse-keymap)
   "Key map used by Factor mode.")
+
+(defsubst factor--beginning-of-defun (times)
+  (re-search-backward factor--regex-definition-start nil t times))
+
+(defsubst factor--end-of-defun ()
+  (re-search-forward factor--regex-definition-end nil t))
 
 ;;;###autoload
 (defun factor-mode ()

(defsubst factor--ppss-brackets-start ()
  (nth 1 (syntax-ppss)))

(defsubst factor--indentation-at (pos)
  (save-excursion (goto-char pos) (current-indentation)))

(defconst factor--regex-closing-paren "[])}]")
(defsubst factor--at-closing-paren-p ()
  (looking-at factor--regex-closing-paren))

(defsubst factor--at-first-char-p ()
  (= (- (point) (line-beginning-position)) (current-indentation)))

    "UNION:" "USE:" "USING:" "V{" "VAR:" "VARS:" "W{"))

(defconst factor--regex-parsing-words-ext
  (regexp-opt '("B" "call-next-method" "delimiter" "f" "initial:" "read-only")
              'words))

(defconst factor--declaration-words
  '("flushable" "foldable" "inline" "parsing" "recursive"))

(defconst factor--regex-declaration-words
  (regexp-opt factor--declaration-words 'words))

(defsubst factor--regex-second-word (prefixes)
  (format "^%s +\\([^ \r\n]+\\)" (regexp-opt prefixes t)))
