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


C# CSharp.Role类代码示例

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


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

示例1: WriteKeyword

		public override void WriteKeyword(Role role, string keyword)
		{
			WriteIndentation();
			column += keyword.Length;
			textWriter.Write(keyword);
			isAtStartOfLine = false;
		}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:7,代码来源:TextWriterOutputFormatter.cs

示例2: WriteKeyword

		public override void WriteKeyword(Role role, string keyword)
		{
			if (role != null) {
				WriteSpecialsUpToRole(role);
			}
			base.WriteKeyword(role, keyword);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:7,代码来源:InsertSpecialsDecorator.cs

示例3: WriteToken

		public override void WriteToken(Role role, string token)
		{
			WriteIndentation();
			column += token.Length;
			textWriter.Write(token);
			isAtStartOfLine = false;
		}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:7,代码来源:TextWriterOutputFormatter.cs

示例4: WriteToken

		public override void WriteToken(Role role, string token, TextTokenType tokenType)
		{
			// Avoid that two +, - or ? tokens are combined into a ++, -- or ?? token.
			// Note that we don't need to handle tokens like = because there's no valid
			// C# program that contains the single token twice in a row.
			// (for +, - and &, this can happen with unary operators;
			// for ?, this can happen in "a is int? ? b : c" or "a as int? ?? 0";
			// and for /, this can happen with "1/ *ptr" or "1/ //comment".)
			if (lastWritten == LastWritten.Plus && token[0] == '+' ||
			    lastWritten == LastWritten.Minus && token[0] == '-' ||
			    lastWritten == LastWritten.Ampersand && token[0] == '&' ||
			    lastWritten == LastWritten.QuestionMark && token[0] == '?' ||
			    lastWritten == LastWritten.Division && token[0] == '*') {
				base.Space();
			}
			base.WriteToken(role, token, tokenType);
			if (token == "+") {
				lastWritten = LastWritten.Plus;
			} else if (token == "-") {
				lastWritten = LastWritten.Minus;
			} else if (token == "&") {
				lastWritten = LastWritten.Ampersand;
			} else if (token == "?") {
				lastWritten = LastWritten.QuestionMark;
			} else if (token == "/") {
				lastWritten = LastWritten.Division;
			} else {
				lastWritten = LastWritten.Other;
			}
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:30,代码来源:InsertRequiredSpacesDecorator.cs

示例5: WriteKeyword

		public override void WriteKeyword(Role role, string keyword)
		{
			if (lastWritten == LastWritten.KeywordOrIdentifier) {
				Space();
			}
			base.WriteKeyword(role, keyword);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:8,代码来源:InsertRequiredSpacesDecorator.cs

示例6: WriteToken

		public override void WriteToken(Role role, string token)
		{
			CSharpTokenNode t = new CSharpTokenNode(locationProvider.Location, (TokenRole)role);
			EmptyStatement node = nodes.Peek().LastOrDefault() as EmptyStatement;
			if (node == null)
				currentList.Add(t);
			else {
				node.Location = locationProvider.Location;
			}
			base.WriteToken(role, token);
		}
开发者ID:dyxu,项目名称:vimrc,代码行数:11,代码来源:InsertMissingTokensDecorator.cs

示例7: WriteKeyword

		public override void WriteKeyword(Role role, string keyword)
		{
			TextLocation start = locationProvider.Location;
			CSharpTokenNode t = null;
			if (role is TokenRole)
				t = new CSharpTokenNode(start, (TokenRole)role);
			else if (role == EntityDeclaration.ModifierRole)
				t = new CSharpModifierToken(start, CSharpModifierToken.GetModifierValue(keyword));
			else if (keyword == "this") {
				ThisReferenceExpression node = nodes.Peek().LastOrDefault() as ThisReferenceExpression;
				if (node != null)
					node.Location = start;
			} else if (keyword == "base") {
				BaseReferenceExpression node = nodes.Peek().LastOrDefault() as BaseReferenceExpression;
				if (node != null)
					node.Location = start;
			}
			if (t != null) currentList.Add(t);
			base.WriteKeyword(role, keyword);
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:20,代码来源:InsertMissingTokensDecorator.cs

示例8: AddAttributeSection

 public void AddAttributeSection(AstNode parent, Attributes attrs, Role role)
 {
     if (attrs == null)
         return;
     foreach (var attr in attrs.Sections) {
         parent.AddChild (ConvertAttributeSection (attr), EntityDeclaration.AttributeRole);
     }
 }
开发者ID:kaagati,项目名称:NRefactory,代码行数:8,代码来源:CSharpParser.cs

示例9: WriteTokenNumber

		public void WriteTokenNumber(Role tokenRole, string token)
		{
			WriteToken(tokenRole, token, BoxedTextColor.Number);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:4,代码来源:ITokenWriter.cs

示例10: WriteToken

		public override void WriteToken(Role role, string token, object data)
		{
			decoratedWriter.WriteToken(role, token, data);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:4,代码来源:ITokenWriter.cs

示例11: WriteToken

		void WriteToken(string token, Role tokenRole)
		{
			writer.WriteToken(tokenRole, token);
			isAtStartOfLine = false;
		}
开发者ID:jeremiahyan,项目名称:ILSpy,代码行数:5,代码来源:CSharpOutputVisitor.cs

示例12: WriteKeyword

		void WriteKeyword(string token, Role tokenRole = null)
		{
			writer.WriteKeyword(tokenRole, token);
			isAtStartOfLine = false;
		}
开发者ID:jeremiahyan,项目名称:ILSpy,代码行数:5,代码来源:CSharpOutputVisitor.cs

示例13: WriteKeyword

		/// <summary>
		/// Writes a keyword to the output.
		/// </summary>
		public abstract void WriteKeyword(Role role, string keyword);
开发者ID:sphynx79,项目名称:dotfiles,代码行数:4,代码来源:ITokenWriter.cs

示例14: WriteSpecialsUpToRole

		void WriteSpecialsUpToRole(Role role, AstNode nextNode)
		{
			if (positionStack.Count == 0) {
				return;
			}
			// Look for the role between the current position and the nextNode.
			for (AstNode pos = positionStack.Peek(); pos != null && pos != nextNode; pos = pos.NextSibling) {
				if (pos.Role == role) {
					WriteSpecials(positionStack.Pop(), pos);
					// Push the next sibling because the node matching the role is not a special,
					// and should be considered to be already handled.
					positionStack.Push(pos.NextSibling);
					// This is necessary for OptionalComma() to work correctly.
					break;
				}
			}
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:17,代码来源:CSharpOutputVisitor.cs

示例15: AddAttributeSection

			public void AddAttributeSection(AstNode parent, Attributes attrs, Role<AttributeSection> role)
			{
				if (attrs == null)
					return;
				foreach (var attr in attrs.Sections) {
					var section = ConvertAttributeSection(attr);
					if (section == null)
						continue;
					parent.AddChild(section, role);
				}
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:11,代码来源:CSharpParser.cs


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