Skip to content

Commit a5b4d8f

Browse files
committed
fixed failing ci tests
1 parent cf9324b commit a5b4d8f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/matchers.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,29 @@ function term_matcher_constructor(term, acSets)
127127
end
128128

129129
# if the operation is a pow, we have to match also 1/(...)^(...) with negative exponent
130-
if operation(term)==^
131-
function term_matcher_pow(success, data, bindings)
130+
if operation(term) === ^
131+
function pow_term_matcher(success, data, bindings)
132132
!islist(data) && return nothing # if data is not a list, return nothing
133-
!iscall(car(data)) && return nothing # if first element is not a call, return nothing
133+
data = car(data) # from (..., ) to ...
134+
!iscall(data) && return nothing # if first element is not a call, return nothing
134135

135-
result = loop(car(data), bindings, matchers)
136+
result = loop(data, bindings, matchers)
136137
result !== nothing && return success(result, 1)
137138

138139
# if data is of the alternative form 1/(...)^(...), it might match with negative exponent
139-
if (operation(car(data))==/) && arguments(car(data))[1]==1 && iscall(arguments(car(data))[2]) && (operation(arguments(car(data))[2])==^)
140-
denominator = arguments(car(data))[2]
140+
if (operation(data) === /) && isequal(arguments(data)[1], 1) && iscall(arguments(data)[2]) && (operation(arguments(data)[2]) === ^)
141+
denominator = arguments(data)[2]
141142
T = symtype(denominator)
142143
frankestein = Term{T}(^, [arguments(denominator)[1], -arguments(denominator)[2]])
143144
result = loop(frankestein, bindings, matchers)
144145
result !== nothing && return success(result, 1)
145146
end
146147
return nothing
147148
end
148-
return term_matcher_pow
149+
return pow_term_matcher
149150
# if we want to do commutative checks, i.e. call matcher with different order of the arguments
150151
elseif acSets!==nothing && !isa(arguments(term)[1], Segment) && operation(term) in [+, *]
151-
function term_matcher_comm(success, data, bindings)
152+
function commutative_term_matcher(success, data, bindings)
152153
!islist(data) && return nothing # if data is not a list, return nothing
153154
!iscall(car(data)) && return nothing # if first element is not a call, return nothing
154155

@@ -164,7 +165,7 @@ function term_matcher_constructor(term, acSets)
164165
end
165166
return nothing
166167
end
167-
return term_matcher_comm
168+
return commutative_term_matcher
168169
else
169170
function term_matcher(success, data, bindings)
170171
!islist(data) && return nothing # if data is not a list, return nothing

0 commit comments

Comments
 (0)