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


C# LastWritten类代码示例

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


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


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