From 45e923f3905259a9955ec0f1a22ee499f9ff5589 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Tue, 28 Jun 2011 10:08:31 +0200
Subject: [PATCH] Add namespace Matching { to match-related operators (but not
 to the Match type itself)

---
 libwccl/ops/match/actions/markmatch.cpp       |   2 +
 libwccl/ops/match/actions/markmatch.h         |   2 +
 libwccl/ops/match/actions/unmarkmatch.cpp     |   2 +
 libwccl/ops/match/actions/unmarkmatch.h       |   2 +
 libwccl/ops/match/applyoperator.cpp           |   2 +
 libwccl/ops/match/applyoperator.h             |   2 +
 .../ops/match/conditions/conjconditions.cpp   |   2 +
 libwccl/ops/match/conditions/conjconditions.h |   2 +
 .../ops/match/conditions/isannotatedas.cpp    |   2 +
 libwccl/ops/match/conditions/isannotatedas.h  |   2 +
 libwccl/ops/match/conditions/longest.cpp      |   2 +
 libwccl/ops/match/conditions/longest.h        |   2 +
 libwccl/ops/match/conditions/matchtext.cpp    |   2 +
 libwccl/ops/match/conditions/matchtext.h      |   2 +
 libwccl/ops/match/conditions/oneof.cpp        |   2 +
 libwccl/ops/match/conditions/oneof.h          |   2 +
 .../ops/match/conditions/optionalmatch.cpp    |   2 +
 libwccl/ops/match/conditions/optionalmatch.h  |   2 +
 .../ops/match/conditions/repeatedmatch.cpp    |   2 +
 libwccl/ops/match/conditions/repeatedmatch.h  |   2 +
 .../ops/match/conditions/tokencondition.cpp   |   2 +
 libwccl/ops/match/conditions/tokencondition.h |   2 +
 libwccl/ops/match/matchaction.h               |   2 +
 libwccl/ops/match/matchcondition.h            |   2 +
 libwccl/ops/match/matchresult.h               |   2 +
 libwccl/ops/matchrule.cpp                     |   2 +
 libwccl/ops/matchrule.h                       |   4 +-
 libwccl/ops/matchrulesequence.cpp             |   2 +
 libwccl/ops/matchrulesequence.h               |   2 +
 libwccl/parser/Parser.cpp                     |   6 +-
 libwccl/parser/Parser.h                       |   4 +-
 libwccl/parser/grammar.g                      | 130 +++++++++---------
 libwccl/wcclfile.cpp                          |   4 +-
 libwccl/wcclfile.h                            |  14 +-
 swig/matchrule.i                              |   3 +
 swig/matchrulesequence.i                      |   9 +-
 swig/wcclfile.i                               |   4 +-
 37 files changed, 149 insertions(+), 85 deletions(-)

diff --git a/libwccl/ops/match/actions/markmatch.cpp b/libwccl/ops/match/actions/markmatch.cpp
index e805151..2a113ab 100644
--- a/libwccl/ops/match/actions/markmatch.cpp
+++ b/libwccl/ops/match/actions/markmatch.cpp
@@ -5,6 +5,7 @@
 
 
 namespace Wccl {
+namespace Matching {
 
 void MarkMatch::execute(const ActionExecContext& context) const
 {
@@ -81,4 +82,5 @@ std::ostream& MarkMatch::write_to(std::ostream& os) const
 	return os;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/actions/markmatch.h b/libwccl/ops/match/actions/markmatch.h
index 9a2a8c0..514ec19 100644
--- a/libwccl/ops/match/actions/markmatch.h
+++ b/libwccl/ops/match/actions/markmatch.h
@@ -5,6 +5,7 @@
 #include <libwccl/ops/function.h>
 
 namespace Wccl {
+namespace Matching {
 
 class MarkMatch : public MatchAction
 {
@@ -82,6 +83,7 @@ private:
 	const std::string chan_name_;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_ACTIONS_MARKMATCH_H
diff --git a/libwccl/ops/match/actions/unmarkmatch.cpp b/libwccl/ops/match/actions/unmarkmatch.cpp
index 3f0a8ef..7e7926e 100644
--- a/libwccl/ops/match/actions/unmarkmatch.cpp
+++ b/libwccl/ops/match/actions/unmarkmatch.cpp
@@ -5,6 +5,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 void UnmarkMatch::execute(const ActionExecContext& context) const
 {
@@ -50,4 +51,5 @@ std::ostream& UnmarkMatch::write_to(std::ostream& os) const
 	return os << name() << "(" << *match_ << ", \"" << chan_name_ << "\")";
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/actions/unmarkmatch.h b/libwccl/ops/match/actions/unmarkmatch.h
index 1f1071a..9d074fb 100644
--- a/libwccl/ops/match/actions/unmarkmatch.h
+++ b/libwccl/ops/match/actions/unmarkmatch.h
@@ -5,6 +5,7 @@
 #include <libwccl/ops/function.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Action to unmark (delete) an annotation passing through a first
@@ -53,6 +54,7 @@ private:
 	const std::string chan_name_;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_ACTIONS_UNMARKMATCH_H
diff --git a/libwccl/ops/match/applyoperator.cpp b/libwccl/ops/match/applyoperator.cpp
index edcefc0..2d4ad49 100644
--- a/libwccl/ops/match/applyoperator.cpp
+++ b/libwccl/ops/match/applyoperator.cpp
@@ -5,6 +5,7 @@
 #include <libpwrutils/foreach.h>
 
 namespace Wccl {
+namespace Matching {
 
 ApplyOperator::ApplyOperator(
 	const VariableAccessor<Match>& matches,
@@ -103,4 +104,5 @@ std::ostream& ApplyOperator::write_to(std::ostream &ostream) const
 	return ostream;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/applyoperator.h b/libwccl/ops/match/applyoperator.h
index f685c72..014ecc3 100644
--- a/libwccl/ops/match/applyoperator.h
+++ b/libwccl/ops/match/applyoperator.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/functions/bool/predicates/logicalpredicate.h>
 
 namespace Wccl {
+namespace Matching {
 
 class ConjConditions;
 class MatchAction;
@@ -62,6 +63,7 @@ private:
 	const boost::shared_ptr<const std::vector<boost::shared_ptr<Function<Bool> > > > apply_conditions_;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_APPLYOPERATOR_H
diff --git a/libwccl/ops/match/conditions/conjconditions.cpp b/libwccl/ops/match/conditions/conjconditions.cpp
index 11b1c14..c144716 100644
--- a/libwccl/ops/match/conditions/conjconditions.cpp
+++ b/libwccl/ops/match/conditions/conjconditions.cpp
@@ -4,6 +4,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 ConjConditions::ConjConditions(const std::vector< boost::shared_ptr<const MatchCondition> >& conditions)
 	: _conditions(conditions)
@@ -55,4 +56,5 @@ std::ostream& ConjConditions::write_to(std::ostream &ostream) const
 	return ostream;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/conjconditions.h b/libwccl/ops/match/conditions/conjconditions.h
index d2df5c4..ef5104b 100644
--- a/libwccl/ops/match/conditions/conjconditions.h
+++ b/libwccl/ops/match/conditions/conjconditions.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/match/matchcondition.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class that wraps a vector of match conditions to act as
@@ -44,6 +45,7 @@ private:
 	const std::vector<boost::shared_ptr<const MatchCondition> > _conditions;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_CONJCONDITIONS_H
diff --git a/libwccl/ops/match/conditions/isannotatedas.cpp b/libwccl/ops/match/conditions/isannotatedas.cpp
index 7d568ac..433df1e 100644
--- a/libwccl/ops/match/conditions/isannotatedas.cpp
+++ b/libwccl/ops/match/conditions/isannotatedas.cpp
@@ -2,6 +2,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 MatchResult IsAnnotatedAs::apply(const ActionExecContext& context) const
 {
@@ -55,4 +56,5 @@ std::ostream& IsAnnotatedAs::write_to(std::ostream& os) const
 	return os << name() << "(\"" << chan_name_ << "\")";
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/isannotatedas.h b/libwccl/ops/match/conditions/isannotatedas.h
index f2dcfbb..e40fbd0 100644
--- a/libwccl/ops/match/conditions/isannotatedas.h
+++ b/libwccl/ops/match/conditions/isannotatedas.h
@@ -5,6 +5,7 @@
 #include <libwccl/ops/function.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * is() match condition - matches an annotation
@@ -46,6 +47,7 @@ private:
 	const std::string chan_name_;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_ISANNOTATEDAS_H
diff --git a/libwccl/ops/match/conditions/longest.cpp b/libwccl/ops/match/conditions/longest.cpp
index 82a3653..e1a5405 100644
--- a/libwccl/ops/match/conditions/longest.cpp
+++ b/libwccl/ops/match/conditions/longest.cpp
@@ -4,6 +4,7 @@
 #include <libpwrutils/foreach.h>
 
 namespace Wccl {
+namespace Matching {
 
 Longest::Longest(const boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > >& variants)
 	: _variants(variants)
@@ -58,4 +59,5 @@ std::ostream& Longest::write_to(std::ostream& ostream) const
 	return ostream << ")";
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/longest.h b/libwccl/ops/match/conditions/longest.h
index 008b507..070738f 100644
--- a/libwccl/ops/match/conditions/longest.h
+++ b/libwccl/ops/match/conditions/longest.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/match/conditions/conjconditions.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class for "longest" condition of match
@@ -47,6 +48,7 @@ protected:
 private:
 	const boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > > _variants;
 };
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_LONGEST_H
diff --git a/libwccl/ops/match/conditions/matchtext.cpp b/libwccl/ops/match/conditions/matchtext.cpp
index 2d01ee5..6bad997 100644
--- a/libwccl/ops/match/conditions/matchtext.cpp
+++ b/libwccl/ops/match/conditions/matchtext.cpp
@@ -4,6 +4,7 @@
 
 
 namespace Wccl {
+namespace Matching {
 
 MatchResult MatchText::apply(const ActionExecContext& context) const
 {
@@ -46,4 +47,5 @@ std::ostream& MatchText::write_to(std::ostream& os) const
 	return os << name() << "(\"" << PwrNlp::to_utf8(text_) << "\")";
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/matchtext.h b/libwccl/ops/match/conditions/matchtext.h
index f565540..6a6805a 100644
--- a/libwccl/ops/match/conditions/matchtext.h
+++ b/libwccl/ops/match/conditions/matchtext.h
@@ -6,6 +6,7 @@
 #include <unicode/unistr.h>
 
 namespace Wccl {
+namespace Matching {
 /**
  * text() match condition - matches a text
  */
@@ -46,6 +47,7 @@ private:
 	const UnicodeString text_;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_MATCHTEXT_H
diff --git a/libwccl/ops/match/conditions/oneof.cpp b/libwccl/ops/match/conditions/oneof.cpp
index 068b04a..6871e84 100644
--- a/libwccl/ops/match/conditions/oneof.cpp
+++ b/libwccl/ops/match/conditions/oneof.cpp
@@ -4,6 +4,7 @@
 #include <libpwrutils/foreach.h>
 
 namespace Wccl {
+namespace Matching {
 
 OneOf::OneOf(const boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > >& variants)
 	: _variants(variants)
@@ -51,4 +52,5 @@ std::ostream& OneOf::write_to(std::ostream& ostream) const
 	return ostream << ")";
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/oneof.h b/libwccl/ops/match/conditions/oneof.h
index a0d649a..da6fc51 100644
--- a/libwccl/ops/match/conditions/oneof.h
+++ b/libwccl/ops/match/conditions/oneof.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/match/conditions/conjconditions.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class for "oneof" condition of match
@@ -46,6 +47,7 @@ protected:
 private:
 	const boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > > _variants;
 };
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_ONEOF_H
diff --git a/libwccl/ops/match/conditions/optionalmatch.cpp b/libwccl/ops/match/conditions/optionalmatch.cpp
index 0311689..235fcc1 100644
--- a/libwccl/ops/match/conditions/optionalmatch.cpp
+++ b/libwccl/ops/match/conditions/optionalmatch.cpp
@@ -3,6 +3,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 OptionalMatch::OptionalMatch(const boost::shared_ptr<ConjConditions>& conditions)
 	: _conditions(conditions)
@@ -33,4 +34,5 @@ std::ostream& OptionalMatch::write_to(std::ostream& ostream) const
 	return ostream << name() << *_conditions;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/optionalmatch.h b/libwccl/ops/match/conditions/optionalmatch.h
index 97dfb07..beba430 100644
--- a/libwccl/ops/match/conditions/optionalmatch.h
+++ b/libwccl/ops/match/conditions/optionalmatch.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/match/conditions/conjconditions.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class for "optional" condition of match
@@ -47,6 +48,7 @@ protected:
 private:
 	const boost::shared_ptr<ConjConditions> _conditions;
 };
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_OPTIONALMATCH_H
diff --git a/libwccl/ops/match/conditions/repeatedmatch.cpp b/libwccl/ops/match/conditions/repeatedmatch.cpp
index f2fad5b..f5d71cb 100644
--- a/libwccl/ops/match/conditions/repeatedmatch.cpp
+++ b/libwccl/ops/match/conditions/repeatedmatch.cpp
@@ -3,6 +3,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 RepeatedMatch::RepeatedMatch(const boost::shared_ptr<ConjConditions>& conditions)
 	: _conditions(conditions)
@@ -40,4 +41,5 @@ std::ostream& RepeatedMatch::write_to(std::ostream& ostream) const
 	return ostream << name() << *_conditions;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/repeatedmatch.h b/libwccl/ops/match/conditions/repeatedmatch.h
index 1d8764e..618945d 100644
--- a/libwccl/ops/match/conditions/repeatedmatch.h
+++ b/libwccl/ops/match/conditions/repeatedmatch.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/match/conditions/conjconditions.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class for "repeat" condition of match
@@ -49,6 +50,7 @@ private:
 	const boost::shared_ptr<ConjConditions> _conditions;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_REPEATEDMATCH_H
diff --git a/libwccl/ops/match/conditions/tokencondition.cpp b/libwccl/ops/match/conditions/tokencondition.cpp
index 533a2ab..06efcdf 100644
--- a/libwccl/ops/match/conditions/tokencondition.cpp
+++ b/libwccl/ops/match/conditions/tokencondition.cpp
@@ -2,6 +2,7 @@
 #include <libwccl/values/tokenmatch.h>
 
 namespace Wccl {
+namespace Matching {
 
 TokenCondition::TokenCondition(const boost::shared_ptr<Function<Bool> >& predicate)
 	: _predicate(predicate)
@@ -39,4 +40,5 @@ std::ostream& TokenCondition::write_to(std::ostream& os) const
 	return os << *_predicate;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/match/conditions/tokencondition.h b/libwccl/ops/match/conditions/tokencondition.h
index cc86a27..53d0432 100644
--- a/libwccl/ops/match/conditions/tokencondition.h
+++ b/libwccl/ops/match/conditions/tokencondition.h
@@ -5,6 +5,7 @@
 #include <libwccl/ops/function.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class for conditions of MatchOperator that operate on tokens,
@@ -42,6 +43,7 @@ private:
 	const boost::shared_ptr< const Function<Bool> > _predicate;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_CONDITIONS_TOKENCODITION_H
diff --git a/libwccl/ops/match/matchaction.h b/libwccl/ops/match/matchaction.h
index 115e5b1..527747e 100644
--- a/libwccl/ops/match/matchaction.h
+++ b/libwccl/ops/match/matchaction.h
@@ -5,6 +5,7 @@
 #include <libwccl/ops/actionexeccontext.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Abstract base class for actions in WCCL match rules
@@ -22,6 +23,7 @@ public:
 	virtual void execute(const ActionExecContext& context) const = 0;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_MATCHACTION_H
diff --git a/libwccl/ops/match/matchcondition.h b/libwccl/ops/match/matchcondition.h
index 3b48506..12dde83 100644
--- a/libwccl/ops/match/matchcondition.h
+++ b/libwccl/ops/match/matchcondition.h
@@ -6,6 +6,7 @@
 #include <libwccl/ops/match/matchresult.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Abstract base class for conditions of MatchOperator
@@ -25,6 +26,7 @@ public:
 	virtual MatchResult apply(const ActionExecContext& context) const = 0;
 };
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_MATCHCONDITION_H
diff --git a/libwccl/ops/match/matchresult.h b/libwccl/ops/match/matchresult.h
index a8b0745..c4e2a05 100644
--- a/libwccl/ops/match/matchresult.h
+++ b/libwccl/ops/match/matchresult.h
@@ -5,6 +5,7 @@
 #include <libwccl/values/match.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Class that represents a result of MatchCondition
@@ -73,6 +74,7 @@ boost::shared_ptr<Match> MatchResult::get_match() const {
 	return _match;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCH_MATCHRESULT_H
diff --git a/libwccl/ops/matchrule.cpp b/libwccl/ops/matchrule.cpp
index cb4b8b3..fc89922 100644
--- a/libwccl/ops/matchrule.cpp
+++ b/libwccl/ops/matchrule.cpp
@@ -5,6 +5,7 @@
 #include <sstream>
 
 namespace Wccl {
+namespace Matching {
 
 void MatchRule::apply(const boost::shared_ptr<Corpus2::AnnotatedSentence>& s)
 {
@@ -34,4 +35,5 @@ std::ostream& MatchRule::write_to(std::ostream& os) const
 	return os << *apply_;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
diff --git a/libwccl/ops/matchrule.h b/libwccl/ops/matchrule.h
index 290590e..f029d67 100644
--- a/libwccl/ops/matchrule.h
+++ b/libwccl/ops/matchrule.h
@@ -5,9 +5,10 @@
 #include <libcorpus2/ann/annotatedsentence.h>
 
 namespace Wccl {
+class SentenceContext;
 
+namespace Matching {
 class ApplyOperator;
-class SentenceContext;
 
 class MatchRule : public ParsedExpression
 {
@@ -201,6 +202,7 @@ boost::shared_ptr<MatchRule> MatchRule::clone_clean_ptr() const {
 	return copy;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
 #endif // LIBWCCL_OPS_MATCHRULE_H
diff --git a/libwccl/ops/matchrulesequence.cpp b/libwccl/ops/matchrulesequence.cpp
index eec6e42..45f3101 100644
--- a/libwccl/ops/matchrulesequence.cpp
+++ b/libwccl/ops/matchrulesequence.cpp
@@ -2,6 +2,7 @@
 #include <libpwrutils/foreach.h>
 
 namespace Wccl {
+namespace Matching {
 
 void MatchRuleSequence::apply_all(const boost::shared_ptr<Corpus2::AnnotatedSentence>& sentence)
 {
@@ -42,5 +43,6 @@ std::ostream& MatchRuleSequence::write_to(std::ostream &os) const
 	return os;
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
 
diff --git a/libwccl/ops/matchrulesequence.h b/libwccl/ops/matchrulesequence.h
index db908a1..1b94aa0 100644
--- a/libwccl/ops/matchrulesequence.h
+++ b/libwccl/ops/matchrulesequence.h
@@ -4,6 +4,7 @@
 #include <libwccl/ops/matchrule.h>
 
 namespace Wccl {
+namespace Matching {
 
 /**
  * Represents a sequence of parsed WCCL Match rules. It's a conveniency wrapper around
@@ -78,5 +79,6 @@ void MatchRuleSequence::operator()(const boost::shared_ptr<Corpus2::AnnotatedSen
 	apply_all(sentence);
 }
 
+} /* end ns Matching */
 } /* end ns Wccl */
 #endif // LIBWCCL_OPS_MATCHRULESEQUENCE_H
diff --git a/libwccl/parser/Parser.cpp b/libwccl/parser/Parser.cpp
index 8086cb2..75b694b 100644
--- a/libwccl/parser/Parser.cpp
+++ b/libwccl/parser/Parser.cpp
@@ -514,7 +514,7 @@ boost::shared_ptr<TagRule> Parser::parseSingleRule(
  * @arg istr input stream with writed rule
  * @return the parsed rule via a shared pointer
  */
-boost::shared_ptr<MatchRule> Parser::parseMatchRule(
+boost::shared_ptr<Matching::MatchRule> Parser::parseMatchRule(
 		const std::string& str) const
 {
 	std::stringstream ss (std::stringstream::in | std::stringstream::out);
@@ -533,11 +533,11 @@ boost::shared_ptr<MatchRule> Parser::parseMatchRule(
  * @arg istr input stream with writed rule
  * @return the parsed rule via a shared pointer
  */
-boost::shared_ptr<MatchRule> Parser::parseMatchRule(std::istream& istr) const
+boost::shared_ptr<Matching::MatchRule> Parser::parseMatchRule(std::istream& istr) const
 {
 	ANTLRLexer lexer(istr);
 	ANTLRParser parser(lexer);
-	boost::shared_ptr<MatchRule> res;
+	boost::shared_ptr<Matching::MatchRule> res;
 
 	try {
 		res = parser.parse_match_rule(tagset_);
diff --git a/libwccl/parser/Parser.h b/libwccl/parser/Parser.h
index 09969a2..bdc0a5e 100644
--- a/libwccl/parser/Parser.h
+++ b/libwccl/parser/Parser.h
@@ -87,9 +87,9 @@ public:
 
 	// ---------------------------------------------------------------------------
 	// Parsing match rule from input string
-	boost::shared_ptr<MatchRule>
+	boost::shared_ptr<Matching::MatchRule>
 			parseMatchRule(const std::string& rule_string) const;
-	boost::shared_ptr<MatchRule>
+	boost::shared_ptr<Matching::MatchRule>
 			parseMatchRule(std::istream& is) const;
 
 	// ---------------------------------------------------------------------------
diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g
index c073e68..bde2a62 100644
--- a/libwccl/parser/grammar.g
+++ b/libwccl/parser/grammar.g
@@ -278,10 +278,10 @@ parse_tag_rule_sequence
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // Rule for parsing the match rules
-// Returns boost::shared_ptr<MatchRule>
+// Returns boost::shared_ptr<Matching::MatchRule>
 parse_match_rule
 	[const Corpus2::Tagset& tagset]
-	returns [boost::shared_ptr<MatchRule> ret_match]
+	returns [boost::shared_ptr<Matching::MatchRule> ret_match]
 {
 	Lexicons empty_lex;
 	ParsingScope scope(tagset, empty_lex);
@@ -1973,7 +1973,7 @@ symset_empty
 
 //----------------------------------------------------------------------------
 // Strset empty() operator
-// Returns boost::shared_ptr<Function<Bool> > 
+// Returns boost::shared_ptr<Function<Bool> >
 strset_empty
 	[ParsingScope& scope]
 	returns [boost::shared_ptr<Function<Bool> > op]
@@ -2079,8 +2079,8 @@ tag_rules_section [WcclFile& wccl_file]
 match_rules_section [WcclFile& wccl_file]
 {
 	ParsingScope scope(wccl_file);
-	boost::shared_ptr<MatchRule> match_rule;
-	boost::shared_ptr<MatchRuleSequence> rule_seq = boost::make_shared<MatchRuleSequence>();
+	boost::shared_ptr<Matching::MatchRule> match_rule;
+	boost::shared_ptr<Matching::MatchRuleSequence> rule_seq = boost::make_shared<Matching::MatchRuleSequence>();
 }
 	: "match_rules" {
 		if (wccl_file.has_match_rules()) {
@@ -2484,30 +2484,30 @@ action_unmark
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // Match rules
-// Returns boost::shared_ptr<MatchRule>
+// Returns boost::shared_ptr<Matching::MatchRule>
 match_rule_operator
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<MatchRule> ret_op]
+	returns [boost::shared_ptr<Matching::MatchRule> ret_op]
 {
-	boost::shared_ptr<ApplyOperator> apply;
+	boost::shared_ptr<Matching::ApplyOperator> apply;
 	scope.variables().get_put<Match>("_M");
 }
 	: apply = match_apply_operator [scope] {
-		ret_op = boost::make_shared<MatchRule>(scope.variables(), apply);
+		ret_op = boost::make_shared<Matching::MatchRule>(scope.variables(), apply);
 	}
 ;
 
 // Match apply operator:
 // 	apply(match(), cond(conditions), actions(actions)) 
 // 	apply(match(), actions(actions))
-// Returns boost::shared_ptr<ApplyOperator>
+// Returns boost::shared_ptr<Matching::ApplyOperator>
 match_apply_operator
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<ApplyOperator> ret_op]
+	returns [boost::shared_ptr<Matching::ApplyOperator> ret_op]
 {
 	VariableAccessor<Match> matches = scope.variables().create_accessor<Match>("_M");;
-	boost::shared_ptr<ConjConditions> match_cond;
-	boost::shared_ptr<std::vector<boost::shared_ptr<MatchAction> > > actions;
+	boost::shared_ptr<Matching::ConjConditions> match_cond;
+	boost::shared_ptr<std::vector<boost::shared_ptr<Matching::MatchAction> > > actions;
 	boost::shared_ptr<std::vector<boost::shared_ptr<Function<Bool> > > > conditions;
 }
 	: "apply" LPAREN 
@@ -2517,12 +2517,12 @@ match_apply_operator
 		RPAREN {
 			if (conditions) {
 				ret_op.reset(
-					new ApplyOperator(matches, match_cond, actions, conditions)
+					new Matching::ApplyOperator(matches, match_cond, actions, conditions)
 				);
 			}
 			else {
 				ret_op.reset(
-					new ApplyOperator(matches, match_cond, actions)
+					new Matching::ApplyOperator(matches, match_cond, actions)
 				);
 			}
 		}
@@ -2531,22 +2531,22 @@ match_apply_operator
 // Match conditions. Wrapper for vector of the match conditions
 match_condition
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<ConjConditions> condition]
+	returns [boost::shared_ptr<Matching::ConjConditions> condition]
 {
-	std::vector<boost::shared_ptr<const MatchCondition> > m_cond;
+	std::vector<boost::shared_ptr<const Matching::MatchCondition> > m_cond;
 }
 	: m_cond = match_condition_in [scope] {
-		condition.reset(new ConjConditions(m_cond));
+		condition.reset(new Matching::ConjConditions(m_cond));
 	}
 ;
 
 // Match conditions.
-// Retutns std::vector< boost::shared_ptr<const MatchCondition> >
+// Retutns std::vector< boost::shared_ptr<const Matching::MatchCondition> >
 match_condition_in
 	[ParsingScope& scope]
-	returns [std::vector< boost::shared_ptr<const MatchCondition> > ret]
+	returns [std::vector< boost::shared_ptr<const Matching::MatchCondition> > ret]
 {
-	boost::shared_ptr<const MatchCondition> r_cond;
+	boost::shared_ptr<const Matching::MatchCondition> r_cond;
 }
 	: r_cond = match_cond_all[scope] {
 		ret.push_back(r_cond);
@@ -2560,14 +2560,14 @@ match_condition_in
 ;
 
 // Match variants variant(v1), variant(v2), ...
-// Retutns boost::shared_ptr<std::vector<ConjConditions> >
+// Retutns boost::shared_ptr<std::vector<Matching::ConjConditions> >
 match_variants
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > > variants]
+	returns [boost::shared_ptr<std::vector<boost::shared_ptr<Matching::ConjConditions> > > variants]
 {
-	variants.reset(new std::vector<boost::shared_ptr<ConjConditions> >());
+	variants.reset(new std::vector<boost::shared_ptr<Matching::ConjConditions> >());
 
-	boost::shared_ptr<ConjConditions> variant;
+	boost::shared_ptr<Matching::ConjConditions> variant;
 }
 	: "variant" LPAREN variant = match_condition [scope] RPAREN {
 		variants->push_back(variant);
@@ -2580,10 +2580,10 @@ match_variants
 ;
 
 // One of the match condition
-// Returns boost::shared_ptr<const MatchCondition>
+// Returns boost::shared_ptr<const Matching::MatchCondition>
 match_cond_all
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<const MatchCondition> ret]
+	returns [boost::shared_ptr<const Matching::MatchCondition> ret]
 	: ret = match_cond_optional [scope]
 	| ret = match_cond_repeate  [scope]
 	| ret = match_cond_token    [scope]
@@ -2594,96 +2594,96 @@ match_cond_all
 ;
 
 // Match condition - token (wraps a L0 predicate)
-// Returns boost::shared_ptr<const MatchCondition>
+// Returns boost::shared_ptr<const Matching::MatchCondition>
 match_cond_token
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<const TokenCondition> ret]
+	returns [boost::shared_ptr<const Matching::TokenCondition> ret]
 {
 	boost::shared_ptr<Function<Bool> > bool_op;
 }
 	: bool_op = bool_operator [scope] {
-		ret = boost::make_shared<TokenCondition>(bool_op);
+		ret = boost::make_shared<Matching::TokenCondition>(bool_op);
 	}
 ;
 
 
  // Match condition - optional
-// Returns boost::shared_ptr<OptionalMatch>
+// Returns boost::shared_ptr<Matching::OptionalMatch>
 match_cond_optional
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<OptionalMatch> mtch]
+	returns [boost::shared_ptr<Matching::OptionalMatch> mtch]
 {
-	boost::shared_ptr<ConjConditions> m_cond;
+	boost::shared_ptr<Matching::ConjConditions> m_cond;
 }
 	: "optional" LPAREN m_cond = match_condition [scope] RPAREN {
-		mtch.reset(new OptionalMatch(m_cond));
+		mtch.reset(new Matching::OptionalMatch(m_cond));
 	}
 ;
 
 // Match condition - repeat
-// Returns boost::shared_ptr<RepeatedMatch>
+// Returns boost::shared_ptr<Matching::RepeatedMatch>
 match_cond_repeate
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<RepeatedMatch> mtch]
+	returns [boost::shared_ptr<Matching::RepeatedMatch> mtch]
 {
-	boost::shared_ptr<ConjConditions> m_cond;
+	boost::shared_ptr<Matching::ConjConditions> m_cond;
 }
 	: "repeat" LPAREN m_cond = match_condition [scope] RPAREN {
-		mtch.reset(new RepeatedMatch(m_cond));
+		mtch.reset(new Matching::RepeatedMatch(m_cond));
 	}
 ;
 
 // Match condition - is(ann_name)
-// Returns boost::shared_ptr<IsAnnotatedAs>
+// Returns boost::shared_ptr<Matching::IsAnnotatedAs>
 match_cond_is
-	returns [boost::shared_ptr<IsAnnotatedAs> mtch]
+	returns [boost::shared_ptr<Matching::IsAnnotatedAs> mtch]
 	: "is" LPAREN annotation_name: STRING RPAREN {
-		mtch.reset(new IsAnnotatedAs(token_ref_to_std_string(annotation_name)));
+		mtch.reset(new Matching::IsAnnotatedAs(token_ref_to_std_string(annotation_name)));
 	}
 ;
 
 // Match condition - text(text)
-// Returns boost::shared_ptr<MatchText>
+// Returns boost::shared_ptr<Matching::MatchText>
 match_cond_text
-	returns [boost::shared_ptr<MatchText> mtch]
+	returns [boost::shared_ptr<Matching::MatchText> mtch]
 	: "text" LPAREN txt: STRING RPAREN {
-		mtch.reset(new MatchText(token_ref_to_ustring(txt)));
+		mtch.reset(new Matching::MatchText(token_ref_to_ustring(txt)));
 	}
 ;
 
 // Match condition - oneof(variant1(v1), variant(v2), ...)
-// Returns boost::shared_ptr<OneOf>
+// Returns boost::shared_ptr<Matching::OneOf>
 match_cond_oneof
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<OneOf> onf]
+	returns [boost::shared_ptr<Matching::OneOf> onf]
 {
-	boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > > variants;
+	boost::shared_ptr<std::vector<boost::shared_ptr<Matching::ConjConditions> > > variants;
 }
 	: "oneof" LPAREN variants = match_variants [scope] RPAREN {
-		onf.reset(new OneOf(variants));
+		onf.reset(new Matching::OneOf(variants));
 	}
 ;
 
 // Match condition - longest(variant1(v1), variant(v2), ...)
-// Returns boost::shared_ptr<Longest>
+// Returns boost::shared_ptr<Matching::Longest>
 match_cond_longest
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<Longest> lng]
+	returns [boost::shared_ptr<Matching::Longest> lng]
 {
-	boost::shared_ptr<std::vector<boost::shared_ptr<ConjConditions> > > variants;
+	boost::shared_ptr<std::vector<boost::shared_ptr<Matching::ConjConditions> > > variants;
 }
 	: "longest" LPAREN variants = match_variants [scope] RPAREN {
-		lng.reset(new Longest(variants));
+		lng.reset(new Matching::Longest(variants));
 	}
 ;
 
 // ----------------------------------------------------------------------------
 
 // Match actions. Match action can be mark or unmark
-// Returns boost::shared_ptr<MatchAction>
+// Returns boost::shared_ptr<Matching::MatchAction>
 match_action
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<MatchAction> m_act]
+	returns [boost::shared_ptr<Matching::MatchAction> m_act]
 	: m_act = match_mark_action   [scope]
 	| m_act = match_unmark_action [scope]
 ;
@@ -2692,7 +2692,7 @@ match_action
 // Returns 
 match_mark_action
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<MarkMatch> m_act]
+	returns [boost::shared_ptr<Matching::MarkMatch> m_act]
 {
 	boost::shared_ptr<Function<Match> > match_to;
 	boost::shared_ptr<Function<Match> > match_from;
@@ -2707,19 +2707,19 @@ match_mark_action
 		RPAREN {
 			if (!match_to) {
 				m_act.reset(
-					new MarkMatch(
+					new Matching::MarkMatch(
 						match_from,
 						((antlr::Token*)annotation_name)->getText()));
 			} else {
 				if (!head_match) {
 					m_act.reset(
-						new MarkMatch(
+						new Matching::MarkMatch(
 							match_from,
 							match_to,
 							((antlr::Token*)annotation_name)->getText()));
 				} else {
 					m_act.reset(
-						new MarkMatch(
+						new Matching::MarkMatch(
 							match_from,
 							match_to,
 							head_match,
@@ -2730,10 +2730,10 @@ match_mark_action
 ;
 
 // Match unmark action
-// Returns boost::shared_ptr<UnmarkMatch>
+// Returns boost::shared_ptr<Matching::UnmarkMatch>
 match_unmark_action
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<UnmarkMatch> m_act]
+	returns [boost::shared_ptr<Matching::UnmarkMatch> m_act]
 {
 	boost::shared_ptr<Function<Match> > match_at;
 }
@@ -2742,22 +2742,22 @@ match_unmark_action
 				annotation_name : STRING
 			RPAREN {
 				m_act.reset(
-					new UnmarkMatch(
+					new Matching::UnmarkMatch(
 							match_at,
 							((antlr::Token*)annotation_name)->getText()));
 			}
 ;
 
 // Match action separated by comma
-// Returns boost::shared_ptr<std::vector<boost::shared_ptr<MatchAction> > >
+// Returns boost::shared_ptr<std::vector<boost::shared_ptr<Matching::MatchAction> > >
 match_action_comma_sep
 	[ParsingScope& scope]
-	returns [boost::shared_ptr<std::vector<boost::shared_ptr<MatchAction> > > r_vec]
+	returns [boost::shared_ptr<std::vector<boost::shared_ptr<Matching::MatchAction> > > r_vec]
 {
-	boost::shared_ptr<MatchAction> act;
+	boost::shared_ptr<Matching::MatchAction> act;
 
 	r_vec.reset(
-		new std::vector<boost::shared_ptr<MatchAction> >
+		new std::vector<boost::shared_ptr<Matching::MatchAction> >
 	);
 }
 	: act = match_action [scope] {
diff --git a/libwccl/wcclfile.cpp b/libwccl/wcclfile.cpp
index 22cb8ed..132fddf 100644
--- a/libwccl/wcclfile.cpp
+++ b/libwccl/wcclfile.cpp
@@ -36,7 +36,7 @@ boost::shared_ptr<const TagRuleSequence> WcclFile::get_tag_rules_ptr() const
 	return tag_rules_;
 }
 
-boost::shared_ptr<MatchRuleSequence> WcclFile::get_match_rules_ptr()
+boost::shared_ptr<Matching::MatchRuleSequence> WcclFile::get_match_rules_ptr()
 {
 	if (!has_match_rules()) {
 		throw WcclError("There are no match rules.");
@@ -44,7 +44,7 @@ boost::shared_ptr<MatchRuleSequence> WcclFile::get_match_rules_ptr()
 	return match_rules_;
 }
 
-boost::shared_ptr<const MatchRuleSequence> WcclFile::get_match_rules_ptr() const
+boost::shared_ptr<const Matching::MatchRuleSequence> WcclFile::get_match_rules_ptr() const
 {
 	if (!has_match_rules()) {
 		throw WcclError("There are no match rules.");
diff --git a/libwccl/wcclfile.h b/libwccl/wcclfile.h
index e012b58..709ea59 100644
--- a/libwccl/wcclfile.h
+++ b/libwccl/wcclfile.h
@@ -285,17 +285,17 @@ public:
 	 * @returns The match rules section from this WCCL file.
 	 * @throws WcclError if there is no match_rules section.
 	 */
-	const MatchRuleSequence& get_match_rules() const;
+	const Matching::MatchRuleSequence& get_match_rules() const;
 	/**
 	 * @returns The match rules section from this WCCL file.
 	 * @throws WcclError if there is no match_rules section.
 	 */
-	boost::shared_ptr<MatchRuleSequence> get_match_rules_ptr();
+	boost::shared_ptr<Matching::MatchRuleSequence> get_match_rules_ptr();
 	/**
 	 * @returns The match rules section from this WCCL file (const).
 	 * @throws WcclError if there is no match_rules section.
 	 */
-	boost::shared_ptr<const MatchRuleSequence> get_match_rules_ptr() const;
+	boost::shared_ptr<const Matching::MatchRuleSequence> get_match_rules_ptr() const;
 
 	///////////////////////////
 	// Miscelaneous
@@ -324,13 +324,13 @@ public:
 
 	void set_tag_rules(const boost::shared_ptr<TagRuleSequence>& tag_rules);
 	
-	void set_match_rules(const boost::shared_ptr<MatchRuleSequence>& match_rules);
+	void set_match_rules(const boost::shared_ptr<Matching::MatchRuleSequence>& match_rules);
 
 private:
 	std::ostream& write_to(std::ostream& ostream) const;
 	std::vector<boost::shared_ptr<FunctionalOpSequence> > all_sections_;
 	boost::shared_ptr<TagRuleSequence> tag_rules_;
-	boost::shared_ptr<MatchRuleSequence> match_rules_;
+	boost::shared_ptr<Matching::MatchRuleSequence> match_rules_;
 	boost::shared_ptr<Lexicons> lexicons_;
 	const Corpus2::Tagset& tagset_;
 	PwrNlp::PathSearcher<Wccl::FileNotFound> path_;
@@ -627,13 +627,13 @@ bool WcclFile::has_match_rules() const
 }
 
 inline
-const MatchRuleSequence& WcclFile::get_match_rules() const
+const Matching::MatchRuleSequence& WcclFile::get_match_rules() const
 {
 	return *get_match_rules_ptr();
 }
 
 inline
-void WcclFile::set_match_rules(const boost::shared_ptr<MatchRuleSequence>& match_rules)
+void WcclFile::set_match_rules(const boost::shared_ptr<Matching::MatchRuleSequence>& match_rules)
 {
 	if (has_match_rules()) {
 		throw WcclError("Tag rules already added.");
diff --git a/swig/matchrule.i b/swig/matchrule.i
index 41002c6..52165c9 100644
--- a/swig/matchrule.i
+++ b/swig/matchrule.i
@@ -14,6 +14,7 @@
 %include <libcorpus2/boost_shared_ptr.i>
 
 namespace Wccl {
+namespace Matching {
   class MatchRule : public ParsedExpression {
   public:
     MatchRule(
@@ -48,8 +49,10 @@ namespace Wccl {
     std::string to_string(const Corpus2::Tagset& tagset) const;
   };
 }
+}
 
 using namespace std;
 using namespace Wccl;
+using namespace Wccl::Matching;
 
 #endif /* SWIG_LIBWCCL_MATCHRULE_I */
diff --git a/swig/matchrulesequence.i b/swig/matchrulesequence.i
index 73c27e8..f746531 100644
--- a/swig/matchrulesequence.i
+++ b/swig/matchrulesequence.i
@@ -14,11 +14,12 @@
 %include "std_vector.i"
 %include <libcorpus2/boost_shared_ptr.i>
 
-%template(MatchRuleVector) std::vector<Wccl::MatchRule>;
-%template(MatchRuleSequencePtr) boost::shared_ptr<Wccl::MatchRule>;
-%template(ConstMatchRuleSequencePtr) boost::shared_ptr<const Wccl::MatchRule>;
+%template(MatchRuleVector) std::vector<Wccl::Matching::MatchRule>;
+%template(MatchRuleSequencePtr) boost::shared_ptr<Wccl::Matching::MatchRule>;
+%template(ConstMatchRuleSequencePtr) boost::shared_ptr<const Wccl::Matching::MatchRule>;
 
 namespace Wccl {
+namespace Matching {
   class MatchRuleSequence : public std::vector<MatchRule>, public Expression {
   public:
     MatchRuleSequence();
@@ -38,9 +39,11 @@ namespace Wccl {
     std::string to_string(const Corpus2::Tagset& tagset) const;
   };
 }
+}
 
 using namespace boost;
 using namespace Wccl;
 using namespace std;
+using namespace Wccl::Matching;
 
 #endif /* SWIG_LIBWCCL_MATCHRULESEQUENCE_I */
diff --git a/swig/wcclfile.i b/swig/wcclfile.i
index 8e0fe41..f7821d6 100644
--- a/swig/wcclfile.i
+++ b/swig/wcclfile.i
@@ -303,10 +303,10 @@ namespace Wccl {
 
     bool has_match_rules() const;
     
-    const MatchRuleSequence& get_match_rules() const;
+    const Matching::MatchRuleSequence& get_match_rules() const;
 
     // shared_ptr<const MatchRuleSequence> get_match_rules_ptr() const;
-    shared_ptr<MatchRuleSequence> get_match_rules_ptr();
+    shared_ptr<Matching::MatchRuleSequence> get_match_rules_ptr();
 
     /* --------------------------------------------------------------------- */
     /* --------------------------------------------------------------------- */
-- 
GitLab