本文整理汇总了C++中FileNode::GetInputName方法的典型用法代码示例。如果您正苦于以下问题:C++ FileNode::GetInputName方法的具体用法?C++ FileNode::GetInputName怎么用?C++ FileNode::GetInputName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileNode
的用法示例。
在下文中一共展示了FileNode::GetInputName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintTree
// prints out the ast
void opNode::PrintTree(const opString& filename, int depth) {
FileNode* file = GetFile();
opString s = file->GetInputName();
int line = GetLine();
s += '(';
if (line == -1)
s += "UNKNOWN) : \t";
else
s += opString(line) + ") : \t";
for (int i = 0; i < depth; i++) s += ". ";
if (IsTerminal()) {
Token t = GetId();
// NOTE: this prints the value now (make optional?)
if (t == T_NEWLINE || t == T_EOF || t == T_CONTINUELINE ||
t == T_CCOMMENT) {
Log(s + TokenFunctions::ToString(GetId()));
} else
Log(s + TokenFunctions::ToString(GetId()) + " '" +
GetTreeValue() + "'");
} else {
// If we're not in -fulltree mode, we want to limit
// the kinds of nodes we print (mostly auto modifiers).
if (!opParameters::Get().PrintFullTree && (id == G_AUTO_MODIFIERS)) {
return;
}
opString value = GetTreeValue();
if (!value.Size())
Log(s + TokenFunctions::ToString(GetId()));
else
Log(s + TokenFunctions::ToString(GetId()) + " '" + value + "'");
iterator i = GetBegin();
iterator end = GetEnd();
while (i != end) {
i->PrintTree(filename, depth + 1);
++i;
}
}
}
示例2: GetStatementArgument
opNode* OPObjectNode::GetStatementArgument(const opString& argumentname,
StatementBase* statement,
stackedgroup& tempmodifiers) {
if (opNode* node = statement->FetchModifier(argumentname)) return node;
if (argumentname == "source_line") {
int linenumber = statement->GetLine();
stacked<ExpandableArgumentNode> node = NEWNODE(ExpandableArgumentNode);
node->CopyBasics(this);
node->SetValue("source_line");
node->AppendTerminalNode(linenumber, T_NUMBER);
opNode* SourceLineArgument = *node;
tempmodifiers.Push(node);
return SourceLineArgument;
} else if (argumentname == "source_file") {
FileNode* file = statement->GetFile();
opString filename = file->GetInputName();
stacked<ExpandableArgumentNode> node = NEWNODE(ExpandableArgumentNode);
node->CopyBasics(this);
node->SetValue("source_file");
node->AppendTerminalNode(filename, T_ID);
opNode* SourceFileArgument = *node;
tempmodifiers.Push(node);
return SourceFileArgument;
}
return NULL;
}