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


C# IInput.Skip方法代码示例

本文整理汇总了C#中IInput.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# IInput.Skip方法的具体用法?C# IInput.Skip怎么用?C# IInput.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInput的用法示例。


在下文中一共展示了IInput.Skip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseMacro

		private void ParseMacro( int depth, IInput input, StringBuilder sb )
		{
			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;

			// ******
			while( true ) {
				//
				// first quote check
				//
				if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
					//
					// GetQuotedText() strips the outer quotes but perserves inner quotes; but
					// first we need to eat the open quote
					//
					gc.SeqOpenQuote.Skip( input );
					sb.Append( gc.GetQuotedText(input, true) );
				}

				// ******				
				char ch = input.Next();

				// ******				
				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "ExpandoBlock: end of input before \"##)\" found" );
				}
				
				// ******				
				//
				// (## ...
				//
				if( SC.OPEN_PAREN == ch && input.StartsWith(EB_START) ) {
					//
					// get recursive
					//
					input.Skip( EB_START.Length );

					sb.Append( EB_INJECT );
					ParseMacro( 1 + depth, input, sb );
					sb.Append( EBEND_INJECT );
					continue;
				}

				else if( SC.HASH == ch && input.StartsWith(EBEND) ) {
					input.Skip( EBEND.Length );
					return;
				}

				else {
					sb.Append( ch );
				}
			}
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:53,代码来源:ExpandoBlock.cs

示例2: ParseMacro

		///////////////////////////////////////////////////////////////////////////

		private void ParseMacro( IInput input, StringBuilder sb )
		{
			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;

			// ******
			while( true ) {
				//
				// first quote check - allows (#endarray) to be embedded in the text
				//
				if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
					//
					// GetQuotedText() strips the outer quotes but perserves inner quotes; but
					// first we need to eat the open quote
					//
					gc.SeqOpenQuote.Skip( input );
					sb.Append( gc.GetQuotedText(input, true) );
				}

				// ******				
				char ch = input.Next();

				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "deflist: end of input before (#endlist) found" );
				}
				
				if( SC.OPEN_PAREN == ch && input.StartsWith(ENDLIST) ) {
					input.Skip( ENDLIST.Length );
					return;
				}

				else {
					sb.Append( ch );
				}
			}
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:38,代码来源:Deflist.cs

示例3: ParseExpression

		/////////////////////////////////////////////////////////////////////////////

		public MacroExpression ParseExpression( IInput input )
		{
			// ******
			var exList = new MacroExpression( new NmpStringList() );

			// ******
			//
			// first token is the name of the macro
			//
			string	token = rootName;
			bool		haveFreshToken = true;

			// ******
			while( true ) {
				bool isRootNode = 0 == exList.Count;
				bool allDone = false;

				char ch = input.Peek();

				if( haveFreshToken ) {
					allDone = HandleFreshToken( isRootNode, token, char.IsWhiteSpace(ch), exList, input );
					haveFreshToken = false;
				}
				
				if( SC.DOT == ch ) {
					//
					// '.'
					//
					input.Skip( 1 );
					token = GetToken( input );
				
					if( string.IsNullOrEmpty(token) ) {
						//
						// does not return
						//
						UnexpectedCharacter( input.Peek(), "expecting identifier (member name)" );
					}
				
					// ******
					haveFreshToken = true;
				}

// jpm 11 April 13; change back to NOT check for (# because its more correct that what
// we ended up with - that is, without the check its possible for the user to create a
// macro (across multiple lines using '-' at end of line and comments ;;) where we
// get "something()(#defmacro..)" glued together as the result of a macro atempting to
// call a method - not what was intended
//
				//else if( SC.OPEN_PAREN == ch && SC.HASH != input.Peek(1) ) {
				else if( SC.OPEN_PAREN == ch ) {
					//
					// '(' NOT "(#"
					//
					input.Skip( 1 );
					exList.Add( MethodCall(isRootNode, token, haveFreshToken, input) );
					haveFreshToken = false;
				}

				else if( SC.OPEN_BRACKET == ch ) {
					//
					// '['
					//
					input.Skip( 1 );
					exList.Add( IndexMember(isRootNode, token, haveFreshToken, input) );
					haveFreshToken = false;                                               
				}

				else if( SC.ATCHAR == ch && SC.OPEN_BRACKET == input.Peek(1) ) {
					input.Skip( 2 );
					ParseMacroOptions( input, exList.MacroInstructions );
				}
				else {
					//
					// end of expression
					//

					/*	

						should put whatever we do here just before the end of the
						method - get it out of here for cleanthlyness sake


						if is altInvocationExpression and we did not detect it as a method in HandleFreshToken()
							
							we've hit ')' or some char we don't know what to do with

						we could gather up "... )" and add to MacroOptions

							or error

							or just eat it
					*/

					//if( isAltInvocationExpression && ! allDone ) {
					//	//NmpStringList strArgs = argScanner( input, RecognizedCharType.CloseParenChar );
					//	NmpStringList strArgs = scanner.ArgScanner( input, RecognizedCharType.CloseParenChar );
					//}

//.........这里部分代码省略.........
开发者ID:jmclain,项目名称:Nmp,代码行数:101,代码来源:ETB.cs

示例4: ParseMacro

		///////////////////////////////////////////////////////////////////////////

		private void ParseMacro( int depth, IInput input, StringBuilder sb )
		{
			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;

			// ******
			while( true ) {
				//
				// first quote check
				//
				if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
					//
					// GetQuotedText() strips the outer quotes but perserves inner quotes; but
					// first we need to eat the open quote
					//
					gc.SeqOpenQuote.Skip( input );
					sb.Append( gc.GetQuotedText(input, true) );
				}

				// ******				
				char ch = input.Next();

				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "defmacro/pushmacro: end of input before (#endmacro) found" );
				}
				
				// ******				
				//
				// (#defmacro ...
				// (#pushmacro ...
				//
				if( SC.OPEN_PAREN == ch && input.StartsWith(BLOCK_FOREACH_START) ) {
					//
					// get recursive
					//
					input.Skip( BLOCK_FOREACH_START.Length );

					if( ! char.IsWhiteSpace(input.Peek()) ) {
						ThreadContext.MacroError( "expected white space following \"(#defmacro\"" );
					}
					
					sb.Append( BLOCK_FOREACH_INJECT );
					ParseMacro( 1 + depth, input, sb );
					sb.Append( BLOCK_ENDFOREACH_INJECT );
					continue;
				}

				else if( SC.OPEN_PAREN == ch && input.StartsWith(BLOCK_FOREACH_END) ) {
					input.Skip( BLOCK_FOREACH_END.Length );
					return;
				}

				else {
					sb.Append( ch );
				}
			}
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:59,代码来源:ForeachBlockMacro.cs

示例5: ParseBlock

		/////////////////////////////////////////////////////////////////////////////

		public override string ParseBlock( Expression exp, IInput input )
		{
			// ******
			//
			// remove any newline following the closing paren (#macro ...)
			//
			if( SC.NEWLINE == input.Peek() ) {
				input.Skip( 1 );
			}

			// ******
			StringBuilder macroText = new StringBuilder();
			ParseMacro( input, macroText );

			// ******
			//
			// remove any newline following the closing paren for the (#endmacro)
			//
			if( SC.NEWLINE == input.Peek() ) {
				input.Skip( 1 );
			}

			// ******
			return macroText.ToString();
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:27,代码来源:Deflist.cs

示例6: ParseMacro

		private void ParseMacro( int depth, IInput input, StringBuilder sb )
		{
			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;

			// ******
			while( true ) {
				//
				// Text Blocks no longer require ballanced quotes
				//
				// first quote check
				//
				//if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
				//	//
				//	// GetQuotedText() strips the outer quotes but perserves inner quotes; but
				//	// first we need to eat the open quote
				//	//
				//	gc.SeqOpenQuote.Skip( input );
				//	sb.Append( gc.GetQuotedText(input, true) );
				//}

				// ******				
				char ch = input.Next();

				// ******				
				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "textblock: end of input before (#tbend) found" );
				}
				
				// ******				
				//
				// (#textblock ...
				//
				if( SC.OPEN_PAREN == ch && input.StartsWith(TB_START) ) {
					//
					// get recursive
					//
					input.Skip( TB_START.Length );

					//if( ! char.IsWhiteSpace(input.Peek()) ) {
					//	ThreadContext.MacroError( "expected white space following \"(#Textblock\"" );
					//}
					
					sb.Append( TB_INJECT );
					ParseMacro( 1 + depth, input, sb );
					sb.Append( TBEND_INJECT );
					continue;
				}

				else if( SC.OPEN_PAREN == ch && input.StartsWith(TBEND) ) {
					input.Skip( TBEND.Length );
					return;
				}

				//else if( ThreadContext.SeqOpenQuote.FirstChar == ch && ThreadContext.SeqOpenQuote.Starts(input) ) {
				//	//
				//	// GetQuotedText() strips the outer quotes but perserves inner quotes; but
				//	// first we need to eat the open quote
				//	//
				//	ThreadContext.SeqOpenQuote.Skip( input );
				//	sb.Append( ThreadContext.GetQuotedText(input, true) );
				//}

				else {
					sb.Append( ch );
				}
			}
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:68,代码来源:Textblock.cs

示例7: ParseMacro

		///////////////////////////////////////////////////////////////////////////

		private void ParseMacro( int depth, IInput input, StringBuilder sb )
		{
			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;

			// ******
			while( true ) {
				//
				// first quote check
				//
				if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
					//
					// GetQuotedText() strips the outer quotes but perserves inner quotes; but
					// first we need to eat the open quote
					//
					gc.SeqOpenQuote.Skip( input );
					sb.Append( gc.GetQuotedText(input, true) );
				}

				// ******				
				char ch = input.Next();

				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "defmacro/pushmacro: end of input before (#endmacro) found" );
				}
				
				// ******				
				//
				// (#defmacro ...
				// (#pushmacro ...
				//
				if( SC.OPEN_PAREN == ch && input.StartsWith(DEFMACRO_START) ) {
					//
					// get recursive
					//
					input.Skip( DEFMACRO_START.Length );

					if( ! char.IsWhiteSpace(input.Peek()) ) {
						ThreadContext.MacroError( "expected white space following \"(#defmacro\"" );
					}
					
					sb.Append( DEFMACRO_INJECT );
					ParseMacro( 1 + depth, input, sb );
					sb.Append( ENDMACRO_INJECT );
					continue;
				}

		//
		// easier / shorter way to do this - duping code from above
		//
				else if( SC.OPEN_PAREN == ch && input.StartsWith(PUSHMACRO_START) ) {
					//
					// get recursive
					//
					input.Skip( PUSHMACRO_START.Length );

					if( ! char.IsWhiteSpace(input.Peek()) ) {
						ThreadContext.MacroError( "expected white space following \"(#defmacro\"" );
					}
					
					sb.Append( PUSHMACRO_INJECT );
					ParseMacro( 1 + depth, input, sb );
					sb.Append( ENDMACRO_INJECT );
					continue;
				}

					//case SC.EMBED_BEGIN_INBLOCK_EXPAND_CHAR:
					//	if( 0 == depth ) {
					//		//
					//		// only for the outermost macro code
					//		//
					//		sb.Append( HandleEmbedMacroBlock(input) );
					//		continue;
					//	}
					//	break;

				else if( SC.OPEN_PAREN == ch && input.StartsWith(ENDMACRO) ) {
					input.Skip( ENDMACRO.Length );
					return;
				}

				else {
					sb.Append( ch );
				}
			}
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:88,代码来源:DefMacro.cs

示例8: IfProcessor

		// (#if bool_expression )
		//
		// ... (#elseif ...) / (#else)
		//
		// (#endif)

//		///////////////////////////////////////////////////////////////////////////
//
//		
//string	IfElseEndifPatterns =
//
//@"(?x)\A
//(
//\(\#if[ \t]|
//\(\#elseif[ \t]|
//\(\#else\)|
//\(\#endif\)|
//
//)
//";
//
		
		///////////////////////////////////////////////////////////////////////////

		private StringBuilder IfProcessor( IInput input, bool processing, int depth )
		{
		StringBuilder	result = new StringBuilder();
		bool	inElse = false;
		bool done = false;
		
		/*
		
			processing says whether we are saving text or not
			
				text is only saved if processing is true
			
			depth is how may if statements deep we are into the process
			
				depth zero is the first level after examining the truth of the outermost if, at this
				level processing can be toggled by the else statement and NOT have an else token reinjected
				into the code
				
				at levels greather than zero if/else/endif tokens are reinjected into the code to be
				processed after the text has been pushed back onto the input and is scanned again
		
		
		*/

			// ******
			char quoteStartChar = gc.SeqOpenQuote.FirstChar;
			
			// ******
			while( true ) {
				//
				// first quote check
				//
				if( quoteStartChar == input.Peek() && gc.SeqOpenQuote.Starts(input) ) {
					//
					// GetQuotedText() strips the outer quotes but perserves inner quotes; but
					// first we need to eat the open quote
					//
					gc.SeqOpenQuote.Skip( input );
					string text = gc.GetQuotedText( input, true );

					if( processing ) {
						result.Append( text );
					}
				}

				// ******				
				char ch = input.Next();

				// ******				
				if( SC.NO_CHAR == ch ) {
					ThreadContext.MacroError( "IfHandler: end of input before (#endif) found" );
					return result;
				}
				
				// ******				
				//
				// (#if ...
				//
				if( SC.OPEN_PAREN == ch && input.StartsWith(IF_START) ) {
					//
					// get recursive
					//
					input.Skip( IF_START.Length );

					if( ! char.IsWhiteSpace(input.Peek()) ) {
						ThreadContext.MacroError( "expected white space following \"(#if\"" );
					}
					
					if( processing ) {
						result.Append( IF_INJECT );
					}

					result.Append( IfProcessor(input, processing, 1 + depth) );
					continue;
				}
				
//.........这里部分代码省略.........
开发者ID:jmclain,项目名称:Nmp,代码行数:101,代码来源:If.cs

示例9: ParseBlock

		/////////////////////////////////////////////////////////////////////////////

		public override string ParseBlock( Expression exp, IInput input )
		{
			// ******
			var args = GetMacroArgsAsTuples( exp ) as NmpTuple<bool>;
			bool initialIfIsTrue = args.Item1;

			//  ******
			string	result = string.Empty;
			StringBuilder text = new StringBuilder();
			bool	processing = initialIfIsTrue;
		
			// ******
			if( SC.NEWLINE == input.Peek() ) {
				input.Skip( 1 );
			}

			// ******
			return IfProcessor( input, processing, DEPTH_ZERO ).ToString();
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:21,代码来源:If.cs

示例10: Skip

		/////////////////////////////////////////////////////////////////////////////

		public void Skip( IInput input, TokenMap tm )
		{
			// ******
			int skipCount = tm.MatchLength;
			input.Skip( skipCount );
		}
开发者ID:jmclain,项目名称:Nmp,代码行数:8,代码来源:BaseRecognizer.cs


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