diff --git a/libwccl/ops/functions/bool/predicates/nor.h b/libwccl/ops/functions/bool/predicates/nor.h index 8cd592057fe8473a7cad847327609d5815a413d8..7b78471489cb2498ead21d8eef78e14ad134f9f0 100644 --- a/libwccl/ops/functions/bool/predicates/nor.h +++ b/libwccl/ops/functions/bool/predicates/nor.h @@ -21,7 +21,7 @@ public: * @returns Name of the function: "not" */ std::string raw_name() const { - return "not"; + return "nor"; } protected : diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index ce51571464c30328f588d2063ad5c1ec30ec3f79..d36ab6d72319715a36567a503801646c7e4cc2c9 100644 --- a/libwccl/parser/grammar.g +++ b/libwccl/parser/grammar.g @@ -342,14 +342,14 @@ position_variable // realtive position relpos - [Wccl::Variables& vars] + [const Corpus2::Tagset& tagset, Wccl::Variables& vars] returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret] { boost::shared_ptr<Wccl::Function<Wccl::Position> > pos; } : "relpos" LPAREN - pos = op_position [vars] ("+" | "-") ofst: UNSIGNED_INT + pos = op_position [tagset, vars] ("+" | "-") ofst: UNSIGNED_INT RPAREN { ret.reset(new Wccl::RelativePosition( pos, @@ -479,7 +479,7 @@ setvar_body_pos } : ret_acc = position_variable_acc [vars] COMMA - ret_op = op_position [vars] { + ret_op = op_position [tagset, vars] { op.reset(new Wccl::VarSetter<Wccl::Position>(*ret_acc.get(), ret_op)); } ; @@ -584,17 +584,18 @@ condit_sym position_operators [const Corpus2::Tagset& tagset, Wccl::Variables& vars] returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret] - : ret = op_position [vars] + : ret = op_position [tagset, vars] ; // Implementations of symbol set operators: // ---------------------------------------------------------------------------- op_position - [Wccl::Variables& vars] + [const Corpus2::Tagset& tagset, Wccl::Variables& vars] returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > op] : op = position_variable [vars] | op = position_value - | op = relpos [vars] + | op = relpos [tagset, vars] +// | op = condit_position [tagset, vars] ; // ---------------------------------------------------------------------------- @@ -621,7 +622,7 @@ op_orth { boost::shared_ptr<Wccl::Function<Wccl::Position> > pos; } - : "orth" LBRACKET pos = op_position [vars] RBRACKET { + : "orth" LBRACKET pos = op_position [tagset, vars] RBRACKET { ret.reset(new Wccl::GetOrth(pos)); } ; @@ -783,7 +784,7 @@ lpred_nor std::vector<boost::shared_ptr<Wccl::Function<Wccl::Bool> > > > ret_v; } - : "nor" LPAREN ret_v = logical_predicates_comma_sep [tagset, vars] RPAREN { + : "not" LPAREN ret_v = logical_predicates_comma_sep [tagset, vars] RPAREN { op.reset(new Wccl::Nor(ret_v)); } ; @@ -953,6 +954,39 @@ condit_bool } ; +// ---------------------------------------------------------------------------- +// if (Bool, Position, Position) +// ? Position ? Bool : 0 +/* Not implemented yet + */ +/* +condit_position + [const Corpus2::Tagset& tagset, Wccl::Variables& vars] + returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > op] +{ + boost::shared_ptr<Wccl::Function<Wccl::Bool> > test; + boost::shared_ptr<Wccl::Function<Wccl::Bool> > p_true, p_false; +} + : "if" LPAREN test = logical_predicates [tagset, vars] COMMA + p_true = position_operators [tagset, vars] + (COMMA p_false = position_operators [tagset, vars])? + RPAREN { + if (p_false) { + op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true, p_false)); + } + else { + op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true)); + } + } + | Q_MARK + p_true = position_operators [tagset, vars] + Q_MARK + test = logical_predicates [tagset, vars] { + op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true)); + } +; +*/ + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // ANTLR LEXER