本文整理汇总了C#中PascalABCCompiler.SyntaxTree.declarations类的典型用法代码示例。如果您正苦于以下问题:C# declarations类的具体用法?C# declarations怎么用?C# declarations使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
declarations类属于PascalABCCompiler.SyntaxTree命名空间,在下文中一共展示了declarations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: visit
public override void visit(declarations decls)
{
// Для обхода в правильном порядке сверху вниз
var vd_s = decls.defs.OfType<variable_definitions>().ToArray();
for (int i = 0; i < vd_s.Count(); ++i)
{
ProcessNode(vd_s[i]);
}
}
示例2: visit
/*public override void visit(interface_node node)
{
var globals = node.interface_definitions.defs
.Select(def => def as variable_definitions)
.Where(varDefsObj => (object)varDefsObj != null)
.SelectMany(varDefs => varDefs.var_definitions)
.SelectMany(v => v.vars.idents);
CollectedGlobals.UnionWith(globals);
}*/
public override void visit(declarations node)
{
var globals = node.defs
.Select(def => def as variable_definitions)
.Where(varDefsObj => (object)varDefsObj != null)
.SelectMany(varDefs => varDefs.var_definitions)
.SelectMany(v => v.vars.idents);
CollectedGlobals.UnionWith(globals);
}
示例3: visit
public void visit(declarations _declarations)
{
bw.Write((Int16)21);
write_declarations(_declarations);
}
示例4: program_body
///<summary>
///Конструктор с параметрами.
///</summary>
public program_body(uses_list _used_units,declarations _program_definitions,statement_list _program_code,using_list _using_list,SourceContext sc)
{
this._used_units=_used_units;
this._program_definitions=_program_definitions;
this._program_code=_program_code;
this._using_list=_using_list;
source_context = sc;
}
示例5: declarations_as_statement
///<summary>
///Конструктор с параметрами.
///</summary>
public declarations_as_statement(declarations _defs,SourceContext sc)
{
this._defs=_defs;
source_context = sc;
}
示例6: c_module
///<summary>
///Конструктор с параметрами.
///</summary>
public c_module(string _file_name,List<compiler_directive> _compiler_directives,LanguageId _Language,declarations _defs,uses_list _used_units,SourceContext sc)
{
this._file_name=_file_name;
this._compiler_directives=_compiler_directives;
this._Language=_Language;
this._defs=_defs;
this._used_units=_used_units;
source_context = sc;
}
示例7: block
///<summary>
///Конструктор с параметрами.
///</summary>
public block(declarations _defs,statement_list _program_code)
{
this._defs=_defs;
this._program_code=_program_code;
}
示例8: CreateNonTerminalObject
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//CreateNonTerminalObject
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public Object CreateNonTerminalObject(int ReductionRuleIndex)
{
switch (ReductionRuleIndex)
{
case (int)RuleConstants.RULE_SEPARATOR_TK_SEMICOLON:
//<Separator> ::= 'tk_SemiColon'
return LRParser.GetReductionSyntaxNode(0);
case (int)RuleConstants.RULE_SEPARATOR_TK_NEWLINE:
//<Separator> ::= 'tk_NewLine'
return LRParser.GetReductionSyntaxNode(0);
case (int)RuleConstants.RULE_SEPARATORS:
//<Separators> ::= <Separators> <Separator>
return LRParser.GetReductionSyntaxNode(1);
case (int)RuleConstants.RULE_SEPARATORS2:
//<Separators> ::= <Separator>
return LRParser.GetReductionSyntaxNode(0);
case (int)RuleConstants.RULE_SEPARATORSOPT:
//<Separators Opt> ::= <Separator> <Separators Opt>
return LRParser.GetReductionSyntaxNode(0);
case (int)RuleConstants.RULE_SEPARATORSOPT2:
//<Separators Opt> ::=
return null;
case (int)RuleConstants.RULE_PROGRAM_TK_ALG_TK_IDENTIFIER_TK_BEGIN_TK_END:
//<Program> ::= <Separators Opt> <Global_part> 'tk_alg' 'tk_Identifier' <Separators> 'tk_begin' <Statements> 'tk_end' <Sub_declarations>
{
program_module _program_module;
block _block;
statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(6));
program_name _program_name = new program_name((ident)LRParser.GetReductionSyntaxNode(3));
if ((_units[this.unit_number - 1] as unit_data).initialization.subnodes.Count != 0)
_statement_list.subnodes.InsertRange(0, (_units[this.unit_number - 1] as unit_data).initialization.subnodes);
if ((_units[this.unit_number - 1] as unit_data).sub_progs.defs.Count != 0)
_block = new block((_units[this.unit_number - 1] as unit_data).sub_progs, _statement_list);
else
_block = new block(null, _statement_list);
(_units[this.unit_number - 1] as unit_data).used_units.idents.Add(new ident("MathForKumir"));
if ((_units[this.unit_number - 1] as unit_data).used_units.idents.Count != 0)
{
unit_or_namespace _unit_or_namespace;
uses_list _uses_list = new uses_list();
for (int i = 0; i < (_units[this.unit_number - 1] as unit_data).used_units.idents.Count; i++)
{
ident_list _ident_list = new ident_list();
_ident_list.idents.Add((_units[this.unit_number - 1] as unit_data).used_units.idents[i]);
_unit_or_namespace = new unit_or_namespace(_ident_list);
_uses_list.units.Add(_unit_or_namespace);
}
_program_module = new program_module(_program_name, _uses_list, _block, null);
}
else
_program_module = new program_module(_program_name, null, _block, null);
declarations _declarations = new declarations();
_program_module.Language = LanguageId.PascalABCNET;
parsertools.create_source_context(_program_module, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(3)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(7), LRParser.GetReductionSyntaxNode(6)));
parsertools.create_source_context(_block, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(7)));
parsertools.create_source_context(_program_name, LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(3));
return _program_module;
}
case (int)RuleConstants.RULE_PROGRAM_TK_ISP_TK_IDENTIFIER_TK_END:
//<Program> ::= <Separators Opt> 'tk_isp' 'tk_Identifier' <Separators> <Global_part> <Sub_declarations> 'tk_end'
{
interface_node _interface_node;
(_units[this.unit_number - 1] as unit_data).used_units.idents.Add(new ident("MathForKumir"));
if ((_units[this.unit_number - 1] as unit_data).used_units.idents.Count > 0)
{
unit_or_namespace _unit_or_namespace;
uses_list _uses_list = new uses_list();
for (int i = 0; i < (_units[this.unit_number - 1] as unit_data).used_units.idents.Count; i++)
{
ident_list _ident_list = new ident_list();
_ident_list.idents.Add((_units[this.unit_number - 1] as unit_data).used_units.idents[i]);
_unit_or_namespace = new unit_or_namespace(_ident_list);
_uses_list.units.Add(_unit_or_namespace);
}
_interface_node = new interface_node((_units[this.unit_number - 1] as unit_data).sub_progs, _uses_list, null);
}
else
_interface_node = new interface_node((_units[this.unit_number - 1] as unit_data).sub_progs, null, null);
unit_module _unit_module = new unit_module(new unit_name((ident)LRParser.GetReductionSyntaxNode(2), 0), _interface_node, null, (_units[this.unit_number - 1] as unit_data).initialization, null);
_unit_module.Language = LanguageId.PascalABCNET;
unit_name _unit_name = new unit_name((ident)LRParser.GetReductionSyntaxNode(2), 0);
//.........这里部分代码省略.........
示例9: unit_data
public unit_data()
{
sub_progs = new declarations();
used_units = new ident_list();
initialization = new statement_list();
initialization.subnodes.Add(new empty_statement());
}
示例10: visit
public override void visit(declarations _declarations)
{
throw new NotImplementedException();
}
示例11: read_declarations
public void read_declarations(declarations _declarations)
{
read_syntax_tree_node(_declarations);
if (br.ReadByte() == 0)
{
_declarations.defs = null;
}
else
{
_declarations.defs = new List<declaration>();
Int32 ssyy_count = br.ReadInt32();
for(Int32 ssyy_i = 0; ssyy_i < ssyy_count; ssyy_i++)
{
_declarations.defs.Add(_read_node() as declaration);
}
}
}
示例12: visit
public void visit(declarations _declarations)
{
read_declarations(_declarations);
}
示例13: visit
public override void visit(declarations _subprogram_definitions)
{
//for(int i=0;i<_subprogram_definitions.defs.Count;i++)
//{
// subprogram_definition sd=_subprogram_definitions.defs[i];
// prepare_node(sd,"defs["+i.ToString()+"]");
//}
prepare_collection(_subprogram_definitions.defs,"defs");
}
示例14: visit
public override void visit(declarations _declarations)
{
foreach (declaration decl in _declarations.defs)
{
if ((decl is procedure_definition || decl is short_func_definition) && in_procedure)
{
//insert_newline_after_prev_semicolon = true;
IncOffset();
}
visit_node(decl);
if ((decl is procedure_definition || decl is short_func_definition) && in_procedure)
DecOffset();
}
}
示例15: implementation_node
///<summary>
///Конструктор с параметрами.
///</summary>
public implementation_node(uses_list _uses_modules,declarations _implementation_definitions,using_list _using_namespaces)
{
this._uses_modules=_uses_modules;
this._implementation_definitions=_implementation_definitions;
this._using_namespaces=_using_namespaces;
}