diff --git a/swig/libcclparser.i b/swig/libcclparser.i index 46f0be74915d752a1f0bede51fdc51ec13af6396..658d57a658cdced8a5b5f4fac2c6599a5d9603ca 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; /* --------------------------------------------------------------------- */