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
if (!this.isChild) {
var aliases = []
var aliases = [];
for (var alias in this.context.aliases) {
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 + ");");
} else {
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 + "); }");
}
fn.call(this, nextStack, helperMissingString, id);
@@ -769,7 +769,7 @@ Handlebars.JavaScriptCompiler = function() {};
return true;
}
return false;
}
};
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
+1 -1
View File
@@ -10,7 +10,7 @@ Handlebars.Exception = function(message) {
this.message = tmp.message;
};
Handlebars.Exception.prototype = new Error;
Handlebars.Exception.prototype = new Error();
// Build out our basic SafeString type
Handlebars.SafeString = function(string) {
+37 -37
View File
@@ -3,50 +3,50 @@
%%
root
: program EOF { return $1 }
: program EOF { return $1; }
;
program
: statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3) }
| statements { $$ = new yy.ProgramNode($1) }
| "" { $$ = new yy.ProgramNode([]) }
: statements simpleInverse statements { $$ = new yy.ProgramNode($1, $3); }
| statements { $$ = new yy.ProgramNode($1); }
| "" { $$ = new yy.ProgramNode([]); }
;
statements
: statement { $$ = [$1] }
| statements statement { $1.push($2); $$ = $1 }
: statement { $$ = [$1]; }
| statements statement { $1.push($2); $$ = $1; }
;
statement
: openInverse program closeBlock { $$ = new yy.InverseNode($1, $2, $3) }
| openBlock program closeBlock { $$ = new yy.BlockNode($1, $2, $3) }
| mustache { $$ = $1 }
| partial { $$ = $1 }
| CONTENT { $$ = new yy.ContentNode($1) }
| COMMENT { $$ = new yy.CommentNode($1) }
: openInverse program closeBlock { $$ = new yy.InverseNode($1, $2, $3); }
| openBlock program closeBlock { $$ = new yy.BlockNode($1, $2, $3); }
| mustache { $$ = $1; }
| partial { $$ = $1; }
| CONTENT { $$ = new yy.ContentNode($1); }
| COMMENT { $$ = new yy.CommentNode($1); }
;
openBlock
: OPEN_BLOCK inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) }
: OPEN_BLOCK inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
;
openInverse
: OPEN_INVERSE inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) }
: OPEN_INVERSE inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
;
closeBlock
: OPEN_ENDBLOCK path CLOSE { $$ = $2 }
: OPEN_ENDBLOCK path CLOSE { $$ = $2; }
;
mustache
: OPEN inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]) }
| OPEN_UNESCAPED inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1], true) }
: OPEN inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1]); }
| OPEN_UNESCAPED inMustache CLOSE { $$ = new yy.MustacheNode($2[0], $2[1], true); }
;
partial
: OPEN_PARTIAL path CLOSE { $$ = new yy.PartialNode($2) }
| OPEN_PARTIAL path path CLOSE { $$ = new yy.PartialNode($2, $3) }
: OPEN_PARTIAL path CLOSE { $$ = new yy.PartialNode($2); }
| OPEN_PARTIAL path path CLOSE { $$ = new yy.PartialNode($2, $3); }
;
simpleInverse
@@ -54,46 +54,46 @@ simpleInverse
;
inMustache
: path params hash { $$ = [[$1].concat($2), $3] }
| path params { $$ = [[$1].concat($2), null] }
| path hash { $$ = [[$1], $2] }
| path { $$ = [[$1], null] }
: path params hash { $$ = [[$1].concat($2), $3]; }
| path params { $$ = [[$1].concat($2), null]; }
| path hash { $$ = [[$1], $2]; }
| path { $$ = [[$1], null]; }
;
params
: params param { $1.push($2); $$ = $1; }
| param { $$ = [$1] }
| param { $$ = [$1]; }
;
param
: path { $$ = $1 }
| STRING { $$ = new yy.StringNode($1) }
| INTEGER { $$ = new yy.IntegerNode($1) }
| BOOLEAN { $$ = new yy.BooleanNode($1) }
: path { $$ = $1; }
| STRING { $$ = new yy.StringNode($1); }
| INTEGER { $$ = new yy.IntegerNode($1); }
| BOOLEAN { $$ = new yy.BooleanNode($1); }
;
hash
: hashSegments { $$ = new yy.HashNode($1) }
: hashSegments { $$ = new yy.HashNode($1); }
;
hashSegments
: hashSegments hashSegment { $1.push($2); $$ = $1 }
| hashSegment { $$ = [$1] }
: hashSegments hashSegment { $1.push($2); $$ = $1; }
| hashSegment { $$ = [$1]; }
;
hashSegment
: ID EQUALS path { $$ = [$1, $3] }
| ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)] }
| ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)] }
| ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)] }
: ID EQUALS path { $$ = [$1, $3]; }
| ID EQUALS STRING { $$ = [$1, new yy.StringNode($3)]; }
| ID EQUALS INTEGER { $$ = [$1, new yy.IntegerNode($3)]; }
| ID EQUALS BOOLEAN { $$ = [$1, new yy.BooleanNode($3)]; }
;
path
: pathSegments { $$ = new yy.IdNode($1) }
: pathSegments { $$ = new yy.IdNode($1); }
;
pathSegments
: pathSegments SEP ID { $1.push($3); $$ = $1; }
| ID { $$ = [$1] }
| ID { $$ = [$1]; }
;