Skip to content

Commit

Permalink
pro updatpro updatee
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Jan 6, 2025
1 parent 7aa483b commit 9f852d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions scripts/Test.swipe
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@

@version 1.0
@swipe 8.2
@name "Swipe test"
@by "HJfod"

function vararg(named, x, y, args...) {
// todo: why tf is this not just args[0], args[1]??? why is args not just an array???
print("named: {}, x: {}, y: {}, argument0: {}, argument1: {}", argument0, argument1)
function test(func, expected, msg) {
res = func()
if res != expected {
print("test '{}' failed: {} != {}", msg, res, expected)
}
}

function testVariadic(args...) {
result = 0
for arg in args {
result += arg
}
return result
}
test(testVariadic(1, 2, 3, 4, 5, 6, 7), 1 + 2 + 3 + 4 + 5 + 6 + 7, "variadic sum")

function vararg(named, x, y, args...) {
print("named: {}, x: {}, y: {}, args[0]: {}, args[1]: {}", args[0], args[1])
}
vararg("hi", 5, true, "six", y = 6, ball)
2 changes: 1 addition & 1 deletion swipe-vscode/syntaxes/swipe.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
},
{
"name": "constant.language.swipe",
"match": "\\b((argument[0-9]*)|arguments|namedArguments|this)\\b"
"match": "\\b(arguments|this)\\b"
},
{
"name": "constant.language.swipe",
Expand Down

0 comments on commit 9f852d7

Please sign in to comment.