code: public ProgramMetaData build(ParseTree tree)
  	{
  
  		int size = tree.getChildCount() - 1;
  		List<Statement> ls = new ArrayList<Statement>(size);
  		for (int i = 0; i < size; i++)
  		{
  			Statement st = parseStatment((ParserRuleContext) tree.getChild(i));
  			if (st != null)
  			{
  				ls.add(st);
  			}
  
  		}
  
  		if (pbCtx.current.gotoValue == IGoto.RETURN || pbCtx.current.gotoValue == IGoto.BREAK)
  		{
  			//如果顶级scope也有return 和break，则检测
  			data.hasGoto = true;
  		}
  
  		pbCtx.anzlyszeGlobal();
  		pbCtx.anzlyszeLocal();
  		data.varIndexSize = pbCtx.varIndexSize;
  		data.tempVarStartIndex = pbCtx.globalIndexMap.size();
  		data.statements = ls.toArray(new Statement[0]);
  		data.globalIndexMap = pbCtx.globalIndexMap;
  		data.globalVarAttr = pbCtx.globaVarAttr;
  		data.setTemplateRootScopeIndexMap(pbCtx.rootIndexMap);
  
  		return data;
  
  	}
docs: 通过Antlr的ParseTree生成Beetl的ProgramMetaData
  @param tree
  @return