From 2d1560861e4089acce37e5a7988d116a4dd2442c Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(win7-laptop)> Date: Fri, 29 Apr 2011 19:51:14 +0200 Subject: [PATCH] Add lex() operator to parser grammar. --- libwccl/parser/grammar.g | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index a6c9940..4af6cf5 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> > -- GitLab