idTech4.Text.idLexer.SkipBracedSection C# (CSharp) Method

SkipBracedSection() public method

Skips until a matching close brace is found.
public SkipBracedSection ( bool parseFirstBrace ) : bool
parseFirstBrace bool
return bool
		public bool SkipBracedSection(bool parseFirstBrace)
		{
			int depth = (parseFirstBrace == true) ? 0 : 1;
			idToken token;

			string tokenValue;

			do
			{
				if((token = ReadToken()) == null)
				{
					return false;
				}

				tokenValue = token.ToString();

				if(token.Type == TokenType.Punctuation)
				{
					if(tokenValue == "{")
					{
						depth++;
					}
					else if(tokenValue == "}")
					{
						depth--;
					}
				}
			}
			while(depth > 0);

			return true;
		}

Same methods

idLexer::SkipBracedSection ( ) : bool

Usage Example

Example #1
0
		public virtual bool Parse(string text)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException(this.GetType().Name);
			}

			idLexer lexer = new idLexer(idDeclFile.LexerOptions);
			lexer.LoadMemory(text, this.FileName, this.LineNumber);
			lexer.SkipUntilString("{");
			lexer.SkipBracedSection(false);

			return true;
		}
All Usage Examples Of idTech4.Text.idLexer::SkipBracedSection