CSharpUtils.Templates.Tokenizers.TokenizerStringReader.ReadString C# (CSharp) Method

ReadString() public method

public ReadString ( ) : String
return String
		public String ReadString()
		{
			return ReadString(Available);
		}

Same methods

TokenizerStringReader::ReadString ( int Length ) : String

Usage Example

		static public List<TemplateToken> Tokenize(List<TemplateToken> Tokens, TokenizerStringReader StringReader)
		{
			while (true)
			{
				var Match = StringReader.Match(StartTagRegex);

				if (Match.Success)
				{
					var RawText = StringReader.ReadString(Match.Index);
					if (RawText.Length > 0) Tokens.Add(new RawTemplateToken() { Text = RawText });
					var OpenTagTokenString = StringReader.ReadString(2);

					// It is a comment.
					if (OpenTagTokenString == "{#")
					{
						int Index = StringReader.IndexOf("#}");
						if (Index == -1) throw(new Exception("Not closing comment"));
						StringReader.ReadString(Index + 2);
					}
					// It is either a expression tag or a special tag.
					else
					{
						Tokens.Add(new OpenTagTemplateToken() { Text = OpenTagTokenString });
						{
							ExpressionTokenizer.Tokenize(Tokens, StringReader);
						}
						var CloseTagTokenString = StringReader.ReadString(2);
						var ExpectedCloseTagTokenString = ((OpenTagTokenString == "{{") ? "}}" : "%}");
						if (CloseTagTokenString != ExpectedCloseTagTokenString)
						{
							throw (new Exception("Expected '" + ExpectedCloseTagTokenString + "' but got '" + CloseTagTokenString + "'"));
						}
						Tokens.Add(new CloseTagTemplateToken() { Text = CloseTagTokenString });
						continue;
					}
				}
				else
				{
					var RawText = StringReader.ReadString();
					if (RawText.Length > 0) Tokens.Add(new RawTemplateToken() { Text = RawText });
					return Tokens;
				}
			}
		}
All Usage Examples Of CSharpUtils.Templates.Tokenizers.TokenizerStringReader::ReadString