// This file is part of the Coral project.
// Please read the copyright notice in the LICENSE file.

#include "regexp.h"
#include <iostream>
#include <coral/lib/debugstream.h>
#include <stdexcept>

namespace coral {

	RE::RE(const char* pattern, int flags) {
		int err = regcomp(&re, pattern, flags);
		if (err) {
			std::string s("Error in regexp pattern ");
			s += pattern;
			s += "!";
			throw std::runtime_error(s);
		}
	}

	RE::~RE() throw () {
		regfree(&re);
	}
}
