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

Some fixes #137

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 18 additions & 3 deletions fstar-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ allows composition in code comments."
'("open" "module" "include" "friend"
"let" "let rec" "val" "and" "assume"
"exception" "effect" "new_effect" "sub_effect" "new_effect_for_free" "layered_effect"
"kind" "type" "class" "instance"))
"kind" "type" "class" "instance" "%splice"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add this here if you also add it below?


(defconst fstar-syntax-fsdoc-keywords
'("@author" "@summary"))
Expand All @@ -890,7 +890,7 @@ allows composition in code comments."
"Regexp matching block headers.")

(defconst fstar-syntax-block-start-re
(format "^\\(?:%s[ \n]\\)*\\(\\[@\\|%s \\)"
(format "^\\(?:%s[ \n]\\)*\\(\\[@\\|%s\\_>\\)"
(regexp-opt fstar-syntax-qualifiers)
(regexp-opt (append (remove "and" fstar-syntax-headers)
fstar-syntax-preprocessor)))
Expand Down Expand Up @@ -1123,7 +1123,7 @@ leads to the binder's start."
(defun fstar-find-subtype-annotation (bound)
"Find {...} group between point and BOUND."
(let ((found) (end))
(while (and (not found) (re-search-forward "{[^:].*}" bound t))
(while (and (not found) (re-search-forward "{[^:|].*}" bound t))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about the syntax to comment on this

(setq end (save-excursion
(goto-char (match-beginning 0))
(ignore-errors (forward-sexp))
Expand Down Expand Up @@ -1167,6 +1167,8 @@ leads to the binder's start."
(,(concat "\\_<\\(val\\) +\\(" id "\\) *:")
(1 'fstar-structure-face)
(2 'font-lock-function-name-face))
(, "%splice"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for , here

(0 'fstar-structure-face))
(,(fstar--fl-conditional-matcher fstar-syntax-block-header-re #'fstar--in-code-p)
(0 'fstar-structure-face prepend))
(fstar-find-id-with-type
Expand Down Expand Up @@ -3495,6 +3497,14 @@ into blocks; process it as one large block instead."
(let ((fstar-subp--lax t))
(fstar-subp-advance-or-retract-to-point arg)))

(defun fstar-subp-advance-to-point-max (&optional arg)
"Like `fstar-subp-advance-or-retract-to-point' on `point-max'.
Pass ARG to `fstar-subp-advance-or-retract-to-point'."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you refactor the function below to use this new one?

(interactive "P")
(fstar--widened-excursion
(goto-char (point-max))
(fstar-subp-advance-or-retract-to-point arg)))

(defun fstar-subp-advance-to-point-max-lax (&optional arg)
"Like `fstar-subp-advance-or-retract-to-point' on `point-max', in lax mode.
Pass ARG to `fstar-subp-advance-or-retract-to-point'."
Expand Down Expand Up @@ -5231,6 +5241,7 @@ Last argument must be a file name, not %S" err-header fname))
(user-error "%s
First argument must be an F* executable, not %S" err-header executable))
(with-current-buffer (find-file-existing fname)
(setq-local fstar-executable executable)
(setq-local fstar-subp-prover-args args)
(setq-local fstar-subp--default-directory command-line-default-directory)
(message "\
Expand Down Expand Up @@ -5323,6 +5334,7 @@ This is useful to spot discrepancies between the CLI and IDE frontends."
("C-c C-l" "C-S-l" fstar-subp-advance-or-retract-to-point-lax)
("C-c C-." "C-S-." fstar-subp-goto-beginning-of-unprocessed-region)
("C-c C-b" "C-S-b" fstar-subp-advance-to-point-max-lax)
("C-c C-g" "C-S-g" fstar-subp-advance-to-point-max)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A keybinding ending in C-g is going to be very very confusing, because C-g is the universal "cancel" action

("C-c C-r" "C-S-r" fstar-subp-reload-to-point)
("C-c C-x" "C-M-c" fstar-subp-kill-one-or-many)
("C-c C-c" "C-M-S-c" fstar-subp-interrupt))
Expand Down Expand Up @@ -5412,6 +5424,8 @@ This is useful to spot discrepancies between the CLI and IDE frontends."
fstar-subp-advance-or-retract-to-point]
["Typecheck everything up to point (lax)"
fstar-subp-advance-or-retract-to-point-lax]
["Typecheck whole buffer"
fstar-subp-advance-to-point-max]
["Typecheck whole buffer (lax)"
fstar-subp-advance-to-point-max-lax]
["Reload dependencies and re-typecheck up to point"
Expand Down Expand Up @@ -5488,6 +5502,7 @@ its `find-image' forms."
(define-key-after map [basic-actions-sep] '(menu-item "--"))
(add-item 'fstar-subp-advance-next "next")
(add-item 'fstar-subp-advance-next-lax "next-lax")
(add-item 'fstar-subp-advance-to-point-max "goto-end")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a corresponding picture in the repo already?

(add-item 'fstar-subp-advance-to-point-max-lax "goto-end-lax")
(add-item 'fstar-subp-reload-to-point "reload")
(define-key-after map [views-sep] '(menu-item "--"))
Expand Down