本文整理匯總了C#中PascalABCCompiler.SyntaxTree.syntax_tree_node.visit方法的典型用法代碼示例。如果您正苦於以下問題:C# syntax_tree_node.visit方法的具體用法?C# syntax_tree_node.visit怎麽用?C# syntax_tree_node.visit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PascalABCCompiler.SyntaxTree.syntax_tree_node
的用法示例。
在下文中一共展示了syntax_tree_node.visit方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: node
public static string node(syntax_tree_node tn)
{
string_ref sr=new string_ref();
get_node_info gni=new get_node_info(sr);
tn.visit(gni);
return sr.s;
}
示例2: ProcessNode
protected bool visitNode = true; // в OnEnter можно сделать false
public virtual void ProcessNode(syntax_tree_node Node)
{
if (Node != null)
{
if (OnEnter != null)
OnEnter(Node);
if (visitNode)
Node.visit(this);
else visitNode = true;
if (OnLeave != null)
OnLeave(Node);
}
}
示例3: Exit
public override void Exit(syntax_tree_node st)
{
if (st is procedure_definition)
{
if (mids.vars.Count>0)
{
d[st as procedure_definition] = new HashSet<string>(mids.vars);
}
var fld = new FindLocalDefsVisitor();
st.visit(fld);
fld.Print();
var t = fld.ids.Intersect(mids.vars); // идентификаторы, захваченные из локального контекста
}
base.Exit(st);
}
示例4: prepare_node_with_text
private void prepare_node_with_text(syntax_tree_node subnode, string text)
{
if (subnode==null)
{
return;
}
TreeNode tn=new TreeNode();
tn.Text=text;
tn.Tag=subnode;
string s=get_node_info.node(subnode);
if (s!=null)
{
tn.Text+=" "+s;
}
//tn.Nodes.Clear();
visualizator vs=new visualizator(tn.Nodes);
subnode.visit(vs);
nodes.Add(tn);
}
示例5: Convert
public syntax_tree_node Convert(syntax_tree_node root)
{
root.visit(new MarkMethodHasYieldAndCheckSomeErrorsVisitor());
ProcessYieldCapturedVarsVisitor.New.ProcessNode(root);
//root.visit(py); - пропускал корень
#if DEBUG
try
{
//root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt"));
}
catch
{
}
#endif
return root;
}
示例6: visit_node
private void visit_node(syntax_tree_node sn)
{
if (sn != null && !(sn is empty_statement))
{
if (!caret_syn_node_found && sn.source_context != null && GetPosition(sn.source_context.begin_position.line_num, sn.source_context.begin_position.column_num) >= caret_pos)
{
caret_syn_node_found = true;
if (GetPosition(sn.source_context.begin_position.line_num, sn.source_context.begin_position.column_num) == caret_pos)
{
output_caret_line = sn.source_context.begin_position.line_num;
output_caret_col = sn.source_context.begin_position.column_num;
}
else
if (prev_sn != null && prev_sn.source_context != null)
{
output_caret_line = prev_sn.source_context.begin_position.line_num;
output_caret_col = prev_sn.source_context.begin_position.column_num;
}
else if (sn.source_context != null)
{
output_caret_line = sn.source_context.begin_position.line_num;
output_caret_col = sn.source_context.begin_position.column_num;
}
}
if (!(sn is block) && !(sn is declarations) && !(sn is class_body && has_members(sn as class_body)) &&
!(sn is class_members) && !(sn is procedure_attributes_list) && !(sn is property_accessors) &&
!(sn is exception_block) && !(sn is exception_handler_list))
{
if (sn.source_context != null)
WritePossibleCommentBefore(sn);
if (sn.source_context != null)
prev_sn = sn;
if (sn is variable_definitions || sn is array_type || sn is set_type_definition
|| sn is repeat_node || sn is if_node || sn is while_node || sn is for_node
|| sn is foreach_stmt || sn is var_statement || sn is try_stmt || sn is goto_statement
|| sn is with_statement || sn is case_node || sn is function_header || sn is procedure_header
|| sn is constructor || sn is destructor || sn is type_declarations || sn is consts_definitions_list
|| sn is label_definitions || sn is class_definition || sn is uses_list || sn is unit_name || sn is program_name ||
sn is new_expr || sn is raise_stmt || sn is interface_node || sn is implementation_node
|| sn is lock_stmt || sn is simple_property || sn is read_accessor_name || sn is write_accessor_name
|| sn is formal_parameters || sn is bracket_expr || sn is record_const || sn is array_const || sn is exception_handler
|| sn is try_handler_finally || sn is try_handler_except || sn is external_directive || sn is where_definition
|| (sn is simple_const_definition && in_class && !in_procedure) || (sn is typed_const_definition && in_class && !in_procedure))
read_from_beg_pos = true;
}
sn.visit(this);
if (!(sn is block) && !(sn is declarations) && !(sn is class_body) && !(sn is class_members))
{
if (sn.source_context != null)
WritePossibleCommentAfter(sn);
if (sn.source_context != null /*&& !(sn is exception_handler)*/)
prev_sn = sn;
}
}
}
示例7: Change
public void Change(syntax_tree_node sn)
{
//sn.visit(new CalcConstExprs());
sn.visit(new LoweringVisitor());
sn.visit(new ProcessYieldCapturedVarsVisitor());
}
示例8: Convert
public syntax_tree_node Convert(syntax_tree_node root)
{
root.visit(new ProcessYieldCapturedVarsVisitor());
return root;
}
示例9: ProcessNode
public override void ProcessNode(syntax_tree_node Node)
{
if (Node == null)
return;
if (Node.source_context == null)
return;
if (FindContextIn(Node))
Node.visit(this);
else
{
if (ContextInRightOrder(_findContext, Node.source_context))
{
if (_findResult == null)
_findResult = Node;
else
if (ContextStartsInRightOrder(Node.source_context, _findResult.source_context))
_findResult = Node;
}
}
}
示例10: visit_node
void visit_node(syntax_tree_node node)
{
if (node != null)
node.visit(this);
}