Ejemplo n.º 1
0
static SQInteger _regexp_constructor( HSQUIRRELVM v ) {
	const SQChar *error, *pattern;
	sq_getstring( v, 2, &pattern );
	SQRex *rex = sqstd_rex_compile( pattern, &error );
	if ( !rex ) return sq_throwerror( v, error );
	sq_setinstanceup( v, 1, rex );
	sq_setreleasehook( v, 1, _rexobj_releasehook );
	return 0;
}
Ejemplo n.º 2
0
void* RegExp::compile(const char* pattern)
{
	void* peer = NULL;

	const SQChar* error = NULL;
	if (pattern == NULL || *pattern == 0)
		error = "empty regexp pattern";
	else
		peer = sqstd_rex_compile(pattern, &error);

	if (peer == NULL)
		NIT_THROW_FMT(EX_SYNTAX, "regexp '%s' error: %s", pattern ? pattern : "", error);

	return peer;
}
Ejemplo n.º 3
0
void FeRomListSorter::init_title_rex( const std::string &re_mask )
{
	ASSERT( m_rex == NULL );

	if ( re_mask.empty() )
		return;

	const SQChar *err( NULL );
	m_rex = sqstd_rex_compile(
		(const SQChar *)re_mask.c_str(), &err );

	if ( !m_rex )
		std::cout << "Error compiling regular expression \""
			<< re_mask << "\": " << err << std::endl;
}