Skip to content

Commit

Permalink
added scoop to if, while, delay and statments block
Browse files Browse the repository at this point in the history
  • Loading branch information
jjstaats committed Aug 14, 2011
1 parent d39b308 commit 635ec6d
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
62 changes: 62 additions & 0 deletions DSL/DiversiaScript/test/pos/scoop.div
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@


def Obj{

default state bob{

on Frame(i:Real){

/*for(var i : String in {"1", "2", "3", "4"}){
print(i);
}

for(var key : String, var val : Int in {"1"=1, "2"=2, "3"=3, "4"=4}){
print(key);
}*/

//var array : Array<Int> = {1, 2, 3};
var array : Array<Bool> = {true,true};
var size : Int = 54;
var total : Int = 0;
var str : String = "asf";
var dic : Map<String, String> = { "A"="a", "B"="b"};

var array2 : Array<String> = {"1", "2", "3"};

for(var val : String in array2) print(val);

for(var val : Bool in array) print("lol");

for(var val : String, var val1 : String in dic) print("lol");

for(var val : Int; val<size; val++;) total = total+val ;

if( size == 54 ) print("bob");
if( str == "54" ) {
var str:String = "bob";
print(str);
} else {
print(str); // uses def below..still kind of a bug.
var str:String = "bob";
print(str);
}
print(str);

while(str){
var str:String = "bob";
print str;
}
in 3 seconds {
var str:String = "bob";
print str;
}
in 3 seconds var str:String = "bob";
{
var str:String = "bob";
print str;
}
}
}
}


44 changes: 43 additions & 1 deletion DSL/DiversiaScript/trans/rename.str
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,50 @@ rules // Definitions
<rename-all-refs> updates' => updates'';
<rename-all-refs> statements' => statements'';
<rename-all-refs> condition => condition'
)
)

rename-def :
If(exp, statements) -> If(exp, statements'')
where
new-scope (
<rename-all-defs> statements => statements';
<rename-all-refs> statements' => statements''
)

rename-def :
If(exp, statements1, statements2) -> If(exp, statements1'', statements2'')
where
new-scope (
<rename-all-defs> statements1 => statements1';
<rename-all-refs> statements1' => statements1''
);
new-scope (
<rename-all-defs> statements2 => statements2';
<rename-all-refs> statements2' => statements2''
)

rename-def :
While(exp, statements) -> While(exp, statements'')
where
new-scope (
<rename-all-defs> statements => statements';
<rename-all-refs> statements' => statements''
)
rename-def :
Statements(statements) -> Statements(statements'')
where
new-scope (
<rename-all-defs> statements => statements';
<rename-all-refs> statements' => statements''
)
rename-def :
Delay(exp, unit, statements) -> Delay(exp, unit, statements'')
where
new-scope (
<rename-all-defs> statements => statements';
<rename-all-refs> statements' => statements''
)

rename-def :
Param(name, type) -> Param(name', type)
where
Expand Down

0 comments on commit 635ec6d

Please sign in to comment.