Skip to content

Commit 3fcef13

Browse files
feat: add Vyper language support, reassign .vy from Menhir (XAMPPRocky#1354)
Port of upstream XAMPPRocky#1354. Also adds Vyper to the README language list for consistency (the upstream PR omitted that). Co-Authored-By: Kainoa Kanter <kainoa@t1c.dev>
1 parent ee66d32 commit 3fcef13

3 files changed

Lines changed: 58 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ VisualBasic
546546
VisualStudioProject
547547
VisualStudioSolution
548548
Vue
549+
Vyper
549550
WebAssembly
550551
Wolfram
551552
Xaml

languages.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@
11491149
["(*", "*)"],
11501150
["/*", "*/"]
11511151
],
1152-
"extensions": ["mll", "mly", "vy"]
1152+
"extensions": ["mll", "mly"]
11531153
},
11541154
"Meson": {
11551155
"line_comment": ["#"],
@@ -2047,6 +2047,13 @@
20472047
"important_syntax": ["<script", "<style", "<template"],
20482048
"extensions": ["vue"]
20492049
},
2050+
"Vyper": {
2051+
"name": "Vyper",
2052+
"line_comment": ["#"],
2053+
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]],
2054+
"quotes": [["\\\"", "\\\""], ["'", "'"]],
2055+
"extensions": ["vy"]
2056+
},
20502057
"WebAssembly": {
20512058
"line_comment": [";;"],
20522059
"quotes": [["\\\"", "\\\""], ["'", "'"]],

tests/data/vyper.vy

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 49 lines 31 code 10 comments 8 blanks
2+
# ```vyper
3+
# @external
4+
# def main():
5+
# # Comment
6+
#
7+
# log Hello(message="Hello World!")
8+
# ```
9+
# pragma version ~=0.4.0
10+
11+
event Hello:
12+
message: String[32]
13+
14+
owner: public(address)
15+
16+
@deploy
17+
def __init__():
18+
start: String[32] = "###\""
19+
# comment
20+
self.owner = msg.sender
21+
22+
@internal
23+
def _call1():
24+
return
25+
26+
@internal
27+
def _call2():
28+
return
29+
30+
@external
31+
def foo(name: String[32]) -> String[64]:
32+
this_ends: String[32] = "a \"test#."
33+
self._call1()
34+
self._call2()
35+
this_does_not: String[64] = "# nested # phrase \" #"
36+
return this_does_not
37+
38+
@external
39+
def foobar() -> bool:
40+
does_not_start: String[64] = "until here, test# test" # a quote: "
41+
also_doesnt_start: String[64] = "until here, test,# test" # another quote: "
42+
return True
43+
44+
@external
45+
def foo_again() -> uint256:
46+
a: uint256 = 4 # #
47+
b: uint256 = 5
48+
c: uint256 = 6 # #
49+
return a + b + c

0 commit comments

Comments
 (0)