本文整理汇总了C#中PascalABCCompiler.Parsers.SymInfo类的典型用法代码示例。如果您正苦于以下问题:C# SymInfo类的具体用法?C# SymInfo怎么用?C# SymInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SymInfo类属于PascalABCCompiler.Parsers命名空间,在下文中一共展示了SymInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitModules
private void InitModules()
{
try
{
string[] files = Directory.GetFiles(CodeCompletionController.comp.CompilerOptions.SearchDirectory,"*.pas");
standard_units = new SymInfo[files.Length];
int i=0;
foreach (string s in files)
{
SymInfo si = new SymInfo(Path.GetFileNameWithoutExtension(s), SymbolKind.Namespace,null);
si.IsUnitNamespace = true;
standard_units[i++] = si;
}
}
catch(Exception e)
{
//standard_units = new SymInfo[0];
}
}
示例2: AddDescribeToComplete
public static void AddDescribeToComplete(SymInfo si, ConstructorInfo ci)
{
elem_cache.Add(ci);
doc_wait_list[ci] = si;
}
示例3: InterfaceUnitScope
public InterfaceUnitScope(SymInfo si, SymScope topScope)
: base(si, topScope)
{
UnitDocCache.AddDescribeToComplete(this);
this.symbol_table = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
si.description = this.ToString();
}
示例4: CompiledConstructorScope
public CompiledConstructorScope(SymInfo si, ConstructorInfo mi, CompiledScope declaringType)
{
this.si = si;
this.mi = mi;
//if (mi.ReturnType != typeof(void))
return_type = TypeTable.get_compiled_type(mi.DeclaringType);
if (si.name == null)
AssemblyDocCache.AddDescribeToComplete(this.si, mi);
parameters = new List<ElementScope>();
foreach (ParameterInfo pi in mi.GetParameters())
parameters.Add(new CompiledParameterScope(new SymInfo(pi.Name, SymbolKind.Parameter, pi.Name), pi));
this.si.name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortTypeName(this);
this.si.description = this.ToString();//+"\n"+AssemblyDocCache.GetDocumentation(mi.DeclaringType.Assembly,"M:"+mi.DeclaringType.FullName+".#ctor"+GetParamNames());
this.topScope = declaringType;
if (mi.IsPrivate)
{
this.si.acc_mod = access_modifer.private_modifer;
this.acc_mod = access_modifer.private_modifer;
}
else if (mi.IsFamily || mi.IsFamilyOrAssembly)
{
this.acc_mod = access_modifer.protected_modifer;
this.si.acc_mod = access_modifer.protected_modifer;
}
else if (mi.IsFamilyAndAssembly || mi.IsAssembly)
{
this.acc_mod = access_modifer.internal_modifer;
this.si.acc_mod = access_modifer.internal_modifer;
}
}
示例5: CompiledParameterScope
public CompiledParameterScope(SymInfo si, ParameterInfo pi)
{
this.si = si;
this.pi = pi;
this.sc = TypeTable.get_compiled_type(pi.ParameterType);
if (pi.ParameterType.IsByRef)
this.param_kind = parametr_kind.var_parametr;
else if (is_params(pi))
this.param_kind = parametr_kind.params_parametr;
//MakeDescription();
}
示例6: CompiledEventScope
public CompiledEventScope(SymInfo si, EventInfo ei, CompiledScope declaringType)
{
this.si = si;
this.ei = ei;
string[] args = declaringType.TemplateArguments;
if (args != null)
{
generic_args = new List<string>();
generic_args.AddRange(args);
}
if (generic_args != null)
{
//TypeScope ts = declaringType.instances[ei.EventHandlerType.GenericParameterPosition];
this.sc = CompiledScope.get_type_instance(ei.EventHandlerType, declaringType.instances);
}
else
this.sc = TypeTable.get_compiled_type(ei.EventHandlerType);
if (si.name == null)
AssemblyDocCache.AddDescribeToComplete(this.si, ei);
this.si.name = ei.Name;
this.si.description = this.ToString();
this.topScope = declaringType;
MethodInfo acc_mi = ei.GetAddMethod(true);
is_static = acc_mi.IsStatic;
if (acc_mi.IsPrivate)
{
this.acc_mod = access_modifer.private_modifer;
this.si.acc_mod = access_modifer.private_modifer;
}
else if (acc_mi.IsFamily || acc_mi.IsFamilyOrAssembly)
{
this.acc_mod = access_modifer.protected_modifer;
this.si.acc_mod = access_modifer.protected_modifer;
}
else if (acc_mi.IsFamilyAndAssembly || acc_mi.IsAssembly)
{
this.acc_mod = access_modifer.internal_modifer;
this.si.acc_mod = access_modifer.internal_modifer;
}
//this.si.describe += "\n"+AssemblyDocCache.GetDocumentation(ei.DeclaringType.Assembly,"E:"+ei.DeclaringType.FullName+"."+ei.Name);
}
示例7: GetNamesAsInObject
public override SymInfo[] GetNamesAsInObject()
{
List<SymInfo> syms = new List<SymInfo>();
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
return syms.ToArray();
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.Instance);
foreach (MemberInfo mi in mis)
if (!mi.Name.Contains("$"))
switch (mi.MemberType)
{
case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
si2 = new CompiledMethodScope(si2, mi as MethodInfo, this).si;
syms.Add(si2);
}
break;
case MemberTypes.Field:
{
if (!(mi as FieldInfo).IsSpecialName)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
syms.Add(si2);
}
//syms.Add(new SymInfo(mi.Name,SymbolKind.Field,mi.Name)); break;
}
break;
case MemberTypes.Property:
{
SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
syms.Add(si2);
//syms.Add(new SymInfo(mi.Name,SymbolKind.Property,mi.Name));
}
break;
case MemberTypes.Event:
{
SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
syms.Add(si2);
//syms.Add(new SymInfo(mi.Name,SymbolKind.Event,mi.Name));
}
break;
}
return syms.ToArray();
}
示例8: ElementScope
public ElementScope(SymInfo si, SymScope sc, SymScope topScope)
{
this.si = si;
this.sc = sc;
this.topScope = topScope;
MakeDescription();
//UnitDocCache.AddDescribeToComplete(this);
//if (sc is ProcScope) si.kind = SymbolKind.Delegate;
//si.describe = si.name + ": " + sc.ToString();
}
示例9: ImplementationUnitScope
public ImplementationUnitScope(SymInfo si, SymScope topScope)
: base(si, topScope)
{
}
示例10: visit
public override void visit(var_def_statement _var_def_statement)
{
try
{
returned_scope = null;
if (_var_def_statement.vars_type != null)
_var_def_statement.vars_type.visit(this);
if (_var_def_statement.vars_type == null && _var_def_statement.inital_value != null || _var_def_statement.inital_value is function_lambda_definition)
{
_var_def_statement.inital_value.visit(this);
}
// if (si == null) dn = compiled_type_node.get_type_node(PascalABCCompiler.NetHelper.NetHelper.FindType((_var_def_statement.vars_type as named_type_reference).names[0].name,unl));
if (returned_scope == null) return;
if (returned_scope is ProcScope)
{
if (_var_def_statement.vars_type != null)
returned_scope = new ProcType(returned_scope as ProcScope);
else
returned_scope = (returned_scope as ProcScope).return_type;
}
if (_var_def_statement.vars != null)
foreach (ident s in _var_def_statement.vars.idents)
{
SymInfo si = new SymInfo(s.name, SymbolKind.Variable,s.name);
if (cur_scope is TypeScope) si.kind = SymbolKind.Field;
if (_var_def_statement.is_event) si.kind = SymbolKind.Event;
ElementScope es = new ElementScope(si, returned_scope,cur_scope);
if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_var_def_statement))
es.AddDocumentation(this.converter.controller.docs[_var_def_statement]);
es.acc_mod = cur_access_mod;
es.is_static = _var_def_statement.var_attr == definition_attribute.Static;
es.si.acc_mod = cur_access_mod;
es.loc = get_location(s);
cur_scope.AddName(s.name,es);
es.declaringUnit = cur_scope;
}
}
catch(Exception e)
{
}
}
示例11: get_compiled_type
public static CompiledScope get_compiled_type(SymInfo si, Type t)
{
object o = ht[t];
if (o != null)
return o as CompiledScope;
CompiledScope sc = new CompiledScope(si,t);
ht[t] = sc;
return sc;
}
示例12: GetTypes
/// <summary>
/// Выдает все типы (используется после new)
/// </summary>
public SymInfo[] GetTypes(expression expr, int line, int col, out SymInfo out_si)
{
out_si = null;
if (stv.cur_scope == null) return null;
SymScope si = stv.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope;
SymInfo[] elems = null;
if (si == null) return null;
elems = si.GetNamesInAllTopScopes(true, new ExpressionVisitor(si, stv), false);
if (expr != null)
{
ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
si = ev.GetScopeOfExpression();
if (si is TypeScope)
si = new ElementScope(si);
}
List<SymInfo> result_names = new List<SymInfo>();
if (elems == null) return null;
for (int i = 0; i < elems.Length; i++)
{
if (!elems[i].name.StartsWith("$") && (elems[i].kind == SymbolKind.Class || elems[i].kind == SymbolKind.Namespace) && elems[i].kind != SymbolKind.Interface)
{
if (expr != null && si != null && si is ElementScope &&
string.Compare(elems[i].name, (si as ElementScope).sc.si.name, true) == 0)
{
out_si = elems[i];
//out_si = new SymInfo(elems[i].name,elems[i].kind,elems[i].describe);
string s = CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescriptionWithoutNamespace((si as ElementScope).sc as PascalABCCompiler.Parsers.ITypeScope);
if (s != out_si.name)
out_si.addit_name = s;
// if (((si as ElementScope).sc as TypeScope).TemplateArguments != null)
// {
// SymInfo tmp_si = new SymInfo(null,elems[i].kind,elems[i].describe);
// StringBuilder sb = new StringBuilder();
// string[] template_args = ((si as ElementScope).sc as TypeScope).TemplateArguments;
// sb.Append(elems[i].name);
// sb.Append('<');
// for (int j=0; j<template_args.Length; j++)
// {
// sb.Append(template_args[j]);
// if (j<template_args.Length-1)
// sb.Append(',');
// }
// sb.Append('>');
// elems[i] = tmp_si;
// out_si = tmp_si;
// }
}
result_names.Add(elems[i]);
}
}
if (out_si == null && expr != null && si != null && si is ElementScope)
{
out_si = (si as ElementScope).sc.si;
if (!out_si.name.StartsWith("$") && out_si.kind != SymbolKind.Interface)
{
out_si.name = (si as ElementScope).sc.GetFullName();
result_names.Add(out_si);
}
else
{
out_si = null;
}
}
return result_names.ToArray();
}
示例13: GetOverridableMethods
public SymInfo[] GetOverridableMethods(int line, int col)
{
if (stv.cur_scope == null) return null;
SymScope ss = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
if (ss == null) return null;
List<SymInfo> meths = new List<SymInfo>();
SetCurrentUsedAssemblies();
if (ss is TypeScope && ((ss as TypeScope).kind == SymbolKind.Class || (ss as TypeScope).kind == SymbolKind.Struct))
{
TypeScope ts = ss as TypeScope;
if (ts.baseScope != null)
{
List<ProcScope> procs = ts.baseScope.GetOverridableMethods();
for (int i=0; i<procs.Count; i++)
{
SymScope elem = ts.FindNameOnlyInThisType(procs[i].Name);
if (elem == null || !(elem is ProcScope))
{
int pos = 0;
string full_name = CodeCompletionController.CurrentParser.LanguageInformation.ConstructOverridedMethodHeader(procs[i],out pos);
SymInfo si = new SymInfo(full_name.Substring(pos),procs[i].si.kind,full_name);
si.acc_mod = procs[i].si.acc_mod;
meths.Add(si);
}
}
}
}
RestoreCurrentUsedAssemblies();
return meths.ToArray();
}
示例14: GetNames
public override SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
{
List<SymInfo> syms = new List<SymInfo>();
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
return syms.ToArray();
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |/*BindingFlags.Instance|*/BindingFlags.Static | BindingFlags.FlattenHierarchy);
List<MemberInfo> constrs = new List<MemberInfo>();
//constrs.AddRange(ctn.GetNestedTypes(BindingFlags.Public));
//if (ctn != typeof(object))
ConstructorInfo[] cis = ctn.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (ConstructorInfo ci in cis)
if (!called_in_base)
constrs.Add(ci);
else if (ci.GetParameters().Length > 0)
constrs.Add(ci);
constrs.AddRange(mis);
//constrs.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetExtensionMethods(ctn));
mis = constrs.ToArray();
if (ctn.IsInterface)
{
return syms.ToArray();
}
foreach (MemberInfo mi in mis)
if (!mi.Name.Contains("$"))
switch (mi.MemberType)
{
case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName && (mi as MethodInfo).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
CompiledMethodScope member = new CompiledMethodScope(si2, mi as MethodInfo, this);
si2 = member.si;
if (si2.acc_mod == access_modifer.protected_modifer)
{
if (ev.CheckForBaseAccess(ev.entry_scope, this))
syms.Add(si2);
}
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
break;
case MemberTypes.Field:
{
if (!(mi as FieldInfo).IsSpecialName && (mi as FieldInfo).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
if (si2.acc_mod == access_modifer.protected_modifer)
{
if (ev.CheckForBaseAccess(ev.entry_scope, this))
syms.Add(si2);
}
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
}
break;
case MemberTypes.Constructor:
{
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
CompiledConstructorScope member = new CompiledConstructorScope(si2, mi as ConstructorInfo, this);
si2 = member.si;
if (si2.acc_mod == access_modifer.protected_modifer)
{
if (ev.CheckForBaseAccess(ev.entry_scope, this))
syms.Add(si2);
}
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
break;
case MemberTypes.Property:
{
PropertyInfo pi = mi as PropertyInfo;
if (pi.GetGetMethod(true) != null && pi.GetGetMethod(true).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
if (si2.acc_mod == access_modifer.protected_modifer)
{
if (ev.CheckForBaseAccess(ev.entry_scope, this))
syms.Add(si2);
}
else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
}
break;
case MemberTypes.Event:
{
MethodInfo acc_mi = (mi as EventInfo).GetAddMethod(true);
if (acc_mi != null && acc_mi.IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
syms.Add(si2);
if (si2.acc_mod == access_modifer.protected_modifer)
{
if (ev.CheckForBaseAccess(ev.entry_scope, this))
syms.Add(si2);
//.........这里部分代码省略.........
示例15: GetStaticNames
public SymInfo[] GetStaticNames()
{
List<SymInfo> syms = new List<SymInfo>();
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
return syms.ToArray();
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |/*BindingFlags.Instance|*/BindingFlags.Static | BindingFlags.FlattenHierarchy);
if (ctn.IsInterface)
{
return syms.ToArray();
}
foreach (MemberInfo mi in mis)
if (!mi.Name.Contains("$"))
switch (mi.MemberType)
{
case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName && (mi as MethodInfo).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
CompiledMethodScope member = new CompiledMethodScope(si2, mi as MethodInfo, this);
si2 = member.si;
if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
break;
case MemberTypes.Field:
{
if (!(mi as FieldInfo).IsSpecialName && (mi as FieldInfo).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
}
break;
case MemberTypes.Constructor:
{
SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
CompiledConstructorScope member = new CompiledConstructorScope(si2, mi as ConstructorInfo, this);
si2 = member.si;
if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
break;
case MemberTypes.Property:
{
PropertyInfo pi = mi as PropertyInfo;
if (pi.GetGetMethod(true) != null && pi.GetGetMethod(true).IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
}
break;
case MemberTypes.Event:
{
MethodInfo acc_mi = (mi as EventInfo).GetAddMethod(true);
if (acc_mi != null && acc_mi.IsStatic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
syms.Add(si2);
if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
syms.Add(si2);
}
}
break;
case MemberTypes.NestedType:
{
if ((mi as Type).IsNestedPublic)
{
SymInfo si2 = new SymInfo(null, SymbolKind.Type, null);
CompiledScope member = TypeTable.get_compiled_type(si2, mi as Type);
si2 = member.si;
syms.Add(si2);
}
}
break;
}
return syms.ToArray();
}