Exemple #1
0
_EXPORT int32 FindNextWord(const CLanguageProxy& proxy)
{
	int32 mark = 0, i = 0;
	int32 unicode, state, len;
	const char *txt = proxy.Text();

	state = 1;

	while (state && i < proxy.Size())
	{
		proxy.CharInfo(txt + i, unicode, len);

		if (proxy.isspace_uc(unicode))
		{
			state = 0;
		}
		else
		{
			mark = i + len - 1;
		}

		i += len;
	}

	return mark;
} /* FindNextWord */
int32 FindNextWord(const CLanguageProxy& proxy)
{
	int32 mark = 0, i = 0;
	int32 unicode, state, len;

	state = 1;

	while (state > 0 && i < proxy.Size())
	{
		proxy.CharInfo(proxy.Text() + i, unicode, len);

		int cl = 0;

		if (unicode == '\n')
			cl = 3;
		else if (proxy.isspace_uc(unicode))
			cl = 2;
		else if (proxy.isalnum_uc(unicode))
			cl = 4;
		else
			switch (unicode)
			{
				case 160:
				case 8199:
				case 8209:
					cl = 1;
					break;
				case '&':
				case '*':
				case '+':
				case '-':
//				case '/':
//				case '<':
				case '=':
//				case '>':
				case '\\':
				case '^':
				case '|':
					cl = 5;
					break;
				default:
					cl = 4;
			}

		unsigned char t = kWordWrapTable[(state - 1) * 6 + cl];

		state = t & 0x7f;

		if (t & 0x80)
			mark = i + len - 1;

		i += len;
	}

	return mark;
} /* FindNextWord */