Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #618 - Support for command "Derive SuchThat As". #649

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions coq/coq-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ The point should be at the beginning of the command name."
(defun coq-is-cmdend-token (tok)
(or (coq-is-bullet-token tok) (coq-is-subproof-token tok) (coq-is-dot-token tok)))

;; Standard synonyms are better here than in the coq-smie-xxxward-token-aux functions.
(defconst coq-standard-token-synonyms
'(
("SuchThat" . ":") ("As" . ":= def") ;; For "Derive foo SuchThat bar As oof".
))

(defun coq-smie-forward-token ()
(let ((tok (coq-smie-forward-token-aux)))
(cond
Expand All @@ -461,6 +467,9 @@ The point should be at the beginning of the command name."
((assoc tok coq-smie-monadic-tokens)
(let ((res (assoc tok coq-smie-monadic-tokens)))
(cdr res)))
((assoc tok coq-standard-token-synonyms)
(let ((res (assoc tok coq-standard-token-synonyms)))
(cdr res)))
(tok))))

(defun coq-smie-forward-token-aux ()
Expand Down Expand Up @@ -639,6 +648,9 @@ The point should be at the beginning of the command name."
((assoc tok coq-smie-monadic-tokens)
(let ((res (assoc tok coq-smie-monadic-tokens)))
(cdr res)))
((assoc tok coq-standard-token-synonyms)
(let ((res (assoc tok coq-standard-token-synonyms)))
(cdr res)))
(tok))))

(defun coq-smie-backward-token-aux ()
Expand Down
8 changes: 7 additions & 1 deletion coq/coq-syntax.el
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ so for the following reasons:
("Derive Inversion" nil "Derive Inversion @{id} with # Sort #." t "Derive\\s-+Inversion")
("Derive Dependent Inversion" nil "Derive Dependent Inversion @{id} with # Sort #." t "Derive\\s-+Dependent\\s-+Inversion")
("Derive Inversion_clear" nil "Derive Inversion_clear @{id} with # Sort #." t)
("Derive SuchThat" nil "Derive @[id] SuchThat # As @{id}." t "Derive")
("Example" "ex" "Example #:# := #." t "Example");; careful
("Equations" "eqs" "Equations #:# := #." t "Equations")
("Fixpoint" "fix" "Fixpoint # (#:#) {struct @{arg}} : # :=\n#." t "Fixpoint")
Expand Down Expand Up @@ -1207,7 +1208,12 @@ different."
"using" "with" "beta" "delta" "iota" "zeta" "after" "until"
"at" "Sort" "Time" "dest" "where"
;; SSReflect user reserved.
"is" "nosimpl" "of")
"is" "nosimpl" "of"
;; Derive reserved
"SuchThat" "As" ;; I don't like these two: they start with
;; capitals but they are not at beginning of a
;; sentence
)
coq-user-reserved-db)
"Reserved keywords of Coq.")

Expand Down