本文整理汇总了C#中PascalABCCompiler.SyntaxTree.syntax_tree_node类的典型用法代码示例。如果您正苦于以下问题:C# syntax_tree_node类的具体用法?C# syntax_tree_node怎么用?C# syntax_tree_node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
syntax_tree_node类属于PascalABCCompiler.SyntaxTree命名空间,在下文中一共展示了syntax_tree_node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: write_syntax_tree_node
public void write_syntax_tree_node(syntax_tree_node _syntax_tree_node)
{
if (_syntax_tree_node.source_context == null)
{
bw.Write((byte)0);
}
else
{
bw.Write((byte)1);
if (_syntax_tree_node.source_context.begin_position == null)
{
bw.Write((byte)0);
}
else
{
bw.Write((byte)1);
bw.Write(_syntax_tree_node.source_context.begin_position.line_num);
bw.Write(_syntax_tree_node.source_context.begin_position.column_num);
}
if (_syntax_tree_node.source_context.end_position == null)
{
bw.Write((byte)0);
}
else
{
bw.Write((byte)1);
bw.Write(_syntax_tree_node.source_context.end_position.line_num);
bw.Write(_syntax_tree_node.source_context.end_position.column_num);
}
}
}
示例2: 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;
}
示例3: VarFinderSyntaxVisitor
/// <summary>
/// Конструктор
/// </summary>
/// <param name="root">Корень обходимого поддерева</param>
/// <param name="context">Контекст. Необходим для поиска переменных</param>
/// <param name="isForNode">True при обходе цикла, False при обходе секций</param>
public VarFinderSyntaxVisitor(syntax_tree_node root, compilation_context context, bool isForNode)
{
this.isForNode = isForNode;
this.context = context;
ProcessNode(root);
FixResultVar();
}
示例4: prepare_node
public void prepare_node(syntax_tree_node subnode, string node_name)
{
if (subnode==null)
{
return;
}
prepare_node_with_text(subnode,node_name+":"+subnode.GetType().Name);
}
示例5: Enter
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
if (!(st is procedure_definition || st is block || st is statement_list || st is case_node || st is for_node || st is foreach_stmt || st is if_node || st is repeat_node || st is while_node || st is with_statement || st is try_stmt || st is lock_stmt))
{
//visitNode = false;
}
}
示例6: CapturedVariablesTreeNode
protected CapturedVariablesTreeNode(CapturedVariablesTreeNode parentNode, int scopeNum, syntax_tree_node correspondingSyntaxTreeNode)
{
ParentNode = parentNode;
ChildNodes = new List<CapturedVariablesTreeNode>();
VariablesDefinedInScope = new List<CapturedSymbolInfo>();
ScopeIndex = scopeNum;
CorrespondingSyntaxTreeNode = correspondingSyntaxTreeNode;
LambdasDefinedInScope = new List<CapturedVariablesTreeNodeLambdaScope>();
}
示例7: Find
public syntax_tree_node Find(SyntaxTree.compilation_unit unit, SourceContext findContext)
{
_findContext = findContext;
_findResult = null;
//unit.visit(this);
ProcessNode(unit);
return _findResult;
}
示例8: Enter
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
// Не заходим во вложенные циклы, там свои break-continue
if ((st is for_node || st is foreach_stmt || st is while_node || st is repeat_node))
{
visitNode = false;
}
}
示例9: Exit
public override void Exit(syntax_tree_node st)
{
if (st.GetType() == typeof(program_module))
{
var t = (DateTime.Now - d).Milliseconds;
fs.WriteLine(t.ToString());
fs.Close();
}
}
示例10: Enter
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
if (st is procedure_definition || st is class_definition)
{
list.Add(st as declaration);
if (PrintInfo)
Console.Write("+: "+st.GetType().Name);
}
}
示例11: Enter
public override void Enter(syntax_tree_node st)
{
if (d.ContainsKey(st.GetType()))
d[st.GetType()] += 1;
else d[st.GetType()] = 1;
if (st is expression)
exprcount++;
if (st is statement)
statcount++;
}
示例12: Exit
public override void Exit(syntax_tree_node st)
{
if (st is procedure_definition || st is class_definition)
{
if (PrintInfo)
Console.WriteLine("-: " + st.GetType().Name);
list.RemoveAt(list.Count - 1);
}
base.Exit(st);
}
示例13: Enter
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
countNodesVisited++;
// сокращение обходимых узлов. Как сделать фильтр по тем узлам, которые необходимо обходить? Например, все операторы (без выражений и описаний), все описания (без операторов)
if (st is assign || st is var_def_statement || st is procedure_call || st is procedure_header || st is expression)
{
visitNode = false; // фильтр - куда не заходить
}
}
示例14: Enter
public override void Enter(syntax_tree_node st)
{
base.Enter(st);
if (!(st is procedure_definition || st is block || st is statement_list
|| st.GetType() == typeof(case_node) || st.GetType() == typeof(for_node) || st.GetType() == typeof(foreach_stmt)
|| st.GetType() == typeof(if_node)
|| st.GetType() == typeof(repeat_node) || st.GetType() == typeof(while_node)
|| st.GetType() == typeof(with_statement) || st is try_stmt || st.GetType() == typeof(lock_stmt)))
{
//visitNode = false;
}
}
示例15: NewProgramModule
public program_module NewProgramModule(program_name progName, Object optHeadCompDirs, uses_list mainUsesClose, syntax_tree_node progBlock, Object optPoint, LexLocation loc)
{
var progModule = new program_module(progName, mainUsesClose, progBlock as block, null, loc);
progModule.Language = LanguageId.PascalABCNET;
if (optPoint == null && progBlock != null)
{
var fp = progBlock.source_context.end_position;
var err_stn = progBlock;
if ((progBlock is block) && (progBlock as block).program_code != null && (progBlock as block).program_code.subnodes != null && (progBlock as block).program_code.subnodes.Count > 0)
err_stn = (progBlock as block).program_code.subnodes[(progBlock as block).program_code.subnodes.Count - 1];
parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.CurrentFileName, StringResources.Get("TKPOINT"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
}
return progModule;
}