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

ReadName() private method

private ReadName ( idToken token ) : bool
token idToken
return bool
		private bool ReadName(idToken token)
		{
			char c;
			token.Type = TokenType.Name;

			do
			{
				token.Append(GetBufferCharacter(_scriptPosition++));
				c = GetBufferCharacter(_scriptPosition);
			}
			while(((c >= 'a') && (c <= 'z'))
			|| ((c >= 'A') && (c <= 'Z'))
			|| ((c >= '0') && (c <= '9'))
			|| (c == '_')
				// if treating all tokens as strings, don't parse '-' as a seperate token
			|| (((_options & LexerOptions.OnlyStrings) == LexerOptions.OnlyStrings) && (c == '-'))
				// if special path name characters are allowed
			|| (((_options & LexerOptions.AllowPathNames) == LexerOptions.AllowPathNames) && ((c == '/') || (c == '\\') || (c == ':') || (c == '.'))));

			//the sub type is the length of the name
			token.SubType = (TokenSubType) token.ToString().Length;

			return true;
		}