mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-22 09:15:35 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
23
samples/Terra/blockescape.t
Normal file
23
samples/Terra/blockescape.t
Normal file
@@ -0,0 +1,23 @@
|
||||
terra foo()
|
||||
var c = 3
|
||||
escape
|
||||
local a = 1
|
||||
for i = 1,10 do
|
||||
emit quote c = c + a end
|
||||
end
|
||||
end
|
||||
return c
|
||||
end
|
||||
|
||||
assert(foo() == 13)
|
||||
|
||||
terra foo2()
|
||||
return escape emit(1) end
|
||||
end
|
||||
|
||||
assert(1 == foo2())
|
||||
|
||||
a = terralib.newlist()
|
||||
a:insert quote
|
||||
foo()
|
||||
end
|
||||
Reference in New Issue
Block a user