Exemplo n.º 1
0
void RxCompile::charClass()
	{
	bool negate = match('^');
	gcstring chars = "";
	if (match(']'))
		chars += "]";
	CharMatcher* cm = &CharMatcher::NONE;
	while (si < sn && src[si] != ']')
		{
		CharMatcher* elem;
		if (matchRange())
			{
			unsigned from = src[si - 3];
			unsigned to = src[si - 1];
			elem = (from < to)
				? CharMatcher::inRange(from, to)
				: &CharMatcher::NONE;
			}
		else if (match("\\d"))
			elem = digit;
		else if (match("\\D"))
			elem = notDigit;
		else if (match("\\w"))
			elem = word;
		else if (match("\\W"))
			elem = notWord;
		else if (match("\\s"))
			elem = space;
		else if (match("\\S"))
			elem = notSpace;
		else if (match("[:"))
			elem = posixClass();
		else
			{
			if (si + 1 < sn)
				match("\\");
			chars += gcstring(src + si, 1);
			si++;
			continue;
			}
		cm = cm->or_(elem);
		}
	if (!negate && cm == &CharMatcher::NONE && chars.size() == 1)
		{
		emitChars(chars.ptr(), 1);
		return;
		}
	if (chars.size() > 0)
		cm = cm->or_(CharMatcher::anyOf(chars));
	if (negate)
		cm = cm->negate();
	emit(new CharClass(cm, ignoringCase));
	}
Exemplo n.º 2
0
Header HistoryTable::header() {
	return Header(lisp(Fields(), lisp(gcstring("_date"), gcstring("_action")),
					  Fields(), theDB()->get_fields(table)),
		columns());
}
Exemplo n.º 3
0
	void add(const char* s, int sn)
		{
		chars += gcstring(s, sn);
		}
Exemplo n.º 4
0
Indexes HistoryTable::keys() {
	return lisp(lisp(gcstring("_date")));
}