aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Courtieu2012-06-06 15:54:37 +0000
committerPierre Courtieu2012-06-06 15:54:37 +0000
commitc29f373a57dbc88dcdd47f110ce1d65b91fbb38f (patch)
tree75f02031b36dfa1c1f07d69b053e85f7a50f17b5
parentb757034be0acb8240c2b81605abdee88abcc9d7f (diff)
Fixing a bug with the indentation of qualified names.
-rw-r--r--coq/coq.el25
1 files changed, 17 insertions, 8 deletions
diff --git a/coq/coq.el b/coq/coq.el
index 9ad31e15..96ad2db0 100644
--- a/coq/coq.el
+++ b/coq/coq.el
@@ -440,31 +440,40 @@ Lemma foo: forall n,
"Parsing table for Coq. See `smie-grammar'.")
(defun coq-smie-search-token-forward (tokens &optional end)
- "Search for one of TOKENS between point and END."
+ "Search for one of TOKENS between point and END.
+Token \".\" is considered only if followed by a space."
(unless end (setq end (point-max)))
(condition-case nil
(catch 'found
(while (< (point) end)
;; The default lexer is faster and is good enough for our needs.
(let ((next (smie-default-forward-token)))
- (cond
- ((zerop (length next)) (forward-sexp 1))
- ((member next tokens) (throw 'found next))))))
+ ;; Do not consider "." when not followed by a space
+ (when (or (not (equal next "."))
+ (looking-at ".[[:space:]]"))
+ (cond
+ ((zerop (length next)) (forward-sexp 1))
+ ((member next tokens) (throw 'found next)))))))
(scan-error nil)))
(defun coq-smie-search-token-backward (tokens &optional end)
- "Search for one of TOKENS between point and END."
+ "Search for one of TOKENS between point and END.
+Token \".\" is considered only if followed by a space."
(unless end (setq end (point-min)))
(condition-case nil
(catch 'found
(while (> (point) end)
;; The default lexer is faster and is good enough for our needs.
(let ((next (smie-default-backward-token)))
- (cond
- ((zerop (length next)) (forward-sexp -1))
- ((member next tokens) (throw 'found next))))))
+ ;; Do not consider "." when not followed by a space
+ (when (or (not (equal next "."))
+ (looking-at ".[[:space:]]"))
+ (cond
+ ((zerop (length next)) (forward-sexp -1))
+ ((member next tokens) (throw 'found next)))))))
(scan-error nil)))
+
;; Lexer.
;; - We distinguish ":=" from ":= inductive" to avoid the circular precedence
;; constraint ":= < | < ; < :=" where ":= < |" is due to Inductive