diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index a6c9940f62ae39f9bee9d159ca849761526dc0cb..4af6cf5234ac228eff1036a90bdba6d3e030c973 100644 --- a/libwccl/parser/grammar.g +++ b/libwccl/parser/grammar.g @@ -50,6 +50,7 @@ header { #include <libwccl/ops/functions/strset/toupper.h> #include <libwccl/ops/functions/strset/tolower.h> #include <libwccl/ops/functions/strset/getlemmas.h> + #include <libwccl/ops/functions/strset/lextranslator.h> #include <libwccl/ops/functions/tset/agrfilter.h> #include <libwccl/ops/functions/tset/catfilter.h> @@ -975,6 +976,7 @@ strset_operator [ParsingScope& scope] | ret = strset_affix [scope] | ret = strset_var_val [scope] | ret = strset_condition [scope] + | ret = strset_lex [scope] // | LPAREN ret = strset_operator [scope] RPAREN ; @@ -1086,6 +1088,22 @@ strset_condition } ; +strset_lex + [ParsingScope& scope] + returns [boost::shared_ptr<Function<StrSet> > op] +{ + boost::shared_ptr<Function<StrSet> > s; +} + : "lex" LPAREN s = strset_operator [scope] COMMA name : STRING RPAREN + { + op.reset(new LexTranslator( + s, + scope.lexicons().get_ptr(token_ref_to_std_string(name)))); + } + exception catch [WcclError ex] { + throw ParserException(ex.what()); + } +; /////////////////////////////////////////////////////////////////////////////// // Bool operator // Returns boost::shared_ptr<Function<Bool> >