当前位置: 首页>>代码示例>>C#>>正文


C# Dom.ParsedDocument类代码示例

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


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

示例1: RefillOutlineStore

		//copied from MoonlightEditorExtension
		#region Document outline
		
		protected override void RefillOutlineStore (ParsedDocument doc, Gtk.TreeStore store)
		{
			XDocument xdoc = ((XmlParsedDocument)doc).XDocument;
			if (xdoc == null)
				return;
//			Gtk.TreeIter iter = outlineTreeStore.AppendValues (System.IO.Path.GetFileName (CU.Document.FilePath), p);
			BuildTreeChildren (store, Gtk.TreeIter.Zero, xdoc);
		}
开发者ID:JamesChan,项目名称:monodevelop,代码行数:11,代码来源:HtmlEditorExtension.cs

示例2: Initialize

		public override void Initialize ()
		{
			base.Initialize ();
			Parser parser = new Parser (CreateRootState (), false);
			tracker = new DocumentStateTracker<Parser> (parser, Editor);
			MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParsedDocumentUpdated += OnParseInformationChanged;
			
			if (Document.ParsedDocument != null) {
				lastCU = Document.ParsedDocument;
				OnParsedDocumentUpdated ();
			}
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:12,代码来源:BaseXmlEditorExtension.cs

示例3: Parse

		ParsedDocument Parse (ICSharpCode.NRefactory.IParser parser, string fileName)
		{
			parser.Parse();
			
			DomConverter visitor = new DomConverter (fileName);
			ParsedDocument result = new ParsedDocument (fileName);
			result.CompilationUnit = (ICompilationUnit)visitor.VisitCompilationUnit(parser.CompilationUnit, null);
/*			visitor.Cu.ErrorsDuringCompile = p.Errors.Count > 0;
			visitor.Cu.Tag = p.CompilationUnit;
			RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
			foreach (IType c in visitor.Cu.Classes)
				c.Region.FileName = fileName;
			AddCommentTags(visitor.Cu, p.Lexer.TagComments);*/
			return result;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:15,代码来源:DomParser.cs

示例4: SearchMember

		IEnumerable<MemberReference> SearchMember (INode member, ProjectDom dom, FilePath fileName, Mono.TextEditor.TextEditorData editor, Mono.TextEditor.Document buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument)
		{
			var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
			
			FindMemberAstVisitor visitor = new FindMemberAstVisitor (buildDocument, member);
			visitor.IncludeXmlDocumentation = IncludeDocumentation;
			visitor.RunVisitor (resolver);
			
			foreach (var result in visitor.FoundReferences) {
				var offsetInfo = offsetInfos.FirstOrDefault (info => info.ToOffset <= result.Position && result.Position < info.ToOffset + info.Length);
				if (offsetInfo == null)
					continue;
				var offset = offsetInfo.FromOffset + result.Position - offsetInfo.ToOffset;
				var loc = editor.OffsetToLocation (offset);
				yield return new MemberReference (null, fileName, offset, loc.Line, loc.Column, result.Name, null);
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:17,代码来源:ASPNetReferenceFinder.cs

示例5: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string content)
		{
			ParsedDocument doc = new ParsedDocument (fileName);
			doc.Flags |= ParsedDocumentFlags.NonSerializable;
			Project p = (null == dom || null == dom.Project)? 
				IdeApp.Workspace.GetProjectContainingFile (fileName):
				dom.Project;
			ProjectInformation pi = ProjectInformationManager.Instance.Get (p);
			CompilationUnit cu;
			doc.CompilationUnit = cu = new CompilationUnit (fileName);
			IType tmp;
			IMember member;
			string[] contentLines = content.Split (new string[]{Environment.NewLine}, StringSplitOptions.None);
			DomType globals = new DomType (cu, ClassType.Unknown, GettextCatalog.GetString ("(Global Scope)"), new DomLocation (1, 1), string.Empty, new DomRegion (1, int.MaxValue), new List<IMember> ());
			
			lock (pi) {
				// Add containers to type list
				foreach (LanguageItem li in pi.Containers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						tmp = LanguageItemToIMember (pi, li, contentLines) as IType;
						if (null != tmp){ cu.Add (tmp); }
					}
				}
				
				// Add global category for unscoped symbols
				foreach (LanguageItem li in pi.InstanceMembers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						member = LanguageItemToIMember (pi, li, contentLines);
						if (null != member) { 
							globals.Add (member); 
						}
					}
				}
			}
			
			cu.Add (globals);
			
			return doc;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:39,代码来源:CDocumentParser.cs

示例6: UpdateDocumentOutline

		void UpdateDocumentOutline (object sender, EventArgs args)
		{
			lastCU = Document.ParsedDocument;
			//limit update rate to 3s
			if (!refreshingOutline) {
				refreshingOutline = true;
				refillOutlineStoreId = GLib.Timeout.Add (3000, RefillOutlineStore);
			}
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:9,代码来源:ClassOutlineTextEditorExtension.cs

示例7: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string content)
		{
			ParsedDocument doc = new ParsedDocument (fileName);
			if(null == doc.CompilationUnit)
				doc.CompilationUnit = new CompilationUnit (fileName);
			CompilationUnit cu = (CompilationUnit)doc.CompilationUnit;
			DomType currentFile = null;
			DomProperty currentRegion = null;
			
			string eol = Environment.NewLine;
			Match eolMatch = eolExpression.Match (content);
			if (eolMatch != null && eolMatch.Success)
				eol = eolMatch.Groups["eol"].Value;
			
			string[] lines = content.Split (new string[]{eol}, StringSplitOptions.None);
			int linenum = 1;
			Match lineMatch;
			foreach (string line in lines)
			{
				lineMatch = fileHeaderExpression.Match (line.Trim());
				if (lineMatch != null && lineMatch.Success) {
					if (currentFile != null) // Close out previous file region
						currentFile.BodyRegion = new DomRegion (currentFile.BodyRegion.Start.Line,
						                                        currentFile.BodyRegion.Start.Column,
						                                        linenum-1, int.MaxValue);
					if (currentRegion != null) // Close out previous chunk region
						currentRegion.BodyRegion = new DomRegion (currentRegion.BodyRegion.Start.Line,
						                                          currentRegion.BodyRegion.Start.Column,
						                                          linenum-1, int.MaxValue);
					
					// Create new file region
					currentFile = new DomType (cu, ClassType.Unknown, Modifiers.None, 
					                           lastToken (lineMatch.Groups["filepath"].Value),
					                           new DomLocation (linenum, 1), 
					                           string.Empty,
					                           new DomRegion (linenum, line.Length+1, linenum, int.MaxValue));
					cu.Add (currentFile);
				} else {
					lineMatch = chunkExpression.Match (line);
					if (lineMatch != null && lineMatch.Success) {
						if (currentRegion != null) // Close out previous chunk region
							currentRegion.BodyRegion = new DomRegion (currentRegion.BodyRegion.Start.Line,
							                                          currentRegion.BodyRegion.Start.Column,
							                                          linenum-1, int.MaxValue);
						
						// Create new chunk region
						currentRegion = new DomProperty (lineMatch.Groups["chunk"].Value, Modifiers.None, 
						                                 new DomLocation (linenum, 1), 
						                                 new DomRegion (linenum, line.Length+1, linenum, int.MaxValue), null);
						currentFile.Add (currentRegion);
					}
				}
				++linenum;
			}
			
			// Close out trailing regions
			if (currentFile != null)
				currentFile.BodyRegion = new DomRegion (currentFile.BodyRegion.Start.Line,
				                                        currentFile.BodyRegion.Start.Column, 
				                                        Math.Max (1, linenum-2), int.MaxValue);
			if (currentRegion != null)
				currentRegion.BodyRegion = new DomRegion (currentRegion.BodyRegion.Start.Line,
				                                          currentRegion.BodyRegion.Start.Column, 
				                                          Math.Max (1, linenum-2), int.MaxValue);
			
			return doc;
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:67,代码来源:DiffParser.cs

示例8: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string content)
		{
			var result = new ParsedDocument (fileName);
			var unit = new MonoDevelop.Projects.Dom.CompilationUnit (fileName);
			result.CompilationUnit = unit;
				
			if (string.IsNullOrEmpty (content))
				return result;
			
			lock (CompilerCallableEntryPoint.parseLock) {
				var tagComments = ProjectDomService.SpecialCommentTags.GetNames ();
				List<string > compilerArguments = new List<string> ();
				if (dom != null && dom.Project != null && MonoDevelop.Ide.IdeApp.Workspace != null) {
					DotNetProjectConfiguration configuration = dom.Project.GetConfiguration (MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;
					CSharpCompilerParameters par = configuration != null ? configuration.CompilationParameters as CSharpCompilerParameters : null;
					if (par != null) {
						if (!string.IsNullOrEmpty (par.DefineSymbols)) {
							compilerArguments.Add ("-define:" + string.Join (";", par.DefineSymbols.Split (';', ',', ' ', '\t').Where (s => !string.IsNullOrWhiteSpace (s))));
						}
						if (par.UnsafeCode)
							compilerArguments.Add ("-unsafe");
						if (par.TreatWarningsAsErrors)
							compilerArguments.Add ("-warnaserror");
						if (!string.IsNullOrEmpty (par.NoWarnings))
							compilerArguments.Add ("-nowarn:" + string.Join (",", par.NoWarnings.Split (';', ',', ' ', '\t')));
						compilerArguments.Add ("-warn:" + par.WarningLevel);
						compilerArguments.Add ("-langversion:" + GetLangString (par.LangVersion));
						if (par.GenerateOverflowChecks)
							compilerArguments.Add ("-checked");
					}
				}
				
				
				CompilerCompilationUnit top;
				ErrorReportPrinter errorReportPrinter = new ErrorReportPrinter ();
				using (var stream = new MemoryStream (Encoding.UTF8.GetBytes (content))) {
					top = CompilerCallableEntryPoint.ParseFile (compilerArguments.ToArray (), stream, fileName, errorReportPrinter);
				}
				if (top == null)
					return null;
				foreach (var special in top.SpecialsBag.Specials) {
					var comment = special as SpecialsBag.Comment;
					if (comment != null) {
						VisitComment (result, comment, tagComments);
					} else {
						VisitPreprocessorDirective (result, special as SpecialsBag.PreProcessorDirective);
					}
				}
				// convert DOM
				var conversionVisitor = new ConversionVisitor (top.LocationsBag);
				try {
					conversionVisitor.Dom = dom;
					conversionVisitor.ParsedDocument = result;
					conversionVisitor.Unit = unit;
					top.UsingsBag.Global.Accept (conversionVisitor);
					top.ModuleCompiled.Accept (conversionVisitor);
				} catch (Exception ex) {
					System.Console.WriteLine (ex);
				}
				result.LanguageAST = new ICSharpCode.NRefactory.CSharp.CSharpParser().Parse (top, 0);
				// parser errorse
				errorReportPrinter.Errors.ForEach (e => conversionVisitor.ParsedDocument.Add (e));
				return result;
			}
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:65,代码来源:McsParser.cs

示例9: AddCurRegion

		void AddCurRegion (ParsedDocument result, int line, int col)
		{
			if (ConditionalRegion == null)
				return;
			ConditionalRegion.End = new DomLocation (line, col);
			result.Add (ConditionalRegion);
			conditionalRegions.Pop ();
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:8,代码来源:McsParser.cs

示例10: ParseCompilationUnit

		void ParseCompilationUnit (ParsedDocument cu)
		{
			// No new errors
			if (cu.Errors == null || cu.Errors.Count < 1)
				return;
			
			// Else we underline the error
			foreach (MonoDevelop.Projects.Dom.Error info in cu.Errors)
				UnderLineError (info);
		}
开发者ID:silk,项目名称:monodevelop,代码行数:10,代码来源:SourceEditorWidget.cs

示例11: UpdateParsedDocument

		internal void UpdateParsedDocument (ParsedDocument document)
		{
			if (this.isDisposed || document == null || this.view == null)
				return;
			
			if (MonoDevelop.Core.PropertyService.Get ("EnableSemanticHighlighting", false) && TextEditor != null) {
				var margin = TextEditor.TextViewMargin;
				if (margin != null)
					Gtk.Application.Invoke (delegate { margin.PurgeLayoutCache (); });
			}
			SetParsedDocument (document, parsedDocument != null);
		}
开发者ID:silk,项目名称:monodevelop,代码行数:12,代码来源:SourceEditorWidget.cs

示例12: TreeStore

		Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget ()
		{
			if (outlineTreeView != null)
				return outlineTreeView;

			outlineTreeStore = new TreeStore (typeof(object));
			outlineTreeModelSort = new TreeModelSort (outlineTreeStore);
			
			settings = ClassOutlineSettings.Load ();
			comparer = new ClassOutlineNodeComparer (GetAmbience (), settings, outlineTreeModelSort);

			outlineTreeModelSort.SetSortFunc (0, comparer.CompareNodes);
			outlineTreeModelSort.SetSortColumnId (0, SortType.Ascending);

			outlineTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineTreeStore);

			var pixRenderer = new CellRendererPixbuf ();
			pixRenderer.Xpad = 0;
			pixRenderer.Ypad = 0;

			outlineTreeView.TextRenderer.Xpad = 0;
			outlineTreeView.TextRenderer.Ypad = 0;

			TreeViewColumn treeCol = new TreeViewColumn ();
			treeCol.PackStart (pixRenderer, false);

			treeCol.SetCellDataFunc (pixRenderer, new TreeCellDataFunc (OutlineTreeIconFunc));
			treeCol.PackStart (outlineTreeView.TextRenderer, true);

			treeCol.SetCellDataFunc (outlineTreeView.TextRenderer, new TreeCellDataFunc (OutlineTreeTextFunc));
			outlineTreeView.AppendColumn (treeCol);

			outlineTreeView.HeadersVisible = false;

			outlineTreeView.Selection.Changed += delegate {
				JumpToDeclaration (false);
			};
			
			outlineTreeView.RowActivated += delegate {
				JumpToDeclaration (true);
			};

			this.lastCU = Document.ParsedDocument;

			outlineTreeView.Realized += delegate { RefillOutlineStore (); };
			UpdateSorting ();

			var sw = new CompactScrolledWindow ();
			sw.Add (outlineTreeView);
			sw.ShowAll ();
			return sw;
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:52,代码来源:ClassOutlineTextEditorExtension.cs

示例13: ConversionVisitior

			public ConversionVisitior (ProjectDom dom, MonoDevelop.Projects.Dom.ParsedDocument result, List<ISpecial> specials)
			{
				this.dom = dom;
				this.specials = specials;
				this.result = result;
				namespaceEndLocationStack.Push (new Location (Int32.MaxValue, Int32.MaxValue));
			}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:7,代码来源:NRefactoryParser.cs

示例14: Parse

		public override ParsedDocument Parse (ProjectDom dom, string fileName, string content)
		{
			using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser (ICSharpCode.NRefactory.SupportedLanguage.CSharp, new StringReader (content))) {
				ParsedDocument result = new ParsedDocument (fileName);
				result.CompilationUnit = new MonoDevelop.Projects.Dom.CompilationUnit (fileName);
				
				parser.ParseMethodBodies = false;
				parser.Errors.Error += delegate(int line, int col, string message) { result.Add (new Error (ErrorType.Error, line, col, message)); };
				parser.Lexer.SpecialCommentTags = ProjectDomService.SpecialCommentTags.GetNames ();
				parser.Lexer.EvaluateConditionalCompilation = true;
				if (dom != null && dom.Project != null && MonoDevelop.Ide.IdeApp.Workspace != null) {
					DotNetProjectConfiguration configuration = dom.Project.GetConfiguration (MonoDevelop.Ide.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration;
					CSharpCompilerParameters par = configuration != null ? configuration.CompilationParameters as CSharpCompilerParameters : null;
					if (par != null)
						parser.Lexer.SetConditionalCompilationSymbols (par.DefineSymbols);
				}
				parser.Parse ();
				
				SpecialTracker tracker = new SpecialTracker (result);
				foreach (ICSharpCode.NRefactory.ISpecial special in parser.Lexer.SpecialTracker.CurrentSpecials) {
					special.AcceptVisitor (tracker, null);
				}

				foreach (ICSharpCode.NRefactory.Parser.TagComment tagComment in parser.Lexer.TagComments) {
					result.Add (new Tag (tagComment.Tag, tagComment.CommentText, new DomRegion (tagComment.StartPosition.Y, tagComment.StartPosition.X, tagComment.EndPosition.Y, tagComment.EndPosition.X)));
				}
				ConversionVisitior visitor = new ConversionVisitior (dom, result, parser.Lexer.SpecialTracker.CurrentSpecials);
				visitor.VisitCompilationUnit (parser.CompilationUnit, null);
				result.CompilationUnit.Tag = parser.CompilationUnit;
				LastUnit = parser.CompilationUnit;
				return result;
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:33,代码来源:NRefactoryParser.cs

示例15: ConvertDParserToDomNode

        public static MonoDevelop.Projects.Dom.INode ConvertDParserToDomNode(D_Parser.Dom.INode n, ParsedDocument doc)
        {
            //TODO: DDoc comments!

            if (n is DMethod)
            {
                var dm = n as DMethod;

                var domMethod = new DomMethod(
                    n.Name,
                    GetNodeModifiers(dm),
                    dm.SpecialType == DMethod.MethodType.Constructor ? MethodModifier.IsConstructor : MethodModifier.None,
                    FromCodeLocation(n.StartLocation),
                    GetBlockBodyRegion(dm),
                    GetReturnType(n));

                foreach (var pn in dm.Parameters)
                    domMethod.Add(new DomParameter(domMethod, pn.Name, GetReturnType(pn)));

                domMethod.AddTypeParameter(GetTypeParameters(dm));

                foreach (var subNode in dm) domMethod.AddChild(ConvertDParserToDomNode(subNode, doc));

                return domMethod;
            }
            else if (n is DEnum)
            {
                var de = n as DEnum;

                var domType = new DomType(
                    doc.CompilationUnit,
                    ClassType.Enum,
                    GetNodeModifiers(de),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n), GetBlockBodyRegion(de));

                foreach (var subNode in de)
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                return domType;
            }
            else if (n is DClassLike)
            {
                var dc = n as DClassLike;

                ClassType ct = ClassType.Unknown;

                switch (dc.ClassType)
                {
                    case DTokens.Template:
                    case DTokens.Class:
                        ct = ClassType.Class;
                        break;
                    case DTokens.Interface:
                        ct = ClassType.Interface;
                        break;
                    case DTokens.Union:
                    case DTokens.Struct:
                        ct = ClassType.Struct;
                        break;
                }

                var domType = new DomType(
                    doc.CompilationUnit,
                    ct,
                    GetNodeModifiers(dc),
                    n.Name,
                    FromCodeLocation(n.StartLocation),
                    BuildTypeNamespace(n),
                    GetBlockBodyRegion(dc));

                domType.AddTypeParameter(GetTypeParameters(dc));
                foreach (var subNode in dc)
                    domType.Add(ConvertDParserToDomNode(subNode, doc) as IMember);
                return domType;
            }
            else if (n is DVariable)
            {
                var dv = n as DVariable;
                return new DomField(n.Name, GetNodeModifiers(dv), FromCodeLocation(n.StartLocation), GetReturnType(n));
            }
            return null;
        }
开发者ID:nazriel,项目名称:Mono-D,代码行数:83,代码来源:ParsedDModule.cs


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