diff options
| author | Pierre Courtieu | 2012-06-06 15:54:37 +0000 |
|---|---|---|
| committer | Pierre Courtieu | 2012-06-06 15:54:37 +0000 |
| commit | c29f373a57dbc88dcdd47f110ce1d65b91fbb38f (patch) | |
| tree | 75f02031b36dfa1c1f07d69b053e85f7a50f17b5 | |
| parent | b757034be0acb8240c2b81605abdee88abcc9d7f (diff) | |
Fixing a bug with the indentation of qualified names.
| -rw-r--r-- | coq/coq.el | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -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 |
