From 0868a5b04776c76d3bac07fb7daa71746cf05b5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl>
Date: Tue, 10 May 2011 12:57:09 +0200
Subject: [PATCH] (swig) Updated wrapper for Wccl::Parser

---
 swig/libcclparser.i | 88 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 5 deletions(-)

diff --git a/swig/libcclparser.i b/swig/libcclparser.i
index 84deead..2fb924a 100644
--- a/swig/libcclparser.i
+++ b/swig/libcclparser.i
@@ -7,8 +7,16 @@
 %}
 
 %include "libcclbool.i"
+%include "libccltset.i"
+%include "libcclstrset.i"
+%include "libcclposition.i"
 %include "libccloperator.i"
-%include "libcorpus/libcorpustagsetmanager.i"
+// %include "libccltagrule.i"
+// %include "libccltagrulesequence.i"
+// %include "libcclmatchrule.i"
+%include "libcclfunctionaloperator.i"
+
+%include "libcorpus/libcorpustagset.i"
 
 %include "std_string.i"
 %include "std_vector.i"
@@ -17,12 +25,82 @@
 namespace Wccl {
   class Parser {
   public:
-    Parser(const Corpus2::Tagset&);
-    ~TagsetManager();
+    explicit Parser(const Corpus2::Tagset&);
+    explicit Parser(const std::string& tagset_name);
+    ~Parser();
+
+    /* --------------------------------------------------------------------- */
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<Operator<StrSet> > 
+      parseStringOperator (const std::string& operator_string) const;
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<Operator<Bool> > 
+      parseBoolOperator (const std::string& operator_string) const;
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<Operator<TSet> > 
+      parseSymSetOperator (const std::string& operator_string) const;
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<Operator<Position> > 
+      parsePositionOperator(const std::string& operator_string) const;
+
+    /* --------------------------------------------------------------------- */
+
+    shared_ptr<FunctionalOperator>  
+      parseAnyOperator(const std::string& operator_string) const;
+
+    /* --------------------------------------------------------------------- */
+    // shared_ptr<TagRuleSequence>
+    //  parseTagRuleSequence(const std::string& rule_string) const;
+
+    // shared_ptr<TagRule>
+    //   parseSingleRule(const std::string& rule_string) const;
+    
+    // boost::shared_ptr<MatchRule>
+    //  parseMatchRule(const std::string& rule_string) const;
+
+/*
+ * NOT IMPLEMENTED YET!
+ * ------------------------------------------------
+    boost::shared_ptr<WcclFile> parseWcclFile(
+        const std::string& file_contents_string,
+        const std::string& search_path = ".") const;
+ */
 
+    /* --------------------------------------------------------------------- */
 
-    // %rename (SharedPtrBoolOperator) boost::shared_ptr<Operator<Bool> >;
-    shared_ptr<Operator<Bool> > parseBoolOperator(const std::string&) const;
+    const Corpus2::Tagset& tagset() const;
   };
 }
 
-- 
GitLab