Skip to content

Commit 352b286

Browse files
authored
Merge pull request #1167 from dpvc/fix-fractions
Fix problem with implied multiplication in fraction context, and some typos. (#1166)
2 parents f13935a + 07a3828 commit 352b286

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

lib/Parser/Function.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ sub checkComplexOrMatrix {
214214
my $self = shift;
215215
my $op = $self->{params}[0];
216216
return if ($self->checkArgCount(1));
217-
$self->Error("Function '%s' requires a Complex or Matrixinput", $self->{name})
217+
$self->Error("Function '%s' requires a Complex or Matrix input", $self->{name})
218218
unless $op->isNumber || $op->type eq "Matrix" || $self->context->flag("allowBadFunctionInputs");
219219
$self->{type} = $op->typeRef;
220220
}

macros/contexts/contextExtensions.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ sub create {
104104
#
105105
# would attach the class context::Quaternions::BOP::add to the
106106
# plus sign in our Quaternion setting. If the space operator (' ')
107-
# in your list, and if the original context has it point to an
108-
# operator that is NOT in your list, then that references operator
107+
# is in your list, and if the original context has it point to an
108+
# operator that is NOT in your list, then that referenced operator
109109
# is redirected automatically to 'BOP::Space' in your base context
110110
# package. In our case, we would want to include a definition for
111111
# context::Quaternions::BOP::Space in order to cover that possibility.

macros/contexts/contextFraction.pl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ sub _check {
585585
# This is not a mixed number, so convert to original class and do
586586
# its _check
587587
#
588-
unless ($allowMixedNumbers
588+
unless ($self->{bop} eq 'mixedNum'
589+
&& $allowMixedNumbers
589590
&& $self->extensionClassMatch($self->{lop}, 'INTEGER', 'MINUS')
590591
&& !$self->{lop}{hadParens}
591592
&& $self->extensionClassMatch($self->{rop}, 'FRACTION')
@@ -594,7 +595,13 @@ sub _check {
594595
{
595596
$self->{bop} = $self->{def}{string};
596597
$self->{def} = $context->{operators}{ $self->{bop} };
597-
return $self->mutate->_check;
598+
my $class = $self->{def}{class};
599+
if ($class eq ref($self) || $class =~ m/^context::Fraction::BOP::[Ss]pace$/) {
600+
$self->mutate;
601+
} else {
602+
bless $self, $class;
603+
}
604+
return $self->_check;
598605
}
599606
$self->{type} = $context::Fraction::MIXED;
600607
$self->Error("Mixed numbers are not allowed; you must use a pure fraction")
@@ -611,7 +618,7 @@ sub _check {
611618
}
612619

613620
#
614-
# For when the space operator's space property sends to an
621+
# For when the space operator's string property sends to an
615622
# operator we didn't otherwise subclass.
616623
#
617624
package context::Fraction::BOP::Space;

0 commit comments

Comments
 (0)