本文整理汇总了C#中PascalABCCompiler.SyntaxTree.named_type_reference类的典型用法代码示例。如果您正苦于以下问题:C# named_type_reference类的具体用法?C# named_type_reference怎么用?C# named_type_reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
named_type_reference类属于PascalABCCompiler.SyntaxTree命名空间,在下文中一共展示了named_type_reference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateVarDef
/// <summary>
/// Создать var-выражение с несколькими переменными
/// </summary>
/// <param name="type">Тип переменных</param>
/// <param name="idents">Имена переменных</param>
/// <returns></returns>
public var_def_statement CreateVarDef(named_type_reference type, params string[] names)
{
var_def_statement res = new var_def_statement();
foreach (string x in names)
res.vars.Add(new ident(x));
res.vars_type = type;
return res;
}
示例2: CreateNonTerminalObject
//.........这里部分代码省略.........
method_name _method_name = new method_name(null, (ident)func_name[k], null);
parsertools.create_source_context(_method_name, func_name[k], func_name[k]);
function_header _function_header = new function_header();
object rt = new object();
_function_header.name = _method_name;
if (_function_header.name.meth_name is template_type_name)
{
_function_header.template_args = (_function_header.name.meth_name as template_type_name).template_args;
ident id = new ident(_function_header.name.meth_name.name);
parsertools.create_source_context(id, _function_header.name.meth_name, _function_header.name.meth_name);
_function_header.name.meth_name = id;
}
////////////////////////////////params
formal_parameters _formal_parametres = new formal_parameters();
expression_list f = null;
if (((ArrayList)param_value_list_main[k])[0] != null)
{
f = (expression_list)((ArrayList)param_value_list_main[k])[((ArrayList)param_value_list_main[k]).Count - 1];
string s = "";
for (int i = 0; i < ((ArrayList)param_value_list_main[k]).Count; i++)
{
for (int j = 0; j < ((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions.Count; j++)
if (((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions[j] is ident)
s += ((ident)((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions[j]).name;
}
for (int i = 0; i < ((expression_list)((ArrayList)param_value_list_main[k])[((ArrayList)param_value_list_main[k]).Count - 1]).expressions.Count; i++)
{
ident_list _ident_list = new ident_list();
ident id = new ident(s + i.ToString());
_ident_list.source_context = id.source_context;
_ident_list.idents.Add(id);
named_type_reference _named_type_reference1 = new named_type_reference();
ident idtype1 = new ident("datatype");
_named_type_reference1.source_context = idtype1.source_context;
_named_type_reference1.names.Add(idtype1);
typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference1, parametr_kind.none, null);
parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference1);
_formal_parametres.params_list.Add(_typed_parametres);
}
_function_header.parameters = _formal_parametres;
}
//////////////////////////type
{
named_type_reference _named_type_reference11 = new named_type_reference();
ident idtype11 = new ident("datatype");
_named_type_reference11.source_context = idtype11.source_context;
_named_type_reference11.names.Add(idtype11);
rt = _named_type_reference11;
_function_header.return_type = (type_definition)_named_type_reference11;
}
_function_header.of_object = false;
_function_header.class_keyword = false;
token_info _token_info = new token_info("function");
_token_info.source_context = parsertools.GetTokenSourceContext();
parsertools.create_source_context(_function_header, _token_info, rt);
//////////////////////////////////////block
statement_list stmt_l = new statement_list();
示例3: visit
public void visit(named_type_reference _named_type_reference)
{
bw.Write((Int16)16);
write_named_type_reference(_named_type_reference);
}
示例4: NewVarOrIdentifier
public var_def_statement NewVarOrIdentifier(ident identifier, named_type_reference fptype, LexLocation loc)
{
var n_t_r = fptype;
var vds = new var_def_statement();
vds.vars = new ident_list();
vds.vars.idents.Add(identifier);
vds.vars_type = n_t_r;
vds.source_context = loc;
return vds;
}
示例5: attribute
///<summary>
///Конструктор с параметрами.
///</summary>
public attribute(ident _qualifier,named_type_reference _type,expression_list _arguments)
{
this._qualifier=_qualifier;
this._type=_type;
this._arguments=_arguments;
}
示例6: default_operator
///<summary>
///Конструктор с параметрами.
///</summary>
public default_operator(named_type_reference _type_name)
{
this._type_name=_type_name;
}
示例7: template_type_reference
///<summary>
///Конструктор с параметрами.
///</summary>
public template_type_reference(type_definition_attr_list _attr_list,List<ident> _names,named_type_reference _name,template_param_list _params_list,SourceContext sc)
{
this._attr_list=_attr_list;
this._names=_names;
this._name=_name;
this._params_list=_params_list;
source_context = sc;
}
示例8: CreateVarStatementNode
public static var_statement CreateVarStatementNode(string idName, string varTypeName, expression initValue)
{
var id = new ident(idName);
var idlist = new ident_list(id);
var varType = new named_type_reference(varTypeName, null);
var vdef = new var_def_statement(idlist, varType, initValue, definition_attribute.None, false, null);
return new var_statement(vdef, null);
}
示例9: visit
public override void visit(named_type_reference _named_type_reference)
{
ret_tn = cur_scope;
for (int i = 0; i < _named_type_reference.names.Count; i++)
{
if (i > 0)
ret_tn = ret_tn.FindNameOnlyInType(_named_type_reference.names[i].name);
else ret_tn = ret_tn.FindNameInAnyOrder(_named_type_reference.names[i].name);
if (ret_tn == null) break;
else if (founded_scope.IsEqual(ret_tn))
pos_list.Add(get_position(_named_type_reference));
}
}
示例10: visit
public override void visit(named_type_reference _named_type_reference)
{
//throw new Exception("The method or operation is not implemented.");
returned_scope = cur_scope;
for (int i = 0; i < _named_type_reference.names.Count; i++)
{
if (i > 0)
returned_scope = returned_scope.FindNameOnlyInType(_named_type_reference.names[i].name);
else returned_scope = returned_scope.FindName(_named_type_reference.names[i].name);
if (returned_scope == null) break;
}
if (returned_scope == null || !(returned_scope is TypeScope))
returned_scope = new UnknownScope(new SymInfo(_named_type_reference.names[_named_type_reference.names.Count - 1].name, SymbolKind.Type, _named_type_reference.names[_named_type_reference.names.Count - 1].name));
}
示例11: get_type_reference
private type_definition get_type_reference(ICSharpCode.NRefactory.Ast.TypeReference tr)
{
string[] names = tr.Type.Split('.');
named_type_reference ntr = new named_type_reference();
ntr.source_context = get_source_context(tr);
for (int i=0; i<names.Length; i++)
ntr.names.Add(new ident(names[i]));
return ntr;
}
示例12: constructor_rec_var
public void constructor_rec_var(statement_list body, new_expr n_e)
{
ident id = null;
string name_corteg = "";
for (int ii = 2; ii < n_e.params_list.expressions.Count; ii++)
if (n_e.params_list.expressions[ii] is ident)
name_corteg += ((ident)n_e.params_list.expressions[ii]).name;
if (name_corteg=="")
name_corteg = "$$";
name_corteg+=rec_num;
rec_num++;
id = new ident(name_corteg);
ident_list _ident_list1 = new ident_list();
_ident_list1.idents.Add(id);
string name_param2 = id.name;
typed_parameters _typed_parametres2 = null;
named_type_reference _named_type_reference3 = new named_type_reference();
ident idtype3 = new ident("datatype");
_named_type_reference3.names.Add(idtype3);
var_def_statement _var_def_statement2 = new var_def_statement(_ident_list1, (type_definition)_named_type_reference3, null, definition_attribute.None, false);
var_statement _var_statement2 = new var_statement(_var_def_statement2);
body.subnodes.Add(_var_statement2);
for (int ii = 2; ii < n_e.params_list.expressions.Count; ii++)
{
if (n_e.params_list.expressions[ii] is ident)
{
ident id1 = (ident)n_e.params_list.expressions[ii];
ident_list _ident_list = new ident_list();
_ident_list.idents.Add(id1);
typed_parameters _typed_parametres = null;
named_type_reference _named_type_reference = new named_type_reference();
ident idtype = new ident("datatype");
_named_type_reference.names.Add(idtype);
var_def_statement _var_def_statement = new var_def_statement(_ident_list, (type_definition)_named_type_reference, null, definition_attribute.None, false);
var_statement _var_statement = new var_statement(_var_def_statement);
body.subnodes.Add(_var_statement);
}
else
constructor_rec_var(body, (new_expr)n_e.params_list.expressions[ii]);
}
}
示例13: while
/*public procedure_definition find_let_lambda_name(string name)
{
int i = 0;
while (i < let_funcs.Count && ((procedure_definition)let_funcs[i]).proc_header.name.meth_name.name != name)
i++;
if (i < let_funcs.Count)
return (procedure_definition)let_funcs[i];
else
return null;
}*/
public type_definition func_type(int count)
{
//int count = mc.parameters.expressions.Count;
formal_parameters _formal_parametres = new formal_parameters();
for (int i = 0; i < count; i++)
{
ident_list _ident_list = new ident_list();
ident id = new ident("$a" + i.ToString());
_ident_list.idents.Add(id);
named_type_reference _named_type_reference1 = new named_type_reference();
ident idtype1 = new ident("datatype");
_named_type_reference1.names.Add(idtype1);
typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference1, parametr_kind.none, null);
_formal_parametres.params_list.Add(_typed_parametres);
}
named_type_reference _named_type_reference = new named_type_reference();
ident idtype = new ident("datatype");
_named_type_reference.names.Add(idtype);
function_header _function_header = new function_header();
_function_header.parameters = _formal_parametres;
_function_header.return_type = (type_definition)_named_type_reference;
_function_header.of_object = false;
_function_header.class_keyword = false;
return (type_definition)_function_header;
}
示例14: lambda
public procedure_definition lambda(function_lambda_definition _function_lambda_definition)
{
SyntaxTree.procedure_definition _func_def = new PascalABCCompiler.SyntaxTree.procedure_definition();
SyntaxTree.method_name _method_name1 = new SyntaxTree.method_name(null, new SyntaxTree.ident(_function_lambda_definition.lambda_name), null);
SyntaxTree.function_header _function_header1 = new SyntaxTree.function_header();
object rt1 = new object();
_function_header1.name = _method_name1;
SyntaxTree.formal_parameters fps = new PascalABCCompiler.SyntaxTree.formal_parameters();
_function_header1.parameters = _function_lambda_definition.formal_parameters;//fps;
SyntaxTree.named_type_reference _named_type_reference = new SyntaxTree.named_type_reference();
SyntaxTree.ident idtype = new SyntaxTree.ident("datatype");
_named_type_reference.source_context = idtype.source_context;
_named_type_reference.names.Add(idtype);
rt1 = _named_type_reference;
_function_header1.return_type = (SyntaxTree.type_definition)_named_type_reference;
_function_header1.of_object = false;
_function_header1.class_keyword = false;
SyntaxTree.block _block1 = new SyntaxTree.block(null, null);
SyntaxTree.statement_list sl1 = new SyntaxTree.statement_list();
sl1.subnodes.Add(_function_lambda_definition.proc_body);
_block1.program_code = sl1;
_func_def.proc_header = _function_header1;
_func_def.proc_body = (SyntaxTree.proc_block)_block1;
if (_function_lambda_definition.defs != null)
{
if (((block)_func_def.proc_body).defs == null)
((block)_func_def.proc_body).defs = new declarations();
for (int l = 0; l < _function_lambda_definition.defs.Count; l++)
((block)_func_def.proc_body).defs.defs.Add(_function_lambda_definition.defs[l] as procedure_definition);
}
_function_lambda_definition.proc_definition = _func_def;
return _func_def;
}
示例15: exception_ident
///<summary>
///Конструктор с параметрами.
///</summary>
public exception_ident(ident _variable,named_type_reference _type_name,SourceContext sc)
{
this._variable=_variable;
this._type_name=_type_name;
source_context = sc;
}