Skip to content

Commit

Permalink
expression and left-recursion in some other areas fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
scmcduffee committed Dec 20, 2009
1 parent 4f10ba2 commit 64e0593
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
29 changes: 12 additions & 17 deletions parser/celluloid.java.stg
Expand Up @@ -37,12 +37,14 @@ program(
// REQUIRED: Need this set to display video
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);

<code:{ code | <code>}; separator="\r\n">
try {
<code:{ code | <code>}; separator="\r\n">

/*
* EXECUTION BEGINS HERE
*/
globalTimeline.play();
/*
* EXECUTION BEGINS HERE
*/
globalTimeline.play();
} catch (MalformedURLException e) { System.err.println(e); return; }
}
}

Expand Down Expand Up @@ -138,9 +140,9 @@ outputConstraintFunctionCall(
time, args) ::=
<<
globalTimeline.addConstraintFunction(new ConstraintFunction(<target>, new ReactiveNumber(<time>)) {
public void execute() {
((<type>) input).<function>(<args>);
}
public void execute() {
((<type>) input).<function>(<args>);
}
});

globalTimeline.addConstraintFunction(
Expand All @@ -151,10 +153,8 @@ globalTimeline.addConstraintFunction(
public void execute() {
((<type>) input).attachOutput(output);
}
}
}
);


>>

passThrough(text) ::= "<text>"
Expand All @@ -170,12 +170,7 @@ variableArgument(type, name) ::= "<type> <name>"
timelineArgument(name) ::= "Timeline <name>"
outputDeclaration(type, name, args) ::= ""
audioDeviceDeclaration(type, name, args) ::= "<type> <name> = new <type>(new File(<args>).toURI().toURL());"
deviceDeclaration(type, name, args) ::=
<<
try {
<type> <name> = new <type>(<args>);
} catch (MalformedURLException e) { System.err.println(e); return; }
>>
deviceDeclaration(type, name, args) ::= "<type> <name> = new <type>(<args>);"
variableDeclaration(type, name, init) ::= "<type> <name> <init>;"
timelineDeclaration(name) ::= "Timeline <name> = new Timeline();"
initializer(exp) ::= " = <exp>"
Expand Down
8 changes: 3 additions & 5 deletions parser/celluloidWalker.g
Expand Up @@ -60,12 +60,10 @@ options {
HashMap<String, FunctionEntry> functionTable = new HashMap<String, FunctionEntry>();

public static String parseTime(String time) {
if("@start".equals(time)) return "0D";
if("@now".equals(time)) return "0D"; //@TODO support @NOW
if("@start".equals(time)) return "0F";
if("@now".equals(time)) return "0F"; //@TODO support @NOW
time = time.substring(1, time.length());

System.out.println("dantest + " + time);

int builtTime = 0;
int buildUp = 0;
while(time.length() > 0) {
Expand All @@ -92,7 +90,7 @@ options {
buildUp = buildUp*10 + new Integer(String.valueOf(cur));
}
}
return new String(Integer.valueOf(builtTime).toString())+"D";
return new String(Integer.valueOf(builtTime).toString())+"F";
}
}

Expand Down
11 changes: 10 additions & 1 deletion parser/tests/helloCh2.cld
@@ -1,8 +1,17 @@
timeline timeline1
input audio1 = new AudioFile("../framework/acousticgrunge.wav")
input audio2 = new AudioFile("../framework/playme.wav")
output output1 = new Output("../framework/HelloCh2.wav")

in timeline1 do
play audio1 @10d3h
play audio1 @start
pause audio1 @1m
play audio2 @1m
stop audio2 @2m
play audio1 @2m
end
in output1 do
play timeline1 @start
end


0 comments on commit 64e0593

Please sign in to comment.