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

ReadPunctuation() private method

private ReadPunctuation ( idToken token ) : bool
token idToken
return bool
		private bool ReadPunctuation(idToken token)
		{
			int i, l;
			string p;
			LexerPunctuation punc;
			int puncCount = _punctuation.Length;
			int bufferLength = _buffer.Length;
			int puncMarkLength;

			// TODO
			/*#ifdef PUNCTABLE
			for (n = idLexer::punctuationtable[(unsigned int)*(idLexer::script_p)]; n >= 0; n = idLexer::nextpunctuation[n])
			{
				punc = &(idLexer::punctuations[n]);
			#else*/

			for(i = 0; i < puncCount; i++)
			{
				punc = _punctuation[i];

				/*#endif*/

				p = punc.P;
				puncMarkLength = p.Length;

				// check for this punctuation in the script
				for(l = 0; ((l < puncMarkLength) && ((_scriptPosition + l) < bufferLength)); l++)
				{
					if(GetBufferCharacter(_scriptPosition + l) != p[l])
					{
						break;
					}
				}

				if(l >= puncMarkLength)
				{
					for(i = 0; i < l; i++)
					{
						token.Append(p[i]);
					}

					_scriptPosition += l;

					token.Type = TokenType.Punctuation;
					token.SubType = (TokenSubType) punc.N;

					return true;
				}
			}

			return false;
		}