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

C# Parser.ProjectDom类代码示例

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

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



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

示例1: GetResult

		public GenerateNamespaceImport GetResult (ProjectDom dom, ICompilationUnit unit, IType type, TextEditorData data)
		{
			GenerateNamespaceImport result;
			if (cache.TryGetValue (type.Namespace, out result))
				return result;
			result = new GenerateNamespaceImport ();
			cache[type.Namespace] = result;
			
			result.InsertNamespace  = false;
			
			DomLocation location = new DomLocation (data.Caret.Line, data.Caret.Column);
			foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
				if (u.Namespaces.Any (ns => type.Namespace == ns)) {
					result.GenerateUsing = false;
					return result;
				}
			}
			result.GenerateUsing = true;
			string name = type.DecoratedFullName.Substring (type.Namespace.Length + 1);
			
			foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
				foreach (string ns in u.Namespaces) {
					if (dom.SearchType (unit, unit.GetTypeAt (location), unit.GetMemberAt (location), ns + "." + name) != null) {
						result.GenerateUsing = false;
						result.InsertNamespace = true;
						return result;
					}
				}
			}
			return result;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:31,代码来源:ImportSymbolHandler.cs


示例2: Format

		public static void Format (TextEditorData data, ProjectDom dom, DomLocation location, bool correctBlankLines)
		{
			PolicyContainer policyParent = dom != null && dom.Project != null? dom.Project.Policies
				: PolicyService.DefaultPolicies;
			var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			Format (policyParent, mimeTypeChain, data, dom, location, correctBlankLines);
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:7,代码来源:OnTheFlyFormatter.cs


示例3: FindReferences

		public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, IEnumerable<INode> searchedMembers)
		{
			var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
			AspNetAppProject project = dom.Project as AspNetAppProject;
			if (project == null)
				yield break;
			
			var unit = AspNetParserService.GetCompileUnit (project, fileName, true);
			if (unit == null)
				yield break;
			var refman = new DocumentReferenceManager (project);
			
			var parsedAspDocument = (AspNetParsedDocument)new AspNetParser ().Parse (dom, fileName, editor.Text);
			refman.Doc = parsedAspDocument;
			
			var usings = refman.GetUsings ();
			var documentInfo = new DocumentInfo (dom, unit, usings, refman.GetDoms ());
			
			var builder = new AspLanguageBuilder ();
			
			
			var buildDocument = new Mono.TextEditor.Document ();
			var offsetInfos = new List<LocalDocumentInfo.OffsetInfo> ();
			buildDocument.Text = builder.BuildDocumentString (documentInfo, editor, offsetInfos, true);
			var parsedDocument = AspLanguageBuilder.Parse (dom, fileName, buildDocument.Text);
			foreach (var member in searchedMembers) {
				foreach (var reference in SearchMember (member, dom, fileName, editor, buildDocument, offsetInfos, parsedDocument)) {
					yield return reference;
				}
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:31,代码来源:ASPNetReferenceFinder.cs


示例4: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string fileContent)
		{
			XmlParsedDocument doc = new XmlParsedDocument (fileName);
			doc.Flags |= ParsedDocumentFlags.NonSerializable;
			TextReader tr = new StringReader (fileContent);
			try {
				Parser xmlParser = new Parser (new XmlFreeState (), true);
				xmlParser.Parse (tr);
				doc.XDocument = xmlParser.Nodes.GetRoot ();
				doc.Add (xmlParser.Errors);
				
				if (doc.XDocument != null && doc.XDocument.RootElement != null) {
					if (!doc.XDocument.RootElement.IsEnded)
						doc.XDocument.RootElement.End (xmlParser.Location);
				}
			}
			catch (Exception ex) {
				MonoDevelop.Core.LoggingService.LogError ("Unhandled error parsing xml document", ex);
			}
			finally {
				if (tr != null)
					tr.Dispose ();
			}
			return doc;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:25,代码来源:XmlDocumentParser.cs


示例5: InstantiatedParameterType

		public InstantiatedParameterType (ProjectDom dom, ITypeParameterMember typeParameterMember, ITypeParameter tp)
		{
			IType outerType = typeParameterMember as IType ?? typeParameterMember.DeclaringType;
			typeparam = tp;
			compilationUnit = outerType.CompilationUnit;
			ClassType = ClassType.Class;
			Modifiers = Modifiers.Public;
			Name = tp.Name;
			Namespace = outerType.DecoratedFullName;
			Location = outerType.Location;
			DeclaringType = outerType;
			
			if (tp.Constraints.Count > 0)
				ClassType = ClassType.Interface;
			foreach (IReturnType rt in tp.Constraints) {
				if (FindCyclicReference (new HashSet<ITypeParameter> () { tp }, outerType, ((DomReturnType)rt).DecoratedFullName))
					continue;
				IType bt = dom.SearchType (typeParameterMember, rt);
				IReturnType resolvedType = rt;
				if (bt != null) {
					resolvedType = new DomReturnType (bt);
					if (bt.ClassType == ClassType.Interface || BaseType != null) {
						AddInterfaceImplementation (resolvedType);
					} else {
						ClassType = bt.ClassType;
						BaseType = resolvedType;
					}
				} else {
					AddInterfaceImplementation (resolvedType);
				}
			}
			if (BaseType == null)
				BaseType = DomReturnType.Object;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:34,代码来源:InstantiatedParameterType.cs


示例6: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string fileContent)
		{
			XmlParsedDocument doc = new XmlParsedDocument (fileName);
			doc.Flags = ParsedDocumentFlags.NonSerializable;
			
			TextReader tr = new StringReader (fileContent);
			try {
				Parser xmlParser = new Parser (
					new XmlFreeState (new HtmlTagState (true), new HtmlClosingTagState (true)),
					true);
				
				xmlParser.Parse (tr);
				doc.XDocument = xmlParser.Nodes.GetRoot ();
				doc.Add (xmlParser.Errors);
				if (doc.XDocument != null)
					doc.Add (Validate (doc.XDocument));
			}
			catch (Exception ex) {
				MonoDevelop.Core.LoggingService.LogError ("Unhandled error parsing HTML document", ex);
			}
			finally {
				if (tr != null)
					tr.Dispose ();
			}
			
			return doc;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:27,代码来源:HtmlParser.cs


示例7: RefactorerContext

		public RefactorerContext (ProjectDom ctx, ITextFileProvider files, IType cls)
		{
			this.files = files;
			this.ctx = ctx;
			if (cls != null)
				typeResolver = GetTypeNameResolver (cls);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:RefactorerContext.cs


示例8: Format

		public static void Format (MonoDevelop.Ide.Gui.Document data, ProjectDom dom, DomLocation location, bool correctBlankLines, bool runAferCR = false)
		{
			PolicyContainer policyParent = dom != null && dom.Project != null ? dom.Project.Policies
 : PolicyService.DefaultPolicies;
			var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			Format (policyParent, mimeTypeChain, data, dom, location, correctBlankLines, runAferCR);
		}
开发者ID:sandyarmstrong,项目名称:monodevelop,代码行数:7,代码来源:OnTheFlyFormatter.cs


示例9: FindReferences

		public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, IEnumerable<INode> searchedMembers)
		{
			HashSet<int > positions = new HashSet<int> ();
			var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
			FindMemberAstVisitor visitor = new FindMemberAstVisitor (editor.Document);
			visitor.IncludeXmlDocumentation = IncludeDocumentation;
			visitor.Init (searchedMembers);
			if (!visitor.FileContainsMemberName ()) {
				yield break;
			}
			var doc = ProjectDomService.ParseFile (dom, fileName, () => editor.Text);
			if (doc == null || doc.CompilationUnit == null)
				yield break;
			var resolver = new NRefactoryResolver (dom, doc.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);

			visitor.ParseFile (resolver);
			visitor.RunVisitor (resolver);
			foreach (var reference in visitor.FoundReferences) {
				if (positions.Contains (reference.Position))
					continue;
				positions.Add (reference.Position);
				yield return reference;
			}
			visitor.ClearParsers ();
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:25,代码来源:CSharpReferenceFinder.cs


示例10: GetCompatibleMemberInClass

		public static IMember GetCompatibleMemberInClass (ProjectDom ctx, IType cls, CodeTypeMember member)
		{
			//check for identical property names
			foreach (IProperty prop in cls.Properties) {
				if (string.Compare (prop.Name, member.Name, StringComparison.OrdinalIgnoreCase) == 0) {
					EnsureClassExists (ctx, prop.ReturnType.FullName, GetValidRegion (prop));
					CodeMemberProperty memProp = member as CodeMemberProperty;
					if (memProp == null || !IsTypeCompatible (ctx, prop.ReturnType.FullName, memProp.Type.BaseType))
						throw new MemberExistsException (cls.FullName, MemberType.Property, member, GetValidRegion (prop), cls.CompilationUnit.FileName);
					return prop;
				}
			}
				
			//check for identical method names
			foreach (IMethod meth in cls.Methods) {
				if (string.Compare (meth.Name, member.Name, StringComparison.OrdinalIgnoreCase) == 0) {
					EnsureClassExists (ctx, meth.ReturnType.FullName, GetValidRegion (meth));
					CodeMemberMethod memMeth = member as CodeMemberMethod;
					if (memMeth == null || !IsTypeCompatible (ctx, meth.ReturnType.FullName, memMeth.ReturnType.BaseType))
						throw new MemberExistsException (cls.FullName, MemberType.Method, member, GetValidRegion (meth), cls.CompilationUnit.FileName);
					return meth;
				}
			}
			
			//check for identical event names
			foreach (IEvent ev in cls.Events) {
				if (string.Compare (ev.Name, member.Name, StringComparison.OrdinalIgnoreCase) == 0) {
					EnsureClassExists (ctx, ev.ReturnType.FullName, GetValidRegion (ev));
					CodeMemberEvent memEv = member as CodeMemberEvent;
					if (memEv == null || !IsTypeCompatible (ctx, ev.ReturnType.FullName, memEv.Type.BaseType))
						throw new MemberExistsException (cls.FullName, MemberType.Event, member, GetValidRegion (ev), cls.CompilationUnit.FileName);
					return ev;
				}
			}
				
			//check for identical field names
			foreach (IField field in cls.Fields) {
				if (string.Compare (field.Name, member.Name, StringComparison.OrdinalIgnoreCase) == 0) {
					EnsureClassExists (ctx, field.ReturnType.FullName, GetValidRegion (field));
					CodeMemberField memField = member as CodeMemberField;
					if (memField == null || !IsTypeCompatible (ctx, field.ReturnType.FullName, memField.Type.BaseType))
						throw new MemberExistsException (cls.FullName, MemberType.Field, member, GetValidRegion (field), cls.CompilationUnit.FileName);
					return field;
				}
			}
			
			//walk down into base classes, if any
			foreach (IReturnType baseType in cls.BaseTypes) {
				IType c = ctx.GetType (baseType);
				if (c == null)
					throw new TypeNotFoundException (baseType.FullName, cls.BodyRegion, cls.CompilationUnit.FileName);
				IMember mem = GetCompatibleMemberInClass (ctx, c, member);
				if (mem != null)
					return mem;
			}
			
			//return null if no match
			return null;
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:59,代码来源:BindingService.cs


示例11: FindReferences

		public override IEnumerable<MemberReference> FindReferences (ProjectDom dom, FilePath fileName, IEnumerable<INode> searchedMembers)
		{
			foreach (var member in searchedMembers) {
				foreach (var reference in FindReferences (dom, fileName, member)) {
					yield return reference;
				}
			}
		}
开发者ID:thild,项目名称:monodevelop,代码行数:8,代码来源:CSharpReferenceFinder.cs


示例12: CreateResolver

		public override IResolver CreateResolver (ProjectDom dom, object editor, string fileName)
		{
			MonoDevelop.Ide.Gui.Document doc = (MonoDevelop.Ide.Gui.Document)editor;
			if (doc.Editor == null)
				return null;
			
			return new NRefactoryResolver (dom, doc.CompilationUnit, ICSharpCode.OldNRefactory.SupportedLanguage.CSharp, doc.Editor, fileName);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:8,代码来源:McsParser.cs


示例13: Parse

		public static ParsedDocument Parse (ProjectDom dom, string fileName, string text)
		{
			var result = new MonoDevelop.CSharp.Parser.McsParser ().Parse (null, fileName, text);
			foreach (DomType type in result.CompilationUnit.Types) {
				type.SourceProjectDom = dom;
			}
			return result;
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:8,代码来源:AspLanguageBuilder.cs


示例14: GetFullClass

		IType GetFullClass (out ProjectDom ctx)
		{
			if (project == null || className == null) {
				ctx = null;
				return null;
			}
			ctx = MonoDevelop.Projects.Dom.Parser.ProjectDomService.GetProjectDom (project);
			return ctx.GetType (className, false, false);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:MonoDevelopProxy.cs


示例15: OutputNode

		public string OutputNode (ProjectDom dom, INode node, string indent)
		{
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor ();
			CSharpFormatter.SetFormatOptions (outputVisitor, dom != null && dom.Project != null ? dom.Project.Policies : null);
			int col = CSharpFormatter.GetColumn (indent, 0, 4);
			outputVisitor.OutputFormatter.IndentationLevel = System.Math.Max (0, col / 4);
			node.AcceptVisitor (outputVisitor, null);
			return outputVisitor.Text;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:9,代码来源:CSharpNRefactoryASTProvider.cs


示例16: OutputNode

 public string OutputNode(ProjectDom dom, INode node, string indent)
 {
     /* WNH FSharpOutputVisitor FIXME!!!!!		FSharpOutputVisitor outputVisitor = new FSharpOutputVisitor ();
     FSharpFormatter.SetFormatOptions (outputVisitor, dom.Project);
     int col = FSharpFormatter.GetColumn (indent, 0, 4);
     outputVisitor.OutputFormatter.IndentationLevel = System.Math.Max (0, col / 4);
     node.AcceptVisitor (outputVisitor, null);
     return outputVisitor.Text;
     WNH */
     return "Hello World";      // WNH RIP OUT later
 }
开发者ID:vasili,项目名称:FSharpBinding,代码行数:11,代码来源:FSharpNRefactoryASTProvider.cs


示例17: NewOverrideCompletionData

		public NewOverrideCompletionData (ProjectDom dom, TextEditorData editor, int declarationBegin, IType type, IMember member) : base (null)
		{
			this.editor = editor;
			this.type   = type;
			this.member = member;
			
			this.declarationBegin = declarationBegin;
			this.GenerateBody = true;
			this.Icon = member.StockIcon;
			this.DisplayText = ambience.GetString (member, OutputFlags.IncludeParameters | OutputFlags.IncludeGenerics | OutputFlags.HideExtensionsParameter);
			this.CompletionText = member.Name;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:12,代码来源:NewOverrideCompletionData.cs


示例18: GetFileNames

		static IEnumerable<Tuple<ProjectDom, FilePath>> GetFileNames (Solution solution, ProjectDom dom, ICompilationUnit unit, INode member, IProgressMonitor monitor)
		{
			var scope = GetScope (member);
			int counter = 0;
			switch (scope) {
			case RefactoryScope.File:
			case RefactoryScope.DeclaringType:
				if (dom != null && unit != null)
					yield return Tuple.Create (dom, unit.FileName);
				break;
			case RefactoryScope.Project:
				if (dom == null)
					yield break;
				if (monitor != null)
					monitor.BeginTask (GettextCatalog.GetString ("Finding references in project..."), dom.Project.Files.Count);
				foreach (var file in dom.Project.Files) {
					if (monitor != null && monitor.IsCancelRequested)
						yield break;
					yield return Tuple.Create (dom, file.FilePath);
					if (monitor != null) {
						if (counter % 10 == 0)
							monitor.Step (10);
						counter++;
					}
				}
				if (monitor != null)
					monitor.EndTask ();
				break;
			case RefactoryScope.Solution:
				var allProjects = solution.GetAllProjects ();
				if (monitor != null)
					monitor.BeginTask (GettextCatalog.GetString ("Finding references in solution..."),
						allProjects.Sum (p => p.Files.Count));
				foreach (var project in allProjects) {
					if (monitor != null && monitor.IsCancelRequested)
						yield break;
					var currentDom = ProjectDomService.GetProjectDom (project);
					foreach (var file in project.Files) {
						if (monitor != null && monitor.IsCancelRequested)
							yield break;
						yield return Tuple.Create (currentDom, file.FilePath);
						if (monitor != null) {
							if (counter % 10 == 0)
								monitor.Step (10);
							counter++;
						}
					}
				}
				if (monitor != null)
					monitor.EndTask ();
				break;
			}
		}
开发者ID:alistick,项目名称:monodevelop,代码行数:53,代码来源:ReferencesFinder.cs


示例19: Deserialize

        public void Deserialize(XElement xml, ProjectDom dom)
        {
            if (xml == null) {
                throw new ArgumentNullException ("xml");
            }

            var textAttr = xml.Attribute ("CommentText");
            if (textAttr != null) {
                Text = textAttr.Value;
            }

            this.DeserializePosition (xml.Element ("Position"));
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:13,代码来源:CommentFigure.cs


示例20: OutputNode

		public string OutputNode (ProjectDom dom, AstNode node, string indent)
		{
			StringWriter w = new StringWriter();
			var policyParent = dom != null && dom.Project != null ? dom.Project.Policies : null;
			IEnumerable<string> types = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			CSharpFormattingPolicy codePolicy = policyParent != null ? policyParent.Get<CSharpFormattingPolicy> (types) : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<CSharpFormattingPolicy> (types);
			var formatter = new TextWriterOutputFormatter(w);
			int col = GetColumn (indent, 0, 4);
			formatter.Indentation = System.Math.Max (0, col / 4);
			OutputVisitor visitor = new OutputVisitor (formatter, codePolicy.CreateOptions ());
			node.AcceptVisitor (visitor, null);
			return w.ToString();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:13,代码来源:CSharpNRefactoryASTProvider.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MSBuild.MSBuildFileFormat类代码示例发布时间:2022-05-26
下一篇:
C# Dom.ParsedDocument类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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