Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with implied multiplication in fraction context, and some typos. (#1166) #1167

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Parser/Function.pm
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ sub checkComplexOrMatrix {
my $self = shift;
my $op = $self->{params}[0];
return if ($self->checkArgCount(1));
$self->Error("Function '%s' requires a Complex or Matrixinput", $self->{name})
$self->Error("Function '%s' requires a Complex or Matrix input", $self->{name})
unless $op->isNumber || $op->type eq "Matrix" || $self->context->flag("allowBadFunctionInputs");
$self->{type} = $op->typeRef;
}
Expand Down
4 changes: 2 additions & 2 deletions macros/contexts/contextExtensions.pl
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ sub create {
#
# would attach the class context::Quaternions::BOP::add to the
# plus sign in our Quaternion setting. If the space operator (' ')
# in your list, and if the original context has it point to an
# operator that is NOT in your list, then that references operator
# is in your list, and if the original context has it point to an
# operator that is NOT in your list, then that referenced operator
# is redirected automatically to 'BOP::Space' in your base context
# package. In our case, we would want to include a definition for
# context::Quaternions::BOP::Space in order to cover that possibility.
Expand Down
13 changes: 10 additions & 3 deletions macros/contexts/contextFraction.pl
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ sub _check {
# This is not a mixed number, so convert to original class and do
# its _check
#
unless ($allowMixedNumbers
unless ($self->{bop} eq 'mixedNum'
&& $allowMixedNumbers
&& $self->extensionClassMatch($self->{lop}, 'INTEGER', 'MINUS')
&& !$self->{lop}{hadParens}
&& $self->extensionClassMatch($self->{rop}, 'FRACTION')
Expand All @@ -594,7 +595,13 @@ sub _check {
{
$self->{bop} = $self->{def}{string};
$self->{def} = $context->{operators}{ $self->{bop} };
return $self->mutate->_check;
my $class = $self->{def}{class};
if ($class eq ref($self) || $class =~ m/^context::Fraction::BOP::[Ss]pace$/) {
$self->mutate;
} else {
bless $self, $class;
}
return $self->_check;
}
$self->{type} = $context::Fraction::MIXED;
$self->Error("Mixed numbers are not allowed; you must use a pure fraction")
Expand All @@ -611,7 +618,7 @@ sub _check {
}

#
# For when the space operator's space property sends to an
# For when the space operator's string property sends to an
# operator we didn't otherwise subclass.
#
package context::Fraction::BOP::Space;
Expand Down