本文整理汇总了C#中SyntaxTree.visit方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxTree.visit方法的具体用法?C# SyntaxTree.visit怎么用?C# SyntaxTree.visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxTree
的用法示例。
在下文中一共展示了SyntaxTree.visit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: visit
public expression_node visit(SyntaxTree.expression expr)
{
expr.visit(syntax_tree_visitor);
/*addressed_expression ad = ret_semantic as addressed_expression;
if (ad != null && ad.is_addressed)
{
if (convertion_data_and_alghoritms.check_for_constant(ad))
ad.is_addressed = false;
}*/
//Надеюсь, это сильно не скажется на производительности, хотя в другом случае этот же код просто будет разбросан по всем метдам syntax_tree_visitor-а.
base_function_call bfc = ret_semantic as base_function_call;
if (bfc != null)
{
if (bfc.simple_function_node.compile_time_executor != null)
{
expression_node ex = bfc.simple_function_node.compile_time_executor(bfc.location, bfc.parameters.ToArray());
if (ex != null)
{
return ex;
}
}
}
return ret_semantic as expression_node;
}
示例2: hard_node_test_and_visit
public void hard_node_test_and_visit(SyntaxTree.syntax_tree_node tn)
{
#if (DEBUG)
// try
// {
if (tn == null)
{
throw new CompilerInternalError("This node can not be null");
}
#endif
convertion_data_and_alghoritms.check_node_parser_error(tn);
if (is_direct_type_decl && !(tn is SyntaxTree.ref_type))
is_direct_type_decl = false;
tn.visit(this);
/*#if (DEBUG)
}
catch (Exception e)
{
if (tn != null)
throw new Exception("" + tn.source_context.ToString() + System.Environment.NewLine + e.ToString());
else throw e;
}
#endif*/
}
示例3: weak_node_test_and_visit
public void weak_node_test_and_visit(SyntaxTree.syntax_tree_node tn)
{
if (tn != null)
{
convertion_data_and_alghoritms.check_node_parser_error(tn);
tn.visit(this);
}
}
示例4: CompileInterface
//TODO: Исправить коллекцию модулей.
public PascalABCCompiler.TreeRealization.common_unit_node CompileInterface(SyntaxTree.compilation_unit SyntaxUnit,
PascalABCCompiler.TreeRealization.unit_node_list UsedUnits, List<Errors.Error> ErrorsList, List<Errors.CompilerWarning> WarningsList, PascalABCCompiler.Errors.SyntaxError parser_error,
System.Collections.Hashtable bad_nodes, TreeRealization.using_namespace_list namespaces, Dictionary<SyntaxTree.syntax_tree_node,string> docs, bool debug, bool debugging)
{
//convertion_data_and_alghoritms.__i = 0;
stv.parser_error=parser_error;
stv.bad_nodes_in_syntax_tree = bad_nodes;
stv.referenced_units=UsedUnits;
//stv.comp_units=UsedUnits;
//stv.visit(SyntaxUnit
//stv.interface_using_list = namespaces;
stv.using_list.clear();
stv.interface_using_list.clear();
stv.using_list.AddRange(namespaces);
stv.current_document = new TreeRealization.document(SyntaxUnit.file_name);
stv.ErrorsList = ErrorsList;
stv.WarningsList = WarningsList;
stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive;
stv.docs = docs;
stv.debug = debug;
stv.debugging = debugging;
SystemLibrary.SystemLibrary.syn_visitor = stv;
SetSemanticRules(SyntaxUnit);
foreach (SyntaxTree.compiler_directive cd in SyntaxUnit.compiler_directives)
cd.visit(stv);
stv.DirectivesToNodesLinks = CompilerDirectivesToSyntaxTreeNodesLinker.BuildLinks(SyntaxUnit, ErrorsList); //MikhailoMMX добавил передачу списка ошибок (02.10.10)
SyntaxUnit.visit(stv);
/*SyntaxTree.program_module pmod=SyntaxUnit as SyntaxTree.program_module;
if (pmod!=null)
{
stv.visit(pmod);
}
else
{
SyntaxTree.unit_module umod=SyntaxUnit as SyntaxTree.unit_module;
if (umod==null)
{
throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Undefined module type (not program and not unit)");
}
stv.visit(umod);
}*/
//stv.visit(SyntaxUnit);
//if (ErrorsList.Count>0) throw ErrorsList[0];
return stv.compiled_unit;
}