Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <libwccl/wcclfile.h>
namespace Wccl {
FunctionalOpSequence::name_op_v_t WcclFile::gen_all_op_pairs()
{
FunctionalOpSequence::name_op_v_t v;
foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) {
s->add_name_op_pairs_untyped(v);
}
return v;
}
FunctionalOpSequence::name_op_v_c_t WcclFile::gen_all_op_pairs() const
{
FunctionalOpSequence::name_op_v_c_t v;
foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) {
s->add_name_op_pairs_untyped(v);
}
return v;
}
boost::shared_ptr<TagRuleSequence> WcclFile::get_tag_rules_ptr()
{
if (!has_tag_rules()) {
throw WcclError("There are no tag rules.");
}
return tag_rules_;
}
boost::shared_ptr<const TagRuleSequence> WcclFile::get_tag_rules_ptr() const
{
if (!has_tag_rules()) {
throw WcclError("There are no tag rules.");
}
return tag_rules_;
}
boost::shared_ptr<MatchRuleSequence> WcclFile::get_match_rules_ptr()
{
if (!has_match_rules()) {
throw WcclError("There are no match rules.");
}
return match_rules_;
}
boost::shared_ptr<const MatchRuleSequence> WcclFile::get_match_rules_ptr() const
{
if (!has_match_rules()) {
throw WcclError("There are no match rules.");
}
return match_rules_;
}
std::ostream& WcclFile::write_to(std::ostream& os) const
{
if (has_lexicons()) {
foreach(const Lexicons::map_t::value_type& v, lexicons_->get_lexicons()) {
os << "import(\"" << v.second->file_name() << ", \""
<< v.second->name() << "\")\n";
}
}
foreach(const boost::shared_ptr<FunctionalOpSequence>& s, all_sections_) {
os << s->to_string(tagset_) << '\n';
}
if (has_tag_rules()) {
os << tag_rules_->to_string(tagset_) << '\n';
}
os << match_rules_->to_string(tagset_) << '\n';