From 36a0d4f53d118e7f6b45cb1ce8fd88e4da86f047 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <pawel.kedzia@pwr.wroc.pl>
Date: Wed, 11 May 2011 17:07:15 +0200
Subject: [PATCH] (swig) Added methods: parseTagRuleSequence, parseSingleRule,
 parseMatchRule, parseWcclFile

---
 swig/libcclparser.i | 71 +++++++++++++++++++++++++++++++--------------
 1 file changed, 49 insertions(+), 22 deletions(-)

diff --git a/swig/libcclparser.i b/swig/libcclparser.i
index 46f0be7..658d57a 100644
--- a/swig/libcclparser.i
+++ b/swig/libcclparser.i
@@ -6,14 +6,10 @@
   #include <libwccl/parser/Parser.h>
 %}
 
-%include "libcclbool.i"
-%include "libccltset.i"
-%include "libcclstrset.i"
-%include "libcclposition.i"
-%include "libccloperator.i"
-// %include "libccltagrule.i"
-// %include "libccltagrulesequence.i"
-// %include "libcclmatchrule.i"
+%include "libccltagrule.i"
+%include "libccltagrulesequence.i"
+%include "libcclmatchrule.i"
+%include "libcclwcclfile.i"
 %include "libcclfunctionaloperator.i"
 
 %include "libcorpus/libcorpustagset.i"
@@ -89,22 +85,53 @@ namespace Wccl {
       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;
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<TagRuleSequence>
+      parseTagRuleSequence(const std::string& rule_string) const;
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    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;
- */
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<MatchRule>
+      parseMatchRule(const std::string& rule_string) const;
+
+    /* --------------------------------------------------------------------- */
+
+    %exception {
+      try {
+        $action
+      } catch (PwrNlp::PwrNlpError &e) {
+        PyErr_SetString(PyExc_IndexError, e.info().c_str());
+        return NULL;
+      }
+    }
+    shared_ptr<WcclFile> parseWcclFile(
+      const std::string& file_contents_string, 
+      const std::string& search_path = ".") const;
 
     /* --------------------------------------------------------------------- */
 
-- 
GitLab