Yaml.ParseStream.StopLiteral C# (CSharp) Method

StopLiteral() public method

Stop parsing literal
public StopLiteral ( ) : void
return void
		public new void StopLiteral ()
		{
			base.StopLiteral ();

			DontStop ();
		}
		/// <summary> Move to the next character in the parse stream. </summary>

Usage Example

Exemplo n.º 1
0
        /// <summary>
        ///   Parses a String surrounded with single quotes
        /// </summary>
        private string ParseSingleQuoted(ParseStream stream)
        {
            System.Text.StringBuilder builder = new System.Text.StringBuilder();

            // Start literal parsing
            stream.StartLiteral();

            // Skip '''
            stream.Next(true);

            while (!stream.EOF)
            {
                if (stream.Char == '\'')
                {
                    stream.Next();

                    // Escaped single quote
                    if (stream.Char == '\'')
                    {
                        builder.Append(stream.Char);
                    }

                    // End of string
                    else
                    {
                        break;
                    }
                }
                else
                {
                    builder.Append(stream.Char);
                }

                stream.Next();

                // Skip \'
                if (stream.EOF)
                {
                    stream.StopLiteral();
                    throw new ParseException(stream,
                                             "Single quoted string not closed");
                }
            }

            // Stop literal parsing
            stream.StopLiteral();

            return(builder.ToString());
        }
All Usage Examples Of Yaml.ParseStream::StopLiteral