Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

modify_effect skips bypassed effects, reports concisely

  • Loading branch information...
commit e859d8ac03a4b7d982b015d079b3a4e1f2848ab5 1 parent c13b876
@bolangi authored
Showing with 11 additions and 4 deletions.
  1. +4 −1 src/Effects.p
  2. +7 −3 src/grammar_body.pl
View
5 src/Effects.p
@@ -171,7 +171,9 @@ sub modify_effect {
my ($op_id, $parameter, $sign, $value) = @_;
# $parameter: zero based
my $cop = $fx->{applied}->{$op_id}
- or print("$op_id: non-existing effect id. Skipping\n"), return;
+ or print("$op_id: non-existing effect id. Skipping.\n"), return;
+ my @dummy = ::is_bypassed($op_id)
+ and say("$op_id: cannot modify bypassed effect. Skipping."), return;
my $code = $cop->{type};
my $i = effect_index($code);
defined $i or croak "undefined effect code for $op_id: ",yaml_out($cop);
@@ -195,6 +197,7 @@ sub modify_effect {
$op_id,
$parameter,
$new_value);
+ 1
}
sub modify_multiple_effects {
my ($op_ids, $parameters, $sign, $value) = @_;
View
10 src/grammar_body.pl
@@ -764,21 +764,25 @@
$item{'parameter(s)'},
undef,
$item{value});
- print ::Text::show_effect($::this_op);
+ print ::Text::show_effect($::this_op)
+ unless my @dummy = ::is_bypassed($::this_op);
1;
}
modify_effect: _modify_effect parameter(s /,/) sign value {
print("Operator \"$::this_op\" does not exist.\n"), return 1
unless ::fx($::this_op);
::modify_multiple_effects( [$::this_op], @item{qw(parameter(s) sign value)});
- print ::Text::show_effect($::this_op);
+ print ::Text::show_effect($::this_op)
+ unless my @dummy = ::is_bypassed($::this_op);
1;
}
modify_effect: _modify_effect op_id(s /,/) parameter(s /,/) value {
::modify_multiple_effects( @item{qw(op_id(s) parameter(s) sign value)});
# note that 'sign' results in undef value
- ::pager(::Text::show_effect(@{ $item{'op_id(s)'} }));
+ ::pager(::Text::show_effect(@{ $item{'op_id(s)'} }))
+ unless scalar @{ $item{'op_id(s)'} } == 1
+ and my @dummy = ::is_bypassed($::this_op);
1;
}
modify_effect: _modify_effect op_id(s /,/) parameter(s /,/) sign value {
Please sign in to comment.
Something went wrong with that request. Please try again.