Skip to content

Commit

Permalink
remove code
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuvist committed May 3, 2014
1 parent 31768a6 commit 75bb87b
Showing 1 changed file with 2 additions and 79 deletions.
81 changes: 2 additions & 79 deletions vash.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,6 @@ VParser.prototype = {

while( this.prevTokens.push( curr ), (curr = this.tokens.pop()) ){

if(this.options.debugParser){
console.log(this.ast && this.ast.mode, curr.type, curr.toString(), curr.val);
}

if(this.ast.mode === PRG || this.ast.mode === null){

this.ast = this.ast.beget( this.options.initialMode || MKP );
Expand Down Expand Up @@ -547,13 +543,6 @@ VParser.prototype = {

this.ast = this.ast.root();

if(this.options.debugParser && !this.options.initialMode){
// this should really only output on the true root

console.log(this.ast.toString());
console.log(this.ast.toTreeString());
}

return this.ast;
}

Expand Down Expand Up @@ -1057,19 +1046,8 @@ function VCompiler(ast, originalMarkup, options){

var VCP = VCompiler.prototype;

VCP.insertDebugVars = function(tok){

if(this.options.debug){
this.buffer.push(
this.options.helpersName + '.vl = ' + tok.line + ', '
,this.options.helpersName + '.vc = ' + tok.chr + '; \n'
);
}
}

VCP.visitMarkupTok = function(tok, parentNode, index){

this.insertDebugVars(tok);
this.buffer.push(
"MKP(" + tok.val
.replace(this.reEscapedQuote, '\\\\$1')
Expand Down Expand Up @@ -1106,7 +1084,6 @@ VCP.visitExpressionTok = function(tok, parentNode, index, isHomogenous){
}

if(parentParentIsNotEXP && (index === 0 ) ){
this.insertDebugVars(tok);
start = "_buffer.WriteString(" + start;
}

Expand All @@ -1119,11 +1096,6 @@ VCP.visitExpressionTok = function(tok, parentNode, index, isHomogenous){
} else {
this.buffer.push( start + tok.val + end );
}


if(parentParentIsNotEXP && index === parentNode.length - 1){
this.insertDebugVars(tok);
}
}

VCP.visitNode = function(node){
Expand Down Expand Up @@ -1162,13 +1134,6 @@ VCP.visitNode = function(node){

}

VCP.escapeForDebug = function( str ){
return str
.replace(this.reLineBreak, '!LB!')
.replace(this.reQuote, '\\$1')
.replace(this.reEscapedQuote, '\\$1')
}

VCP.replaceDevTokens = function( str ){
return str
.replace( this.reHelpersName, this.options.helpersName )
Expand Down Expand Up @@ -1314,20 +1279,6 @@ imports +'\n)\n\
return head + body;
}

VCP.addHelperHead = function(body){

var options = this.options;

var head = ''
+ (options.debug ? 'try { \n' : '')
+ 'var __vbuffer = this.buffer; \n'
+ 'var MODELNAME = this.model; \n'
+ 'var HELPERSNAME = this; \n';

head = this.replaceDevTokens( head );
return head + body;
}

VCP.addFoot = function(body){
var foot = '\nreturn ';
if(this.layout != "") {
Expand All @@ -1348,21 +1299,6 @@ VCP.addFoot = function(body){
return body + foot;
}

VCP.addHelperFoot = function(body){

var options = this.options;

var foot = ''
+ (options.debug ? '} catch( e ){ \n'
+ ' HELPERSNAME.reportError( e, HELPERSNAME.vl, HELPERSNAME.vc, "ORIGINALMARKUP" ); \n'
+ '} \n' : '');

foot = this.replaceDevTokens( foot )
.replace( this.reOriginalMarkup, this.escapeForDebug( this.originalMarkup ) );

return body + foot;
}

VCP.generate = function(){
var options = this.options;

Expand All @@ -1378,18 +1314,8 @@ VCP.generate = function(){
.split("MKP(").join( '\n_buffer.WriteString("')
.split(")MKP").join('")\n');

if(!options.asHelper){
joined = this.addHead( joined );
joined = this.addFoot( joined );
} else {
joined = this.addHelperHead( joined );
joined = this.addHelperFoot( joined );
}

if(options.debugCompiler){
console.log(joined);
console.log(options);
}
joined = this.addHead( joined );
joined = this.addFoot( joined );

return joined;
}
Expand All @@ -1413,9 +1339,6 @@ exports["config"] = {
,"modelName": "model"
,"helpersName": "html"
,"htmlEscape": true
,"debug": true
,"debugParser": false
,"debugCompiler": false
,"simple": false

,"favorText": false
Expand Down

0 comments on commit 75bb87b

Please sign in to comment.