lib/tea-macro/tea-macro.js
function toExpr(value,line){
	var token=[];
	var ctoken=token;
	var newToken;
	var stacks=[];
	var c;
	var ss='';
	for(var i=0;i<value.length;i++){
		c=value[i];
		switch(c){
		case ' ':
		case "\t":
		case ",":
			if(ss!=""){
				ctoken.push(ss);
				ss="";
			}
			break;
		case '(':
			if(ss!=""){
				console.log("warning: no space before '(' in line "+line+" at "+(i+1));
				ctoken.push(ss);
				ss="";
			}
			stacks.push(ctoken);
			newToken=[];
			ctoken.push(newToken);
			ctoken=newToken;
			break;
		case ')':
			if(ss!=""){
				ctoken.push(ss);
				ss="";
			}
			if(stacks.length>0){
				ctoken=stacks.pop();
			}else{
				console.log("error: unmatched ')' in line "+line+" at "+(i+1));
				return null;
			}
			break;
		default:
			ss+=c;
			break;
		}
	}
	if(ss!=''){
		ctoken.push(ss);
	}

	// remove last '*/', '###'
	var ltoken=null;
	if(token&&(token.length>0)){
		ltoken=token[token.length-1];
		if((typeof ltoken=='string')&&((ltoken=='*/')||(ltoken=='###'))){
			ltoken.pop();
		}
	}

	return token;
}
function toExpr(value,line){
	var token=[];
	var ctoken=token;
	var newToken;
	var stacks=[];
	var c;
	var ss='';
	for(var i=0;i<value.length;i++){
		c=value[i];
		switch(c){
		case ' ':
		case "\t":
		case ",":
			if(ss!=""){
				ctoken.push(ss);
				ss="";
			}
			break;
		case '(':
			if(ss!=""){
				console.log("warning: no space before '(' in line "+line+" at "+(i+1));
				ctoken.push(ss);
				ss="";
			}
			stacks.push(ctoken);
			newToken=[];
			ctoken.push(newToken);
			ctoken=newToken;
			break;
		case ')':
			if(ss!=""){
				ctoken.push(ss);
				ss="";
			}
			if(stacks.length>0){
				ctoken=stacks.pop();
			}else{
				console.log("error: unmatched ')' in line "+line+" at "+(i+1));
				return null;
			}
			break;
		default:
			ss+=c;
			break;
		}
	}
	if(ss!=''){
		ctoken.push(ss);
	}

	// remove last '*/', '###'
	var ltoken=null;
	if(token&&(token.length>0)){
		ltoken=token[token.length-1];
		if((typeof ltoken=='string')&&((ltoken=='*/')||(ltoken=='###'))){
			ltoken.pop();
		}
	}

	return token;
}
function toExpr ( value , line ) { var token = [ ] ; var ctoken = token ; var newToken ; var stacks = [ ] ; var c ; var ss = '' ; for ( var i = 0 ; i < value . length ; i ++ ) { c = value [ i ] ; switch ( c ) { case ' ' : case "\t" : case "," : if ( ss != "" ) { ctoken . push ( ss ) ; ss = "" ; } break ; case '(' : if ( ss != "" ) { console . log ( "warning: no space before '(' in line " + line + " at " + ( i + 1 ) ) ; ctoken . push ( ss ) ; ss = "" ; } stacks . push ( ctoken ) ; newToken = [ ] ; ctoken . push ( newToken ) ; ctoken = newToken ; break ; case ')' : if ( ss != "" ) { ctoken . push ( ss ) ; ss = "" ; } if ( stacks . length > 0 ) { ctoken = stacks . pop ( ) ; } else { console . log ( "error: unmatched ')' in line " + line + " at " + ( i + 1 ) ) ; return null ; } break ; default : ss += c ; break ; } } if ( ss != '' ) { ctoken . push ( ss ) ; } // remove last '*/', '###' var ltoken = null ; if ( token && ( token . length > 0 ) ) { ltoken = token [ token . length - 1 ] ; if ( ( typeof ltoken == 'string' ) && ( ( ltoken == '*/' ) || ( ltoken == '###' ) ) ) { ltoken . pop ( ) ; } } return token ; }
convert  expression string to expression object
@param value  (LISP style) expression string
@param line   line number
@return       expression object
convert expression string to expression object