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

C# Highlighting.SyntaxMode类代码示例

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

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



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

示例1: DietTemplateSyntaxMode

		public DietTemplateSyntaxMode ()
		{
			var matches = new List<Match>();

			if (baseMode == null)
			{
				var provider = new ResourceStreamProvider(
					typeof(DietTemplateSyntaxMode).Assembly,
					typeof(DietTemplateSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("DietTemplateSyntaxDefinition")));
				using (var s = provider.Open())
					baseMode = SyntaxMode.Read(s);
			}

			this.rules = new List<Rule>(baseMode.Rules);
			this.keywords = new List<Keywords>(baseMode.Keywords);
			this.spans = new List<Span>(baseMode.Spans.Where(span => span.Begin.Pattern != "#")).ToArray();
			matches.AddRange(baseMode.Matches);
			this.prevMarker = baseMode.PrevMarker;
			this.SemanticRules = new List<SemanticRule>(baseMode.SemanticRules);
			SemanticRules.Add(InlineDHighlighting.Instance);
			this.keywordTable = baseMode.keywordTable;
			this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase;
			this.properties = baseMode.Properties;

			// D Number literals
			matches.Add(DSyntaxMode.workaroundMatchCtor(
				"Number"			
				, @"				(?<!\w)(0((x|X)[0-9a-fA-F_]+|(b|B)[0-1_]+)|([0-9]+[_0-9]*)[L|U|u|f|i]*)"));

			this.matches = matches.ToArray();
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:31,代码来源:DietTemplateSyntaxMode.cs


示例2: GetProvider

		public static IStreamProvider GetProvider (SyntaxMode mode)
		{
			foreach (string mimeType in mode.MimeType.Split (';')) {
				if (syntaxModeLookup.ContainsKey (mimeType)) 
					return syntaxModeLookup[mimeType];
			}
			return null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:SyntaxModeService.cs


示例3: DSyntaxMode

		public DSyntaxMode()
		{
			var matches = new List<Mono.TextEditor.Highlighting.Match>();

			if (baseMode == null)
			{
#if STABLE
				var provider = new ResourceXmlProvider(typeof(DSyntaxMode).Assembly,
					typeof(DSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("MonoDevelop.D.DSyntaxHighlightingMode")));
				using (XmlReader reader = provider.Open())
					baseMode = SyntaxMode.Read(reader);
#else
				var provider = new ResourceStreamProvider(
					typeof(DSyntaxMode).Assembly,
					typeof(DSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("DSyntaxHighlightingMode")));
				using (Stream s = provider.Open())
					baseMode = SyntaxMode.Read(s);
#endif
			}

			this.rules = new List<Rule>(baseMode.Rules);
			this.keywords = new List<Keywords>(baseMode.Keywords);
			this.spans = new List<Span>(baseMode.Spans.Where(span => span.Begin.Pattern != "#")).ToArray();
			matches.AddRange(baseMode.Matches);
			this.prevMarker = baseMode.PrevMarker;
			this.SemanticRules = new List<SemanticRule>(baseMode.SemanticRules);
			this.keywordTable = baseMode.keywordTable;
			this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase;
			this.properties = baseMode.Properties;

			// D Number literals
			matches.Add(workaroundMatchCtor(
#if STABLE
				"constant.digit"
#else
				"Number"
#endif			
				, @"(?<!\w)(0((x|X)[0-9a-fA-F_]+|(b|B)[0-1_]+)|([0-9]+[_0-9]*)[L|U|u|f|i]*)"));
			
			// extern linkages attributes
			//matches.Add(workaroundMatchCtor("constant.digit", "(?<=extern[\\s]*\\()[\\s]*(C(\\+\\+)?|D|Windows|System|Pascal|Java)[\\s]*(?=\\))"));

			// version checks
			//matches.Add(workaroundMatchCtor("constant.digit", @"(?<=version[\s]*\()[\s]*(DigitalMars|GNU|LDC|Windows|OSX|linux|FreeBSD|OpenBSD|BSD|Solaris|Posix|D_Version2)[\s]*(?=\))"));

			// type declaration names
			//matches.Add(workaroundMatchCtor("keyword.semantic.type", @"(?<=(class|struct|union|interface|template)[\s]+)[\w]+"));

			

			this.matches = matches.ToArray();
		}
开发者ID:rikkimax,项目名称:Mono-D,代码行数:52,代码来源:DSyntaxMode.cs


示例4: GetDelimiter

		public string GetDelimiter (SyntaxMode mode)
		{
			if (mode == null)
				return delimiter;
			return !delimiterSet ? mode.GetDelimiter (null) : delimiter; 
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:6,代码来源:Rule.cs


示例5: CSharpSpanParser

	//		Span preprocessorSpan;
	//		Rule preprocessorRule;
			
			public CSharpSpanParser (Mono.TextEditor.Document doc, SyntaxMode mode, CloneableStack<Span> spanStack) : base (doc, mode, spanStack)
			{
//				foreach (Span span in mode.Spans) {
//					if (span.Rule == "text.preprocessor") {
//						preprocessorSpan = span;
//						preprocessorRule = GetRule (span);
//					}
//				}
			}
开发者ID:Poiros,项目名称:monodevelop,代码行数:12,代码来源:CSharpSyntaxMode.cs


示例6: UpdateWorker

			public UpdateWorker (TextDocument doc, SyntaxMode mode, int startOffset, int endOffset)
			{
				this.doc = doc;
				this.mode = mode;
				this.startOffset = startOffset;
				this.endOffset = endOffset;
				IsFinished = false;
				ManualResetEvent = new ManualResetEvent (false);
			}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:SyntaxModeService.cs


示例7: StartUpdate

		public static void StartUpdate (TextDocument doc, SyntaxMode mode, int startOffset, int endOffset)
		{
			lock (updateQueue) {
				updateQueue.Enqueue (new UpdateWorker (doc, mode, startOffset, endOffset));
			}
			queueSignal.Set ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:SyntaxModeService.cs


示例8: ChunkParser

			public ChunkParser (SpanParser spanParser, Document doc, ColorSheme style, SyntaxMode mode, LineSegment line)
			{
				this.mode = mode;
				this.doc = doc;
				this.line = line;
				this.lineOffset = line.Offset;
				this.spanParser = spanParser;
				spanParser.FoundSpanBegin = FoundSpanBegin;
				spanParser.FoundSpanEnd = FoundSpanEnd;
				spanParser.FoundSpanExit = FoundSpanExit;
				spanParser.ParseChar += ParseChar;
				if (line == null)
					throw new ArgumentNullException ("line");
			}
开发者ID:nieve,项目名称:monodevelop,代码行数:14,代码来源:SyntaxMode.cs


示例9: Remove

		public static void Remove (SyntaxMode mode)
		{
			foreach (string mimeType in mode.MimeType.Split (';')) {
				if (syntaxModes.ContainsKey (mimeType)) 
					syntaxModes.Remove (mimeType);
				if (syntaxModeLookup.ContainsKey (mimeType)) 
					syntaxModeLookup.Remove (mimeType);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:SyntaxModeService.cs


示例10: ProtoTypeSyntaxModeProvider

		public ProtoTypeSyntaxModeProvider (SyntaxMode prototype)
		{
			this.prototype = prototype;
		}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:4,代码来源:SyntaxMode.cs


示例11: CreateChunkParser

		public virtual ChunkParser CreateChunkParser (SpanParser spanParser, Document doc, ColorSheme style, SyntaxMode mode, LineSegment line)
		{
			return new ChunkParser (spanParser, doc, style, mode, line);
		}
开发者ID:nieve,项目名称:monodevelop,代码行数:4,代码来源:SyntaxMode.cs


示例12: CSharpChunkParser

			public CSharpChunkParser (SpanParser spanParser, Mono.TextEditor.Document doc, Style style, SyntaxMode mode, LineSegment line) : base (spanParser, doc, style, mode, line)
			{
				foreach (var tag in ProjectDomService.SpecialCommentTags) {
					tags.Add (tag.Tag);
				}
			}
开发者ID:nickname100,项目名称:monodevelop,代码行数:6,代码来源:CSharpSyntaxMode.cs


示例13: ChunkParser

			public ChunkParser (SyntaxMode mode, SpanParser spanParser, ColorScheme style, DocumentLine line)
			{
				this.mode = mode;
				this.doc = mode.Document;
				this.line = line;
				this.lineOffset = line.Offset;
				this.spanParser = spanParser;
				spanParser.FoundSpanBegin = FoundSpanBegin;
				spanParser.FoundSpanEnd = FoundSpanEnd;
				spanParser.FoundSpanExit = FoundSpanExit;
				spanParser.ParseChar += ParseChar;
				spanParser.IsAtWordStart = () => wordbuilder.Length == 0;
				if (line == null)
					throw new ArgumentNullException ("line");
			}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:15,代码来源:SyntaxMode.cs


示例14: GetCachedChunks

		Chunk GetCachedChunks (SyntaxMode mode, Document doc, Mono.TextEditor.Highlighting.Style style, LineSegment line, int offset, int length)
		{
//			return mode.GetChunks (doc, style, line, offset, length);
			ChunkDescriptor descriptor;
			if (chunkDict.TryGetValue (line, out descriptor)) {
				bool isInvalid;
				if (descriptor.Equals (line, offset, length, out isInvalid))
					return descriptor.Chunk;
				chunkDict.Remove (line);
			}

			Chunk chunk = mode.GetChunks (doc, style, line, offset, length);
			descriptor = new ChunkDescriptor (line, offset, length, chunk);
			chunkDict.Add (line, descriptor);
			return chunk;
		}
开发者ID:natosha,项目名称:monodevelop,代码行数:16,代码来源:TextViewMargin.cs


示例15: CreateLinePartLayout

		public LayoutWrapper CreateLinePartLayout (SyntaxMode mode, LineSegment line, int offset, int length, int selectionStart, int selectionEnd)
		{
			return GetCachedLayout (line, offset, length, selectionStart, selectionEnd, delegate (LayoutWrapper wrapper) {
				var atts = new FastPangoAttrList ();
				wrapper.Layout.Alignment = Pango.Alignment.Left;
				wrapper.Layout.FontDescription = textEditor.Options.Font;
				wrapper.Layout.Tabs = tabArray;
				StringBuilder textBuilder = new StringBuilder ();
				Chunk startChunk = GetCachedChunks (mode, Document, textEditor.ColorStyle, line, offset, length);
				for (Chunk chunk = startChunk; chunk != null; chunk = chunk != null ? chunk.Next : null) {
					try {
						textBuilder.Append (chunk.GetText (Document));
					} catch {
						Console.WriteLine (chunk);
					}
				}
				string lineText = textBuilder.ToString ();
				bool containsPreedit = offset <= textEditor.preeditOffset && textEditor.preeditOffset <= offset + length;
				uint preeditLength = 0;

				if (containsPreedit) {
					lineText = lineText.Insert (textEditor.preeditOffset - offset, textEditor.preeditString);
					preeditLength = (uint)textEditor.preeditString.Length;
				}
				char[] lineChars = lineText.ToCharArray ();
				int startOffset = offset, endOffset = offset + length;
				uint curIndex = 0, byteIndex = 0;
				uint curChunkIndex = 0, byteChunkIndex = 0;
				
				uint oldEndIndex = 0;
				for (Chunk chunk = startChunk; chunk != null; chunk = chunk != null ? chunk.Next : null) {
					ChunkStyle chunkStyle = chunk != null ? chunk.GetChunkStyle (textEditor.ColorStyle) : null;

					foreach (TextMarker marker in line.Markers)
						chunkStyle = marker.GetStyle (chunkStyle);

					if (chunkStyle != null) {
						startOffset = chunk.Offset;
						endOffset = chunk.EndOffset;

						uint startIndex = (uint)(oldEndIndex);
						uint endIndex = (uint)(startIndex + chunk.Length);
						oldEndIndex = endIndex;

						if (containsPreedit) {
							if (textEditor.preeditOffset < startOffset)
								startIndex += preeditLength;
							if (textEditor.preeditOffset < endOffset)
								endIndex += preeditLength;
						}
						
						HandleSelection (line, selectionStart, selectionEnd, chunk.Offset, chunk.EndOffset, delegate(int start, int end) {
							var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
							var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
							atts.AddForegroundAttribute (chunkStyle.Color, si, ei);
							
							if (!chunkStyle.TransparentBackround && GetPixel (ColorStyle.Default.BackgroundColor) != GetPixel (chunkStyle.BackgroundColor)) {
								atts.AddBackgroundAttribute (chunkStyle.BackgroundColor, si, ei);
							}
						}, delegate(int start, int end) {
							var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
							var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
							atts.AddForegroundAttribute (SelectionColor.Color, si, ei);
							if (!wrapper.StartSet) 
								wrapper.SelectionStartIndex = (int)si;
							wrapper.SelectionEndIndex   = (int)ei;
						});
						
						var translatedStartIndex = TranslateToUTF8Index (lineChars, (uint)startIndex, ref curChunkIndex, ref byteChunkIndex);
						var translatedEndIndex = TranslateToUTF8Index (lineChars, (uint)endIndex, ref curChunkIndex, ref byteChunkIndex);

						if (chunkStyle.Bold)
							atts.AddWeightAttribute (Pango.Weight.Bold, translatedStartIndex, translatedEndIndex);

						if (chunkStyle.Italic)
							atts.AddStyleAttribute (Pango.Style.Italic, translatedStartIndex, translatedEndIndex);
						
						if (chunkStyle.Underline)
							atts.AddUnderlineAttribute (Pango.Underline.Single, translatedStartIndex, translatedEndIndex);
					}
				}
				if (containsPreedit) {
					var si = TranslateToUTF8Index (lineChars, (uint)(textEditor.preeditOffset - offset), ref curIndex, ref byteIndex);
					var ei = TranslateToUTF8Index (lineChars, (uint)(si + preeditLength), ref curIndex, ref byteIndex);
					atts.AddUnderlineAttribute (Pango.Underline.Single, si, ei);
				}
				wrapper.LineChars = lineChars;
				wrapper.Layout.SetText (lineText);
				atts.AssignTo (wrapper.Layout);
				atts.Dispose ();
				int w, h;
				wrapper.Layout.GetSize (out w, out h);
				wrapper.PangoWidth = w;
			});
		}
开发者ID:natosha,项目名称:monodevelop,代码行数:95,代码来源:TextViewMargin.cs


示例16: Read

		public static Rule Read (SyntaxMode mode, XmlReader reader, bool ignoreCaseDefault)
		{
			Rule result = new Rule ();
			result.Name         = reader.GetAttribute ("name");
			result.DefaultColor = reader.GetAttribute ("color");
			result.IgnoreCase   = ignoreCaseDefault;
			if (!String.IsNullOrEmpty (reader.GetAttribute ("ignorecase")))
				result.IgnoreCase = Boolean.Parse (reader.GetAttribute ("ignorecase"));
			List<Match> matches = new List<Match> ();
			List<Span> spanList = new List<Span> ();
			List<Marker> prevMarkerList = new List<Marker> ();
			XmlReadHelper.ReadList (reader, Node, delegate () {
				switch (reader.LocalName) {
				case Node:
					return true;
				}
				return result.ReadNode (reader, matches, spanList, prevMarkerList);
			});
			result.matches = matches.ToArray ();
			result.spans   = spanList.ToArray ();
			result.prevMarker = prevMarkerList.ToArray ();
			return result;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:23,代码来源:Rule.cs


示例17: JaySpanParser

			public JaySpanParser (SyntaxMode mode, CloneableStack<Span> spanStack) : base (mode, spanStack)
			{
			}
开发者ID:nocache,项目名称:monodevelop,代码行数:3,代码来源:JaySyntaxMode.cs


示例18: DeepCopy

		SyntaxMode DeepCopy (TextDocument doc, SyntaxMode mode)
		{
			var newMode = new SyntaxMode (doc);
			
			newMode.MimeType = mode.MimeType;
			newMode.spans = new Span[mode.Spans.Length];
			for( int i = 0; i < mode.Spans.Length; i++) {
				newMode.spans [i] = mode.Spans [i].Clone ();
			}
			
			newMode.matches = mode.Matches;
			newMode.prevMarker = mode.PrevMarker;
			newMode.keywords = mode.keywords;
			newMode.keywordTable = mode.keywordTable;
			newMode.keywordTableIgnoreCase = mode.keywordTableIgnoreCase;
			foreach (var pair in mode.Properties)
				newMode.Properties.Add (pair.Key, pair.Value);
			
			foreach (var rule in mode.Rules) {
				if (rule is SyntaxMode) {
					newMode.rules.Add (DeepCopy (doc, (SyntaxMode)rule));
				} else {
					newMode.rules.Add (DeepCopy (doc, newMode, rule));
				}
			}
			return newMode;
		}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:27,代码来源:SyntaxMode.cs


示例19: CreateSpanParser

		public virtual SpanParser CreateSpanParser (Document doc, SyntaxMode mode, LineSegment line, CloneableStack<Span> spanStack)
		{
			return new SpanParser (doc, mode, spanStack ?? line.StartSpan.Clone ());
		}
开发者ID:nieve,项目名称:monodevelop,代码行数:4,代码来源:SyntaxMode.cs


示例20: SpanParser

			public SpanParser (Document doc, SyntaxMode mode, CloneableStack<Span> spanStack)
			{
				if (doc == null)
					throw new ArgumentNullException ("doc");
				this.doc  = doc;
				this.mode = mode;
				this.SpanStack = spanStack;
				this.CurRule = mode;
				this.ruleStack = CreateRuleStack ();
				this.CurRule = ruleStack.Peek ();
				this.CurSpan = spanStack.Count > 0 ? spanStack.Peek () : null;
				FoundSpanBegin = DefaultFoundSpanBegin;
				FoundSpanEnd = DefaultFoundSpanEnd;
				FoundSpanExit = DefaultFoundSpanEnd;
				ParseChar = delegate (ref int i, char ch) {};
			}
开发者ID:nieve,项目名称:monodevelop,代码行数:16,代码来源:SyntaxMode.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Unix.StdioFileStream类代码示例发布时间:2022-05-26
下一篇:
C# Highlighting.Span类代码示例发布时间: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