Skip to content

Commit e1968b3

Browse files
committed
more ketwords & snippets
1 parent 33622cc commit e1968b3

File tree

6 files changed

+134
-5
lines changed

6 files changed

+134
-5
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.visx
2-
*.vsix
2+
*.vsix
3+
*.aes
4+
*.spthy

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
An extension for highlighting tamarin-prover.
44

5+
Also include some snippets to smooth developing
6+
57
see http://tamarin-prover.github.io/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tamarin",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"engines": {
55
"vscode": ">=0.9.0-pre.1"
66
},

snippets.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"description": "Generate full rule wit let in"
2424
},
25-
"thoery": {
25+
"theory": {
2626
"prefix": "theory",
2727
"body": [
2828
"theory $1",
@@ -61,7 +61,7 @@
6161
"description": "Create a fresh nounce"
6262
},
6363
"pair": {
64-
"prefix": "<",
64+
"prefix": "pair",
6565
"body":[
6666
"< $1, $2 >"
6767
],
@@ -88,6 +88,38 @@
8888
"\t[ $2 ]\n\t--[\n\t\t\n\t]->\n\t[ $3 ]"
8989
],
9090
"description": "Create an init rule"
91+
},
92+
"let in": {
93+
"prefix": "let",
94+
"body":[
95+
"\tlet",
96+
"\t\t$1",
97+
"in"
98+
]
99+
},
100+
"all-traces": {
101+
"prefix": "all",
102+
"body": [
103+
"all-traces"
104+
],
105+
"description": "Tamarin - All Traces"
106+
},
107+
"exists-trace": {
108+
"prefix": "exist",
109+
"body":[
110+
"exists-trace"
111+
],
112+
"description": "Lemma proven once a trace is found"
113+
},
114+
"restrition": {
115+
"prefix": "restriction",
116+
"body":[
117+
"restriction $1:",
118+
"\"",
119+
"\t$2",
120+
"\""
121+
],
122+
"description": "restriction skeleton"
91123
}
92124

93125
}

syntaxes/tamarin.YAML-tmLanguage

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Tamarin
2+
file_extensions:
3+
- spthy
4+
scope: source.spthy
5+
fileTypes: [YAML-tmLanguage]
6+
scopeName: source.yaml-tmlanguage
7+
uuid: a6b019cb-75bf-4d9a-aab1-703f6b6d143b
8+
9+
foldingStartMarker: "(?x)\n\t\t /\\*\\*(?!\\*)\n\t\t|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))\n\t"
10+
foldingStopMarker: "(?<!\\*)\\*\\*/|^\\s*\\}"
11+
12+
contexts:
13+
main:
14+
- include: comments
15+
- include: comments-inline
16+
17+
- match: '"'
18+
scope: punctuation.definition.string.begin.spthy
19+
20+
- match: \b(equations|functions|builtins|protocol|property|theory|begin|end|subsection|section|text|rule|pb|lts|exists-trace|all-traces|enable|assertions|modulo|default_rules|anb-proto|in|let|Fresh|fresh|Public|public)\b
21+
scope: keyword.function.spthy
22+
23+
- match: '{\||\|}|{|}|\.\.|:|@|#|<-|<->|\!=|<=|>=|--\[|\]->|\[|\]|-->'
24+
scope: keyword.operator.spthy
25+
26+
27+
# Numbers
28+
- match: '\b(-)?[0-9.]+\b'
29+
scope: constant.numeric.spthy
30+
31+
# Brackets
32+
- match: \(
33+
push: brackets
34+
- match: \)
35+
scope: invalid.illegal.stray-bracket-end
36+
37+
- match: "\\b(aenc|adec|senc|sdec|sign|verify|Eq|eq|hashing|signing|revealing-signing|diffie-hellman|symmetric-encryption|asymmetric-encryption|multiset|bilinear-pairing|h|H|sk|pk|Fr|In|Out|IN|OUT)\\b"
38+
scope: variable.language.spthy
39+
comment: Tamarin constr keywords
40+
41+
- match: "\\b(in|let|begin|end)\\b"
42+
scope: constant.language.spthy
43+
comment: Tamarin decl keywords
44+
45+
- match: "\\b(axiom|restriction|lemma|sources|use_induction|reuse|hide_lemma|left|right|builtins|protocol|property|subsection|section|text|theory)\\b"
46+
scope: keyword.control.spthy
47+
48+
49+
- match: "(\\b(F|T|All|Ex|not|)\\b|&|\\||==>|=|==|<|>)"
50+
scope: constant.language.spthy
51+
comment: Tamarin logical operations
52+
53+
- match: "'"
54+
captures:
55+
0: punctuation.definition.string.begin.spthy
56+
push:
57+
- meta_scope: string.quoted.single.spthy
58+
- match: "'"
59+
captures:
60+
0: punctuation.definition.string.end.spthy
61+
pop: true
62+
63+
- match: \w+\s*(?=\()
64+
scope: support.function.spthy
65+
66+
67+
comments:
68+
- match: /\*\*/
69+
scope: comment.block.empty.spthy punctuation.definition.comment.spthy
70+
- include: comments-inline
71+
comments-inline:
72+
- match: /\*
73+
scope: punctuation.definition.comment.spthy
74+
push:
75+
- meta_scope: comment.block.spthy
76+
- match: \*/
77+
scope: punctuation.definition.comment.spthy
78+
pop: true
79+
- match: \s*((//).*$\n?)
80+
captures:
81+
1: comment.line.double-slash.spthy
82+
2: punctuation.definition.comment.spthy
83+
84+
brackets:
85+
- match: \)
86+
pop: true
87+
- include: main

syntaxes/tamarin.tmLanguage

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@
3333
<!-- key words -->
3434
<dict>
3535
<key>match</key>
36-
<string>\b(axiom|lemma|equations|functions|builtins|protocol|property|theory|begin|end|subsection|section|text|rule|pb|lts|exists-trace|all-traces|enable|assertions|modulo|default_rules|anb-proto|in|let|Fresh|fresh|Public|public)\b</string>
36+
<string>\b(equations|functions|builtins|protocol|property|theory|begin|end|subsection|section|text|rule|pb|lts|exists-trace|all-traces|enable|assertions|modulo|default_rules|anb-proto|in|let|Fresh|fresh|Public|public)\b</string>
3737
<key>name</key>
3838
<string>keyword.control</string>
3939
</dict>
4040

41+
<dict>
42+
<key>match</key>
43+
<string>\b(axiom|restriction|lemma|sources|use_induction|reuse|hide_lemma|left|right|builtins|protocol|property|subsection|section|text)\b</string>
44+
<key>name</key>
45+
<string>keyword.control</string>
46+
</dict>
4147

4248

4349
<dict>

0 commit comments

Comments
 (0)