Merge branch 'emacs' of http://git.hacks-galore.org/jao/factor
commit
df3dee3c14
|
@ -47,7 +47,8 @@
|
||||||
(substring-no-properties (thing-at-point 'line)))))
|
(substring-no-properties (thing-at-point 'line)))))
|
||||||
(when in-usings (setq line (concat "! " line)))
|
(when in-usings (setq line (concat "! " line)))
|
||||||
(push line lines))
|
(push line lines))
|
||||||
(when (and in-usings (looking-at ".*\\_<;\\_>")) (setq in-usings nil))
|
(when (and in-usings (looking-at "\\(^\\|.* \\);\\( \\|\n\\)"))
|
||||||
|
(setq in-usings nil))
|
||||||
(forward-line))
|
(forward-line))
|
||||||
(reverse lines))))))
|
(reverse lines))))))
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
|
|
||||||
;;; Auxiliar functions:
|
;;; Auxiliar functions:
|
||||||
|
|
||||||
|
(defun fuel-edit--looking-at-vocab ()
|
||||||
|
(save-excursion
|
||||||
|
(fuel-syntax--beginning-of-defun)
|
||||||
|
(looking-at "USING:\\|USE:")))
|
||||||
|
|
||||||
(defun fuel-edit--try-edit (ret)
|
(defun fuel-edit--try-edit (ret)
|
||||||
(let* ((err (fuel-eval--retort-error ret))
|
(let* ((err (fuel-eval--retort-error ret))
|
||||||
(loc (fuel-eval--retort-result ret)))
|
(loc (fuel-eval--retort-result ret)))
|
||||||
|
@ -92,9 +97,9 @@ With prefix, asks for the word to edit."
|
||||||
(fuel-completion--read-word "Edit word: ")))
|
(fuel-completion--read-word "Edit word: ")))
|
||||||
(cmd `(:fuel* ((:quote ,word) fuel-get-edit-location)))
|
(cmd `(:fuel* ((:quote ,word) fuel-get-edit-location)))
|
||||||
(marker (and (not arg) (point-marker))))
|
(marker (and (not arg) (point-marker))))
|
||||||
(condition-case nil
|
(if (and (not arg) (fuel-edit--looking-at-vocab))
|
||||||
(fuel-edit--try-edit (fuel-eval--send/wait cmd))
|
(fuel-edit-vocabulary nil word)
|
||||||
(error (fuel-edit-vocabulary nil word)))
|
(fuel-edit--try-edit (fuel-eval--send/wait cmd)))
|
||||||
(when marker (ring-insert find-tag-marker-ring marker))))
|
(when marker (ring-insert find-tag-marker-ring marker))))
|
||||||
|
|
||||||
(defun fuel-edit-word-doc-at-point (&optional arg word)
|
(defun fuel-edit-word-doc-at-point (&optional arg word)
|
||||||
|
|
|
@ -82,12 +82,24 @@
|
||||||
((looking-at "\\(TUPLE\\|SYMBOLS\\|VARS\\): ")
|
((looking-at "\\(TUPLE\\|SYMBOLS\\|VARS\\): ")
|
||||||
'factor-font-lock-symbol)
|
'factor-font-lock-symbol)
|
||||||
(t 'default))))
|
(t 'default))))
|
||||||
|
((char-equal (char-after (nth 8 state)) ?U)
|
||||||
|
'factor-font-lock-parsing-word)
|
||||||
(t 'factor-font-lock-comment)))
|
(t 'factor-font-lock-comment)))
|
||||||
|
|
||||||
(defconst fuel-font-lock--font-lock-keywords
|
(defconst fuel-font-lock--font-lock-keywords
|
||||||
`((,fuel-syntax--stack-effect-regex . 'factor-font-lock-stack-effect)
|
`((,fuel-syntax--stack-effect-regex . 'factor-font-lock-stack-effect)
|
||||||
(,fuel-syntax--brace-words-regex 1 'factor-font-lock-parsing-word)
|
(,fuel-syntax--brace-words-regex 1 'factor-font-lock-parsing-word)
|
||||||
(,fuel-syntax--vocab-ref-regexp 2 'factor-font-lock-vocabulary-name)
|
(,fuel-syntax--vocab-ref-regexp 2 'factor-font-lock-vocabulary-name)
|
||||||
|
(,fuel-syntax--constructor-regex (1 'factor-font-lock-word)
|
||||||
|
(2 'factor-font-lock-type-name)
|
||||||
|
(3 'factor-font-lock-invalid-syntax nil t))
|
||||||
|
(,fuel-syntax--typedef-regex (1 'factor-font-lock-type-name)
|
||||||
|
(2 'factor-font-lock-type-name)
|
||||||
|
(3 'factor-font-lock-invalid-syntax nil t))
|
||||||
|
(,fuel-syntax--rename-regex (1 'factor-font-lock-word)
|
||||||
|
(2 'factor-font-lock-vocabulary-name)
|
||||||
|
(3 'factor-font-lock-word)
|
||||||
|
(4 'factor-font-lock-invalid-syntax nil t))
|
||||||
(,fuel-syntax--declaration-words-regex . 'factor-font-lock-declaration)
|
(,fuel-syntax--declaration-words-regex . 'factor-font-lock-declaration)
|
||||||
(,fuel-syntax--word-definition-regex 2 'factor-font-lock-word)
|
(,fuel-syntax--word-definition-regex 2 'factor-font-lock-word)
|
||||||
(,fuel-syntax--alias-definition-regex (1 'factor-font-lock-word)
|
(,fuel-syntax--alias-definition-regex (1 'factor-font-lock-word)
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
"QUALIFIED-WITH:" "QUALIFIED:"
|
"QUALIFIED-WITH:" "QUALIFIED:"
|
||||||
"RENAME:"
|
"RENAME:"
|
||||||
"SINGLETON:" "SLOT:" "SYMBOL:"
|
"SINGLETON:" "SLOT:" "SYMBOL:"
|
||||||
|
"TYPEDEF:"
|
||||||
"USE:"
|
"USE:"
|
||||||
"VAR:")))
|
"VAR:")))
|
||||||
|
|
||||||
|
@ -208,6 +209,15 @@
|
||||||
(format ":[^ ]* [^ ]+\\(%s\\)*" fuel-syntax--stack-effect-regex)
|
(format ":[^ ]* [^ ]+\\(%s\\)*" fuel-syntax--stack-effect-regex)
|
||||||
"M[^:]*: [^ ]+ [^ ]+"))
|
"M[^:]*: [^ ]+ [^ ]+"))
|
||||||
|
|
||||||
|
(defconst fuel-syntax--constructor-regex
|
||||||
|
"\\_<C: +\\(\\w+\\) +\\(\\w+\\)\\( .*\\)?$")
|
||||||
|
|
||||||
|
(defconst fuel-syntax--typedef-regex
|
||||||
|
"\\_<TYPEDEF: +\\(\\w+\\) +\\(\\w+\\)\\( .*\\)?$")
|
||||||
|
|
||||||
|
(defconst fuel-syntax--rename-regex
|
||||||
|
"\\_<RENAME: +\\(\\w+\\) +\\(\\w+\\) +=> +\\(\\w+\\)\\( .*\\)?$")
|
||||||
|
|
||||||
|
|
||||||
;;; Factor syntax table
|
;;; Factor syntax table
|
||||||
|
|
||||||
|
@ -239,10 +249,10 @@
|
||||||
("\\_<<\\(\"\\)\\_>" (1 "\""))
|
("\\_<<\\(\"\\)\\_>" (1 "\""))
|
||||||
("\\_<\\(\"\\)>\\_>" (1 "\""))
|
("\\_<\\(\"\\)>\\_>" (1 "\""))
|
||||||
;; Multiline constructs
|
;; Multiline constructs
|
||||||
("\\_<USING:\\( \\)\\(;\\)" (1 "<b") (2 ">b"))
|
("\\_<\\(U\\)SING: \\(;\\)" (1 "<b") (2 ">b"))
|
||||||
("\\_<USING:\\( \\)" (1 "<b"))
|
("\\_<USING:\\( \\)" (1 "<b"))
|
||||||
("\\_<TUPLE: +\\w+? +< +\\w+? *\\( \\)" (1 "<b"))
|
("\\_<TUPLE: +\\w+? +< +\\w+? *\\( \\)" (1 "<b"))
|
||||||
("\\_<\\(TUPLE\\|SYMBOLS\\|VARS\\): +\\w+? *\\( \\)\\([^<]\\|\\_>\\)" (2 "<b"))
|
("\\_<\\(TUPLE\\|SYMBOLS\\|VARS\\): +\\w+? *\\( \\)\\([^<\n]\\|\\_>\\)" (2 "<b"))
|
||||||
("\\(\n\\| \\);\\_>" (1 ">b"))
|
("\\(\n\\| \\);\\_>" (1 ">b"))
|
||||||
;; Let and lambda:
|
;; Let and lambda:
|
||||||
("\\_<\\(!(\\) .* \\()\\)" (1 "<") (2 ">"))
|
("\\_<\\(!(\\) .* \\()\\)" (1 "<") (2 ">"))
|
||||||
|
|
Loading…
Reference in New Issue