diff options
| author | Alasdair Armstrong | 2017-07-21 17:31:08 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-07-21 17:31:08 +0100 |
| commit | 79b81722d8cfe3c2c2fa16bbc8643e8243dfa015 (patch) | |
| tree | 8505834a54e449aae18307ec5647472a4155cf72 /editors | |
| parent | b7b6ebc7da062141369d85cd263f1b07561cd396 (diff) | |
Add a prove builtin that allows testing flow typing
For example:
default Order dec
val bit[64] -> unit effect pure test64
val cast forall 'n, 'n = 32 | 'n = 64. bit['n] -> unit effect pure test
function forall 'n. unit test addr =
{
_prove(constraint('n != 16));
assert(constraint('n = 64), "64-bit mode");
_prove(constraint('n = 64));
test64(addr);
}
This doesn't affect the AST at all as _prove is just a ordinary function
that the typechecker treats specially.
Diffstat (limited to 'editors')
| -rw-r--r-- | editors/sail-mode.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/editors/sail-mode.el b/editors/sail-mode.el index c898fc1e..96059a3f 100644 --- a/editors/sail-mode.el +++ b/editors/sail-mode.el @@ -710,6 +710,8 @@ Based on Tuareg mode. See Tuareg mode for usage" sail-font-lock-keywords `(("\\<\\(extern\\|cast\\|overload\\|deinfix\\|function\\|scattered\\|clause\\|effect\\|default\\|struct\\|const\\|union\\|val\\|typedef\\|let\\|rec\\|and\\|end\\|register\\|alias\\|member\\|enumerate\\)\\>" 0 sail-font-lock-governing-face nil nil) + ("\\<\\(_prove\\)\\>" + 0 font-lock-preprocessor-face nil nil) ("\\<\\(false\\|true\\|bitzero\\|bitone\\|0x[:xdigit:]\\|[:digit:]\\)\\>" 0 font-lock-constant-face nil nil) ("\\<\\(as\\|downto\\|else\\|foreach\\|if\\|t\\(hen\\|o\\)\\|when\\|in\\|switch\\|with\\|case\\|when\\|exit\\|constraint\\|sizeof\\|nondet\\|from\\|by\\|return\\)\\>" 0 font-lock-keyword-face nil nil) @@ -724,7 +726,7 @@ Based on Tuareg mode. See Tuareg mode for usage" ("\\<\\(val\\|and\\|let\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)\\>\\(\\(\\w\\|[->_ \t,?~.]\\|(\\(\\w\\|[--->_ \t,?~.=]\\)*)\\)*\\)" 6 font-lock-variable-name-face keep nil) ("\\<\\([?~]?[_[:alpha:]]\\w*\\)[ \t\n]*:[^:>=]" - 1 font-lock-variable-name-face keep nil) + 0 font-lock-variable-name-face keep nil) ("^#\\w+\\>" 0 font-lock-preprocessor-face t nil) )) (setq font-lock-defaults |
