]> gitweb.factorcode.org Git - factor.git/commitdiff
FUEL: readding factor-method-definition-regex
authorBjörn Lindqvist <bjourne@gmail.com>
Sat, 2 Jul 2016 13:27:33 +0000 (15:27 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Sat, 2 Jul 2016 13:51:00 +0000 (15:51 +0200)
It is needed by the fuel-refactor--def-word function.

misc/fuel/factor-mode.el
misc/fuel/fuel-refactor.el

index c810d0d293e97c5764cd881b3e2caf25ac3bcd0e..938e33a9963776b4c9dc711045ce762db7a8af13 100644 (file)
@@ -275,16 +275,17 @@ these lines in your .emacs:
 (defconst factor-bad-string-regex
   "\\_<\"[^>]\\([^\"\n]\\|\\\\\"\\)*\n")
 
-(defconst factor-word-starters
-  '(":" "::" "GENERIC:" "GENERIC#" "DEFER:" "HOOK:"
-    "MACRO:" "MACRO::" "MATH:" "MEMO:" "MEMO::"
-    "POSTPONE:" "PRIMITIVE:" "SYNTAX:" "TYPED:" "TYPED::"))
-
 (defconst factor-word-definition-regex
   (concat
-   (format "\\_<\\(%s\\)" (regexp-opt factor-word-starters))
+   (one-symbol (regexp-opt
+                '(":" "::" "GENERIC:" "GENERIC#" "DEFER:" "HOOK:"
+                  "MACRO:" "MACRO::" "MATH:" "MEMO:" "MEMO::"
+                  "POSTPONE:" "PRIMITIVE:" "SYNTAX:" "TYPED:" "TYPED::")))
    ws+ symbol))
 
+(defconst factor-method-definition-regex
+  (syntax-and-2-symbols '("M" "M:" "BEFORE" "AFTER")))
+
 ;; [parsing-word] [vocab-word]
 (defconst factor-vocab-ref-regex
   (syntax-and-1-symbol '("IN" "USE" "QUALIFIED")))
@@ -454,8 +455,7 @@ these lines in your .emacs:
     (,factor-float-regex . 'factor-font-lock-number)
     (,factor-ratio-regex . 'factor-font-lock-ratio)
     ,(factor-syntax factor-type-definition-regex '("P" "T"))
-    ,(factor-syntax (syntax-and-2-symbols '("M" "M:" "BEFORE" "AFTER"))
-                    '("P" "T" "W"))
+    ,(factor-syntax factor-method-definition-regex '("P" "T" "W"))
 
     ;; Highlights tuple and struct definitions. The TUPLE/STRUCT
     ;; parsing word, class name and optional parent classes are
index e5e2a50d27ce9b7f496e10a8ef4d52a496d89743..441160636ca07d69a145929907e4706f1698dc77 100644 (file)
@@ -213,7 +213,7 @@ The word's body is put in a new method for the generic."
   (save-excursion
     (factor-beginning-of-defun)
     (or (and (looking-at factor-method-definition-regex)
-             (match-string-no-properties 2))
+             (match-string-no-properties 3))
         (and (looking-at factor-word-definition-regex)
              (match-string-no-properties 2)))))