本文整理汇总了C++中ASTNode::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::GetName方法的具体用法?C++ ASTNode::GetName怎么用?C++ ASTNode::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNode
的用法示例。
在下文中一共展示了ASTNode::GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LetExprMgr
// FUNC: This function builds the map between LET-var names and
// LET-expressions
//
//1. if the Let-var is already defined in the LET scope, then the
//1. function returns an error.
//
//2. if the Let-var is already declared variable in the input, then
//2. the function returns an error
//
//3. otherwise add the <var,letExpr> pair to the _letid_expr table.
void LETMgr::LetExprMgr(const ASTNode& var, const ASTNode& letExpr)
{
string name = var.GetName();
MapType::iterator it;
if(((it = _letid_expr_map->find(name)) != _letid_expr_map->end()))
{
FatalError("LetExprMgr:The LET-var v has already been defined"\
"in this LET scope: v =", var);
}
if(_parser_symbol_table.find(var) != _parser_symbol_table.end())
{
FatalError("LetExprMgr:This var is already declared. "\
"cannot redeclare as a letvar: v =", var);
}
LetExprMgr(var.GetName(),letExpr);
}//end of LetExprMgr()
示例2: ResolveID
//this function looks up the "var to letexpr map" and returns the
//corresponding letexpr. if there is no letexpr, then it simply
//returns the var.
ASTNode LETMgr::ResolveID(const ASTNode& v)
{
if (v.GetKind() != SYMBOL) {
return v;
}
if(_parser_symbol_table.find(v) != _parser_symbol_table.end()) {
return v;
}
MapType::iterator it;
if((it =_letid_expr_map->find(v.GetName())) != _letid_expr_map->end())
{
return it->second;
}
return v;
}//End of ResolveID()