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

C# LastWritten类代码示例

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

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



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

示例1: 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


示例2: WriteIdentifier

		public override void WriteIdentifier(Identifier identifier)
		{
			if (identifier.IsVerbatim) {
				if (lastWritten == LastWritten.KeywordOrIdentifier) {
					// this space is not strictly required, so we call Space()
					Space();
				}
			} else if (lastWritten == LastWritten.KeywordOrIdentifier) {
				// this space is strictly required, so we directly call the formatter
				base.Space();
			}
			base.WriteIdentifier(identifier);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:14,代码来源:InsertRequiredSpacesDecorator.cs


示例3: WriteIdentifier

		public override void WriteIdentifier(Identifier identifier, TextTokenType tokenType)
		{
			if (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier)) {
				if (lastWritten == LastWritten.KeywordOrIdentifier) {
					// this space is not strictly required, so we call Space()
					Space();
				}
			} else if (lastWritten == LastWritten.KeywordOrIdentifier) {
				// this space is strictly required, so we directly call the formatter
				base.Space();
			}
			base.WriteIdentifier(identifier, tokenType);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:14,代码来源:InsertRequiredSpacesDecorator.cs


示例4: WriteIdentifier

        public override void WriteIdentifier(Identifier ident)
        {
            if(ident.IsVerbatim || ExpressoOutputWalker.IsKeyword(ident.Name, ident)){
                if(last_written == LastWritten.KeywordOrIdentifier){
                    // This space is not strictly required, so we delegate to Space()
                    Space();
                }
            }else if(last_written == LastWritten.KeywordOrIdentifier){
                // This space is strictly required, so we directly call the formatter
                base.Space();
            }

            base.WriteIdentifier(ident);
            last_written = LastWritten.KeywordOrIdentifier;
        }
开发者ID:hazama-yuinyan,项目名称:Expresso,代码行数:15,代码来源:InsertRequiredSpacesDecorator.cs


示例5: WriteSpecialsUpToRole

/*		void WriteKeyword (string keyword, Role tokenRole)
		{
			WriteSpecialsUpToRole (tokenRole);
			if (lastWritten == LastWritten.KeywordOrIdentifier)
				formatter.Space ();
			formatter.WriteKeyword (keyword);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}*/
		
		void WriteIdentifier(string identifier, Role<Identifier> identifierRole = null)
		{
			WriteSpecialsUpToRole(identifierRole ?? Roles.Identifier);
			if (IsKeyword(identifier, containerStack.Peek())) {
				if (lastWritten == LastWritten.KeywordOrIdentifier) {
					Space();
				}
				// this space is not strictly required, so we call Space()
				formatter.WriteToken("@");
			} else if (lastWritten == LastWritten.KeywordOrIdentifier) {
				formatter.Space();
				// this space is strictly required, so we directly call the formatter
			}
			formatter.WriteIdentifier(identifier);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:25,代码来源:CSharpOutputVisitor.cs


示例6: WriteKeyword

		void WriteKeyword(string token, Role tokenRole = null)
		{
			if (tokenRole != null) {
				WriteSpecialsUpToRole(tokenRole);
			}
			if (lastWritten == LastWritten.KeywordOrIdentifier) {
				formatter.Space();
			}
			formatter.WriteKeyword(token);
			lastWritten = LastWritten.KeywordOrIdentifier;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:11,代码来源:CSharpOutputVisitor.cs


示例7: VisitPreProcessorDirective

		public void VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective)
		{
			formatter.StartNode(preProcessorDirective);
			formatter.WritePreProcessorDirective(preProcessorDirective.Type, preProcessorDirective.Argument);
			formatter.EndNode(preProcessorDirective);
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:7,代码来源:CSharpOutputVisitor.cs


示例8: VisitComment

		public void VisitComment(Comment comment)
		{
			if (lastWritten == LastWritten.Division) {
				// When there's a comment starting after a division operator
				// "1.0 / /*comment*/a", then we need to insert a space in front of the comment.
				formatter.Space();
			}
			formatter.StartNode(comment);
			formatter.WriteComment(comment.CommentType, comment.Content);
			formatter.EndNode(comment);
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:12,代码来源:CSharpOutputVisitor.cs


示例9: VisitArraySpecifier

		public void VisitArraySpecifier(ArraySpecifier arraySpecifier)
		{
			StartNode(arraySpecifier);
			WriteToken(Roles.LBracket);
			foreach (var comma in arraySpecifier.GetChildrenByRole(Roles.Comma)) {
				WriteSpecialsUpToNode(comma);
				formatter.WriteToken(",");
				lastWritten = LastWritten.Other;
			}
			WriteToken(Roles.RBracket);
			EndNode(arraySpecifier);
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:12,代码来源:CSharpOutputVisitor.cs


示例10: CloseBrace

		void CloseBrace(BraceStyle style)
		{
			WriteSpecialsUpToRole(Roles.RBrace);
			formatter.CloseBrace(style);
			lastWritten = LastWritten.Other;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:6,代码来源:CSharpOutputVisitor.cs


示例11: NewLine

		void NewLine()
		{
			formatter.NewLine();
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:5,代码来源:CSharpOutputVisitor.cs


示例12: WriteToken

		void WriteToken(string token, Role tokenRole)
		{
			WriteSpecialsUpToRole(tokenRole);
			// 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 a destructor has modifiers then there should be a space before ~
			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] == '*'
				|| lastWritten == LastWritten.KeywordOrIdentifier && token[0] == '~') {
				formatter.Space();
			}
			formatter.WriteToken(token);
			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:x-strong,项目名称:ILSpy,代码行数:33,代码来源:CSharpOutputVisitor.cs


示例13: WritePrimitiveType

		public override void WritePrimitiveType(string type)
		{
			if (lastWritten == LastWritten.KeywordOrIdentifier) {
				Space();
			}
			base.WritePrimitiveType(type);
			if (type == "new") {
				lastWritten = LastWritten.Other;
			} else {
				lastWritten = LastWritten.KeywordOrIdentifier;
			}
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:12,代码来源:InsertRequiredSpacesDecorator.cs


示例14: WritePrimitiveValue

		public override void WritePrimitiveValue(object value, TextTokenType? tokenType = null, string literalValue = null)
		{
			base.WritePrimitiveValue(value, tokenType, literalValue);
			if (value == null || value is bool)
				return;
			if (value is string) {
				lastWritten = LastWritten.Other;
			} else if (value is char) {
				lastWritten = LastWritten.Other;
			} else if (value is decimal) {
				lastWritten = LastWritten.Other;
			} else if (value is float) {
				float f = (float)value;
				if (float.IsInfinity(f) || float.IsNaN(f)) return;
				lastWritten = LastWritten.Other;
			} else if (value is double) {
				double f = (double)value;
				if (double.IsInfinity(f) || double.IsNaN(f)) return;
				// needs space if identifier follows number;
				// this avoids mistaking the following identifier as type suffix
				lastWritten = LastWritten.KeywordOrIdentifier;
			} else if (value is IFormattable) {
				// needs space if identifier follows number;
				// this avoids mistaking the following identifier as type suffix
				lastWritten = LastWritten.KeywordOrIdentifier;
			} else {
				lastWritten = LastWritten.Other;
			}
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:29,代码来源:InsertRequiredSpacesDecorator.cs


示例15: WritePreProcessorDirective

		public override void WritePreProcessorDirective(PreProcessorDirectiveType type, string argument)
		{
			base.WritePreProcessorDirective(type, argument);
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:5,代码来源:InsertRequiredSpacesDecorator.cs


示例16: WriteComment

		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			if (lastWritten == LastWritten.Division) {
				// When there's a comment starting after a division operator
				// "1.0 / /*comment*/a", then we need to insert a space in front of the comment.
				base.Space();
			}
			base.WriteComment(commentType, content, refs);
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:10,代码来源:InsertRequiredSpacesDecorator.cs


示例17: NewLine

		public override void NewLine()
		{
			base.NewLine();
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:5,代码来源:InsertRequiredSpacesDecorator.cs


示例18: Space

		public override void Space()
		{
			base.Space();
			lastWritten = LastWritten.Whitespace;
		}
开发者ID:JackWangCUMT,项目名称:NRefactory,代码行数:5,代码来源:InsertRequiredSpacesDecorator.cs


示例19: Space

		/// <summary>
		/// Writes a space depending on policy.
		/// </summary>
		void Space(bool addSpace = true)
		{
			if (addSpace) {
				formatter.Space();
				lastWritten = LastWritten.Whitespace;
			}
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:10,代码来源:CSharpOutputVisitor.cs


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# LaunchingEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# Languages类代码示例发布时间: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