docs: function parse(doc,context){
  	var vs;
  	var cmds=[];
  	var pats;
  	var exprs;
  	var subpats;
  	var mode=context.mode;
  
  	var vs=splitLine_(doc);
  	for(var i=0;i<vs.length;i++){
  		if(pats=vs[i].match(macroRegex)){
  			if(mode=='tcmd'){
  				console.log(pats[1]+','+pats[2]);
  			}
  			exprs=null;
  			switch(pats[1]){
  			case 'define':
  				if(subpats=pats[2].match(defineRegex)){
  					exprs=[subpats[1],subpats[2]];
  				}else{
  					console.log("error: invalid format in define statement "+pats[1]+" in line "+(i+1));
  				}
  				break;
  			case 'include':
  			case 'include_once':
  			case 'include_code':
  			case 'include_code_once':
  				exprs=toExpr(pats[2],i+1);
  				break;
  			case 'if':
  			case 'elseif':
  			case 'elif':
  				exprs=toExpr(pats[2],i+1);
  				break;
  			case 'else':
  			case 'endif':
  				break;
  			case 'namespace':
  				if(subpats=pats[2].match(nsRegex)){
  					setNamespace_(subpats[1]);
  				}else{
  					console.log("error: invalid format in namespace statement "+pats[1]+" in line "+(i+1));
  				}
  				break;
  			default:
  				if(pats[1].charAt(0)!='@'){
  					console.log("error: unknown statement "+pats[1]+" in line "+(i+1));
  				}
  				break;
  			}
  			cmds.push({type:pats[1], exprs:exprs});
  		}else{
  			cmds.push({type:'text', value:vs[i]});
  		}
  	}
  	if(mode=='cmd'){
  		for(var i=0;i<cmds.length;i++){
  			console.log(JSON.stringify(cmds[i]));
  		}
  	}
  	return cmds;
  }