Skip to content

Commit

Permalink
js fix
Browse files Browse the repository at this point in the history
  • Loading branch information
clemos committed Nov 24, 2012
1 parent b027ebd commit b4c1b36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
13 changes: 6 additions & 7 deletions src/erazor/ScriptBuilder.hx
Expand Up @@ -36,19 +36,18 @@ class ScriptBuilder

public function blockToString(block : Block) : String
{
return switch(block.block)
var o = null;
switch(block.block)
{
case literal(s):
return context + ".add('" + StringTools.replace(s, "'", "\\'") + "');";
o = context + ".add('" + StringTools.replace(s, "'", "\\'") + "');";

case codeBlock(s):
return s+"\n";
o = s+"\n";

case printBlock(s):
return context + ".add(" + s + ");";
o = context + ".add(" + s + ");";
}



return o;
}
}
7 changes: 3 additions & 4 deletions src/erazor/Template.hx
Expand Up @@ -37,7 +37,7 @@ class Template
// Make hscript parse and interpret the script.
var parser = new hscript.Parser();

#if( erazorPos )
#if erazorPos
try{
program = parser.parseString( script.src );
}catch( e : hscript.Expr.Error ){
Expand All @@ -62,7 +62,6 @@ class Template
var bufferStack = [];

setInterpreterVars(interp, content);

interp.variables.set('__b__', buffer); // Connect the buffer to the script
interp.variables.set('__string_buf__', function(current) {
bufferStack.push(current);
Expand All @@ -73,7 +72,7 @@ class Template
return bufferStack.pop();
});

#if( erazorPos )
#if erazorPos
try{
interp.execute(program);
}catch( e : hscript.Expr.Error ){
Expand All @@ -87,7 +86,7 @@ class Template
return buffer.toString();
}

#if( erazorPos )
#if erazorPos
private function hscriptError( e : Error ){

var prev = 0;
Expand Down

0 comments on commit b4c1b36

Please sign in to comment.