Fixed whitespace and semi-colons

This commit is contained in:
Peter Wagenet
2012-02-08 19:42:39 -08:00
parent cb9db98642
commit 2ea95ca08d
3 changed files with 52 additions and 52 deletions
+3 -3
View File
@@ -447,7 +447,7 @@ Handlebars.JavaScriptCompiler = function() {};
// Generate minimizer alias mappings // Generate minimizer alias mappings
if (!this.isChild) { if (!this.isChild) {
var aliases = [] var aliases = [];
for (var alias in this.context.aliases) { for (var alias in this.context.aliases) {
this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
} }
@@ -635,7 +635,7 @@ Handlebars.JavaScriptCompiler = function() {};
this.source.push(nextStack + " = " + id + ".call(" + paramString + ");"); this.source.push(nextStack + " = " + id + ".call(" + paramString + ");");
} else { } else {
this.context.aliases.functionType = '"function"'; this.context.aliases.functionType = '"function"';
var condition = program ? "foundHelper && " : "" var condition = program ? "foundHelper && " : "";
this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }"); this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }");
} }
fn.call(this, nextStack, helperMissingString, id); fn.call(this, nextStack, helperMissingString, id);
@@ -769,7 +769,7 @@ Handlebars.JavaScriptCompiler = function() {};
return true; return true;
} }
return false; return false;
} };
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler); })(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
+1 -1
View File
@@ -10,7 +10,7 @@ Handlebars.Exception = function(message) {
this.message = tmp.message; this.message = tmp.message;
}; };
Handlebars.Exception.prototype = new Error; Handlebars.Exception.prototype = new Error();
// Build out our basic SafeString type // Build out our basic SafeString type
Handlebars.SafeString = function(string) { Handlebars.SafeString = function(string) {
+37 -37
View File
@@ -3,50 +3,50 @@
%% %%
root root
: program EOF { return $1 } : program EOF { return $1; }
; ;
program program
: statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3) } : statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3); }
| statements { $$ = new yy.ProgramNode($1) } | statements { $$ = new yy.ProgramNode($1); }
| "" { $$ = new yy.ProgramNode([]) } | "" { $$ = new yy.ProgramNode([]); }
; ;
statements statements
: statement { $$ = [$1] } : statement { $$ = [$1]; }
| statements statement { $1.push($2); $$ = $1 } | statements statement { $1.push($2); $$ = $1; }
; ;
statement statement
: openInverse program closeBlock { $$ = new yy.InverseNode($1, $2, $3) } : openInverse program closeBlock { $$ = new yy.InverseNode($1, $2, $3); }
| openBlock program closeBlock { $$ = new yy.BlockNode($1, $2, $3) } | openBlock program closeBlock { $$ = new yy.BlockNode($1, $2, $3); }
| mustache { $$ = $1 } | mustache { $$ = $1; }
| partial { $$ = $1 } | partial { $$ = $1; }
| CONTENT { $$ = new yy.ContentNode($1) } | CONTENT { $$ = new yy.ContentNode($1); }
| COMMENT { $$ = new yy.CommentNode($1) } | COMMENT { $$ = new yy.CommentNode($1); }
; ;
openBlock openBlock
: OPEN_BLOCK inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) } : OPEN_BLOCK inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
; ;
openInverse openInverse
: OPEN_INVERSE inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) } : OPEN_INVERSE inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
; ;
closeBlock closeBlock
: OPEN_ENDBLOCK path CLOSE { $$ = $2 } : OPEN_ENDBLOCK path CLOSE { $$ = $2; }
; ;
mustache mustache
: OPEN inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) } : OPEN inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
| OPEN_UNESCAPED inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1], true) } | OPEN_UNESCAPED inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1], true); }
; ;
partial partial
: OPEN_PARTIAL path CLOSE { $$ = new yy.PartialNode($2) } : OPEN_PARTIAL path CLOSE { $$ = new yy.PartialNode($2); }
| OPEN_PARTIAL path path CLOSE { $$ = new yy.PartialNode($2, $3) } | OPEN_PARTIAL path path CLOSE { $$ = new yy.PartialNode($2, $3); }
; ;
simpleInverse simpleInverse
@@ -54,46 +54,46 @@ simpleInverse
; ;
inMustache inMustache
: path params hash { $$ = [[$1].concat($2), $3] } : path params hash { $$ = [[$1].concat($2), $3]; }
| path params { $$ = [[$1].concat($2), null] } | path params { $$ = [[$1].concat($2), null]; }
| path hash { $$ = [[$1], $2] } | path hash { $$ = [[$1], $2]; }
| path { $$ = [[$1], null] } | path { $$ = [[$1], null]; }
; ;
params params
: params param { $1.push($2); $$ = $1; } : params param { $1.push($2); $$ = $1; }
| param { $$ = [$1] } | param { $$ = [$1]; }
; ;
param param
: path { $$ = $1 } : path { $$ = $1; }
| STRING { $$ = new yy.StringNode($1) } | STRING { $$ = new yy.StringNode($1); }
| INTEGER { $$ = new yy.IntegerNode($1) } | INTEGER { $$ = new yy.IntegerNode($1); }
| BOOLEAN { $$ = new yy.BooleanNode($1) } | BOOLEAN { $$ = new yy.BooleanNode($1); }
; ;
hash hash
: hashSegments { $$ = new yy.HashNode($1) } : hashSegments { $$ = new yy.HashNode($1); }
; ;
hashSegments hashSegments
: hashSegments hashSegment { $1.push($2); $$ = $1 } : hashSegments hashSegment { $1.push($2); $$ = $1; }
| hashSegment { $$ = [$1] } | hashSegment { $$ = [$1]; }
; ;
hashSegment hashSegment
: ID EQUALS path { $$ = [$1, $3] } : ID EQUALS path { $$ = [$1, $3]; }
| ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)] } | ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)]; }
| ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)] } | ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)]; }
| ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)] } | ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)]; }
; ;
path path
: pathSegments { $$ = new yy.IdNode($1) } : pathSegments { $$ = new yy.IdNode($1); }
; ;
pathSegments pathSegments
: pathSegments SEP ID { $1.push($3); $$ = $1; } : pathSegments SEP ID { $1.push($3); $$ = $1; }
| ID { $$ = [$1] } | ID { $$ = [$1]; }
; ;