• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CodeCompletion.ExpressionVisitor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CodeCompletion.ExpressionVisitor的典型用法代码示例。如果您正苦于以下问题:C# ExpressionVisitor类的具体用法?C# ExpressionVisitor怎么用?C# ExpressionVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExpressionVisitor类属于CodeCompletion命名空间,在下文中一共展示了ExpressionVisitor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetName

 /// <summary>
 /// Получение имен после точки
 /// </summary>
 public SymInfo[] GetName(expression expr, string str, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword, ref SymScope root)
 {
     if (stv.cur_scope == null) return null;
     if (col + 1 > str.Length)
         col -= str.Length;
     SymScope si = stv.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope;
     if (si == null)
     {
         si = stv.FindScopeByLocation(line, col + 1);
         if (si == null)
             return null;
     }
     SetCurrentUsedAssemblies();
     ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
     si = ev.GetScopeOfExpression(true, false);
     root = si;
     if (si is ElementScope) root = (si as ElementScope).sc;
     else if (si is ProcScope) root = (si as ProcScope).return_type;
     if (si != null)
     {
         if (!(si is TypeScope) && !(si is NamespaceScope))
         {
             SymInfo[] syms = si.GetNamesAsInObject(ev);
             SymInfo[] ext_syms = null;
             if (si is ElementScope)
                 ext_syms = stv.cur_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope);
             List<SymInfo> lst = new List<SymInfo>();
             lst.AddRange(syms);
             if (ext_syms != null)
                 lst.AddRange(ext_syms);
             RestoreCurrentUsedAssemblies();
             return lst.ToArray();
         }
         else
         {
             if (si is TypeScope)
             {
                 RestoreCurrentUsedAssemblies();
                 return (si as TypeScope).GetNames(ev, keyword, false);
             }
             else
             {
                 if (ev.entry_scope.InUsesRange(line + 1, col + 1))
                     keyword = PascalABCCompiler.Parsers.KeywordKind.Uses;
                 RestoreCurrentUsedAssemblies();
                 return (si as NamespaceScope).GetNames(ev, keyword);
             }
         }
     }
     RestoreCurrentUsedAssemblies();
     return null;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:55,代码来源:DomConverter.cs


示例2: GetNamesInAllTopScopes

        //		public override SymInfo[] GetNames(ExpressionVisitor ev)
        //		{
        //			List<SymInfo> lst = new List<SymInfo>();
        //			for (int i=0; i<with_scopes.Count; i++)
        //			{
        //				if (!with_scopes[i].is_type)
        //				lst.AddRange(with_scopes[i].ss.GetNamesAsInObject(ev));
        //				else
        //				lst.AddRange((with_scopes[i].ss as TypeScope).GetNames(ev,PascalABCCompiler.Parsers.KeywordKind.None));
        //			}
        //			lst.AddRange(topScope.GetNames(ev));
        //			return lst.ToArray();
        //		}


        public override SymInfo[] GetNamesInAllTopScopes(bool all_names, ExpressionVisitor ev, bool is_static)
        {
            List<SymInfo> lst = new List<SymInfo>();
            for (int i = 0; i < with_scopes.Count; i++)
            {
                if (!with_scopes[i].is_type)
                    lst.AddRange(with_scopes[i].ss.GetNamesAsInObject(ev));
                else
                    lst.AddRange((with_scopes[i].ss as TypeScope).GetNames(ev, PascalABCCompiler.Parsers.KeywordKind.None, false));
            }
            lst.AddRange(topScope.GetNamesInAllTopScopes(all_names, ev, is_static));
            return lst.ToArray();
        }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:28,代码来源:SymTable.cs


示例3: GetNamesAsInObject

 public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
 {
     return new SymInfo[0];
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:4,代码来源:SymTable.cs


示例4: GetNamesAsInBaseClass

 public virtual SymInfo[] GetNamesAsInBaseClass(ExpressionVisitor ev, bool is_static)
 {
     return new SymInfo[0];
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:4,代码来源:SymTable.cs


示例5: GetNames

        //poluchit imena s klassa s kluchevym slovom
        //vyzyvaetsja, kogda procedure TClass. tut vse ekzemplarnye i staticheskie
        public virtual SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
        {
            List<SymInfo> lst = new List<SymInfo>();
            foreach (SymScope ss in members)
            {
                if (!ss.si.name.StartsWith("$"))
                {
                    if (keyword != PascalABCCompiler.Parsers.KeywordKind.Function && keyword != PascalABCCompiler.Parsers.KeywordKind.Constructor && keyword != PascalABCCompiler.Parsers.KeywordKind.Destructor/*!(ev.entry_scope is InterfaceUnitScope) && !(ev.entry_scope is ImplementationUnitScope)*/)
                    {
                        if (ss.si.acc_mod == access_modifer.private_modifer)
                        {
                            if (ss.is_static && ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
                                lst.Add(ss.si);
                        }
                        else if (ss.si.acc_mod == access_modifer.protected_modifer)
                        {
                            if (ss.is_static && ev.CheckForBaseAccess(ev.entry_scope, this))
                                lst.Add(ss.si);
                        }
                        else
                            if (ss.is_static)
                                lst.Add(ss.si);
                            else if ((ss is ProcScope) && (ss as ProcScope).IsConstructor())
                                if (!((ss as ProcScope).parameters == null || (ss as ProcScope).parameters.Count == 0) || !called_in_base)
                                    lst.Add(ss.si);
                    }
                    else
                    {
                        if (ss is ProcScope && !(ss as ProcScope).already_defined)
                        {
                            if (keyword == PascalABCCompiler.Parsers.KeywordKind.Function || keyword == PascalABCCompiler.Parsers.KeywordKind.Destructor)
                                lst.Add(ss.si);
                            else if ((ss as ProcScope).IsConstructor())
                                lst.Add(ss.si);
                        }
                    }
                    if (!ss.si.has_doc)
                        UnitDocCache.AddDescribeToComplete(ss);
                }
            }

            if (baseScope != null && keyword != PascalABCCompiler.Parsers.KeywordKind.Constructor && keyword != PascalABCCompiler.Parsers.KeywordKind.Destructor)
                lst.AddRange(baseScope.GetNames(ev, keyword, true));
            /*if (topScope != null)
                lst.AddRange(topScope.GetNames());*/
            return lst.ToArray();
        }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:49,代码来源:SymTable.cs


示例6: GetNameOfMethod

 /// <summary>
 /// Получить подсказку параметров метода
 /// </summary>
 public string[] GetNameOfMethod(expression expr, string str, int line, int col, int num_param,ref int defIndex, int choose_param_num, out int param_count)
 {
 	param_count = 0;
 	if (stv.cur_scope == null) return null;
 	if (col +1 > str.Length)
 		col -= str.Length;
 	SymScope si = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
 	if (si == null) 
 	{
 		si = stv.FindScopeByLocation(line,col+1);
 		if (si == null)
 		return null;
 	}
     SetCurrentUsedAssemblies();
 	ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
 	List<ProcScope> scopes = ev.GetOverloadScopes();
 	bool was_empty_params = false;
     if (scopes.Count == 0)
     {
         RestoreCurrentUsedAssemblies();
         return null;
     }
 	si = scopes[0];
 	//if (si is ElementScope && (si as ElementScope).sc is ProcScope) si = (si as ElementScope).sc as ProcScope;
 	//if (si is ElementScope && (si as ElementScope).sc is ProcType) si = ((si as ElementScope).sc as ProcType).target;
 	if (si != null && si is ProcScope)
 	{
 		List<string> procs = new List<string>();
 		List<ProcScope> proc_defs = new List<ProcScope>();
 		ProcScope ps = si as ProcScope;
 		int i = 0; bool stop = false;
 		ProcScope tmp = ps;
 		while (i < scopes.Count)
 		{
 			if (i == defIndex) 
 			{
 				if (tmp.GetParametersCount() != 0)
 				{
 					choose_param_num = tmp.GetParametersCount();
 					param_count = choose_param_num;
 				}
 				break;
 			}
 			i++;
 			tmp = scopes[i];
 		}
 		i = 0;
 		while (ps != null)
 		{
 			//if (!ps.si.name.StartsWith("$"))
 			//if (!stop && ((ps.GetParametersCount() >= num_param) || ps.GetParametersCount() == 0 && num_param == 1 && choose_param_num==1))
 			//if (i == defIndex) param_count = ps.GetParametersCount();
 			if (!stop && num_param > choose_param_num && ps.GetParametersCount() >= num_param && ps.GetParametersCount() > choose_param_num)
 			{
 				//if (ps.GetParametersCount() >= choose_param_num && choose_param_num == 1 || choose_param_num > 1 && ps.GetParametersCount() > choose_param_num)
 				{
 					defIndex = i;
 					stop = true;
 					param_count = ps.GetParametersCount();
 				}
 				//System.Diagnostics.Debug.WriteLine(defIndex);
 			}
 			if (ps is CompiledMethodScope)
 				ps.AddDocumentation(AssemblyDocCache.GetDocumentation((ps as CompiledMethodScope).mi));
 			else if (ps is CompiledConstructorScope)
 				ps.AddDocumentation(AssemblyDocCache.GetDocumentation((ps as CompiledConstructorScope).mi));
 			else if (ps is ProcScope)
 			{
 				if (!ps.si.has_doc)
 				{
 					ps.AddDocumentation(UnitDocCache.GetDocumentation(ps as ProcScope));
 				}
 			}
 			if (ps.acc_mod == access_modifer.protected_modifer || ps.acc_mod == access_modifer.private_modifer)
 			{
 				if (ps.acc_mod == access_modifer.private_modifer)
 				{
 					if (ev.IsInOneModule(ev.entry_scope,ps.topScope))
 						if (!ps.si.not_include && !equal_params(ps,proc_defs))
 						{
 							procs.Add(ps.si.description);
 							proc_defs.Add(ps);
 						}
 				}
 				else
 				if (ev.CheckForBaseAccess(ev.entry_scope,ps.topScope))
 					if (!ps.si.not_include && !equal_params(ps,proc_defs))
 					{
 						procs.Add(ps.si.description);
 						proc_defs.Add(ps);
 					}
 			}
 			else 
 			if (!ps.si.not_include)
 			/*if (ps.GetParametersCount() == 0)
 			{
 				if (!was_empty_params)
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:DomConverter.cs


示例7: GetIndex

 /// <summary>
 /// Получить подсказку индекса
 /// </summary>
 public string[] GetIndex(expression expr, int line, int col)
 {
 	if (stv.cur_scope == null) return null;
 	SymScope si = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
 	if (si == null) 
 	{
 		si = stv.FindScopeByLocation(line,col+1);
 		if (si == null)
 		return null;
 	}
 	ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
 	si = ev.GetScopeOfExpression(false,true);
 	return CodeCompletionController.CurrentParser.LanguageInformation.GetIndexerString(si);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:17,代码来源:DomConverter.cs


示例8: GetDescription

 /// <summary>
 /// Получить описание элемента при наведении мышью
 /// </summary>
 public string GetDescription(expression expr, string FileName, string expr_without_brackets, PascalABCCompiler.Parsers.Controller parser, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword, bool header)
 {
 	if (stv.cur_scope == null) return null;
 	SymScope ss = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
 	if (ss == null) return null;
 	if (!header && ss.IsInScope(ss.head_loc,line+1,col+1))
 	{
 		List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
 		expr = parser.GetExpression("test"+Path.GetExtension(FileName), expr_without_brackets, Errors);
 		if (expr == null || Errors.Count > 0)
 			return null;
 	}
 	bool on_proc = false;
     SetCurrentUsedAssemblies();
 	if (keyword == PascalABCCompiler.Parsers.KeywordKind.Function || keyword == PascalABCCompiler.Parsers.KeywordKind.Constructor || keyword == PascalABCCompiler.Parsers.KeywordKind.Destructor)
 	{
 		if (ss is ProcRealization)
 		{
 			if (expr is ident)
 			{
 				if ((expr as ident).name == (ss as ProcRealization).def_proc.si.name) on_proc = true;
 			}
 			else on_proc = true;
 		}
 		else if (ss is ProcScope)
 		{
 			if (expr is ident)
 			{
 				if ((expr as ident).name == (ss as ProcScope).si.name) on_proc = true;
 			}
 			else on_proc = true;
 		}
 	}
 	//if (!((keyword == KeywordKind.kw_proc || keyword == KeywordKind.kw_constr || keyword == KeywordKind.kw_destr) && ss is ProcScope))
 	if (!on_proc)
 	{
 		ExpressionVisitor ev = new ExpressionVisitor(expr, ss, stv);
 		ev.mouse_hover = true;
 		ss = ev.GetScopeOfExpression();
 	}
 	if (ss != null && ss.si != null) 
 	{
 		try
 		{
             if (ss.si.has_doc != true)
                 if (ss is CompiledScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledScope).ctn));
                 else if (ss is CompiledMethodScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledMethodScope).mi));
                 else if (ss is CompiledPropertyScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledPropertyScope).pi));
                 else if (ss is CompiledFieldScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledFieldScope).fi));
                 else if (ss is CompiledEventScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledEventScope).ei));
                 else if (ss is CompiledConstructorScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentation((ss as CompiledConstructorScope).mi));
                 else if (ss is NamespaceScope)
                     ss.AddDocumentation(AssemblyDocCache.GetDocumentationForNamespace((ss as NamespaceScope).name));
                 else if (ss is TypeScope)
                     ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as TypeScope));
                 else if (ss is ProcScope)
                     ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as ProcScope));
                 else if (ss is InterfaceUnitScope)
                     ss.AddDocumentation(UnitDocCache.GetDocumentation(ss as InterfaceUnitScope));
                 else if (ss is ElementScope && string.IsNullOrEmpty(ss.si.description) && (ss as ElementScope).sc is TypeScope)
                     ss.si.description = (ss as ElementScope).sc.Description;
 		}
 		catch (Exception e)
 		{
 			
 		}
         RestoreCurrentUsedAssemblies();
         string description = ss.si.description;
         if (description != null)
             description = description.Replace("!#","");
 		return description;
 	}
     RestoreCurrentUsedAssemblies();
 	return null;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:84,代码来源:DomConverter.cs


示例9: GetRealization

 /// <summary>
 /// Получить реализацию expr
 /// </summary>
 public List<Position> GetRealization(expression expr, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword)
 {
 	List<Position> poses = new List<Position>();
 	Position pos = new Position(); pos.line = -1; pos.column = -1;
 	try
 	{
 	    if (stv.cur_scope == null) return poses;
 	    SymScope ss = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
 	    if (ss == null) return poses;
 	    //if (!(expr is ident && string.Compare((expr as ident).name,ss.si.name) == 0))
 	    bool on_proc = false;
         SetCurrentUsedAssemblies();
 	    if (keyword == PascalABCCompiler.Parsers.KeywordKind.Function || keyword == PascalABCCompiler.Parsers.KeywordKind.Constructor || keyword == PascalABCCompiler.Parsers.KeywordKind.Destructor)
 	    {
 		    if (ss is ProcRealization)
 		    {
 			    if (expr is ident)
 			    {
 				    if ((expr as ident).name == (ss as ProcRealization).def_proc.si.name) 
                         on_proc = true;
 			    }
 			    else 
                     on_proc = true;
 		    }
 		    else if (ss is ProcScope)
 		    {
 			    if (expr is ident)
 			    {
 				    if ((expr as ident).name == (ss as ProcScope).si.name) 
                         on_proc = true;
 			    }
 			    else 
                     on_proc = true;
 		    }
 	    }
 	    //if (!((keyword == KeywordKind.kw_proc || keyword == KeywordKind.kw_constr || keyword == KeywordKind.kw_destr) && ss is ProcScope))
 	    if (!on_proc)
 	    //if (keyword != KeywordKind.kw_proc && keyword != KeywordKind.kw_constr && keyword != KeywordKind.kw_destr)
 	    {
 		    ExpressionVisitor ev = new ExpressionVisitor(expr, ss, stv);
 		    ss = ev.GetScopeOfExpression();
 	    }
 	    while (ss != null && ss is ProcScope && (ss as ProcScope).proc_realization != null && (ss as ProcScope).proc_realization.loc != null)
 	    {
 		    ProcRealization pr = (ss as ProcScope).proc_realization;
 		    pos.line = pr.loc.begin_line_num;
 		    pos.column = pr.loc.begin_column_num;
 		    pos.file_name = pr.loc.doc.file_name;
 		    poses.Add(pos);
 		    if (on_proc) break;
 		    //ss = (ss as ProcScope).nextProc;
 		    ss = null;
 	    }
 	}
 	catch (Exception e)
 	{
 		
 	}
     RestoreCurrentUsedAssemblies();
 	return poses; 
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:64,代码来源:DomConverter.cs



注:本文中的CodeCompletion.ExpressionVisitor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CodeCompletion.SymScope类代码示例发布时间:2022-05-24
下一篇:
C# CocosSharp.CCWindow类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap