Skip to content

Commit

Permalink
minor performance improvement for prefix parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Oct 23, 2018
1 parent 6cc60de commit 0ba59d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ for mode ∈ [:expr,:unary,:switch,:args]
if !occursin(prefix,smp)
$(if mode == :expr; quote
if occursin(infix1,smp)
print(qr, RSymReplace(match(infix1,smp).match) * RSymReplace(split(smp,infix1)[end]))
print(qr, RSymReplace(match(infix1,smp).match), RSymReplace(split(smp,infix1)[end]))
smp = ""
else
print(qr, RSymReplace(smp))
Expand All @@ -258,9 +258,9 @@ for mode ∈ [:expr,:unary,:switch,:args]
else
rq = RSymReplace(rq)
end
print(qr, rq * RSymReplace(match(infix2,sp[1]).match))
print(qr, rq, RSymReplace(match(infix2,sp[1]).match))
elseif occursin(infix1,sp[1])
print(qr, RSymReplace(match(infix1,sp[1]).match) * RSymReplace(split(sp[1],infix1)[end]))
print(qr, RSymReplace(match(infix1,sp[1]).match), RSymReplace(split(sp[1],infix1)[end]))
else
print(qr, RSymReplace(sp[1]))
end; end
Expand Down Expand Up @@ -304,7 +304,7 @@ for mode ∈ [:expr,:unary,:switch,:args]
end
!occursin(prefix,smp) && ($(if mode == :expr; quote
if occursin(infix1,smp)
print(qr, RSymReplace(match(infix1,smp).match) * RSymReplace(split(smp,infix1)[end]))
print(qr, RSymReplace(match(infix1,smp).match), RSymReplace(split(smp,infix1)[end]))
smp = ""
else
print(qr, RSymReplace(smp))
Expand Down

0 comments on commit 0ba59d3

Please sign in to comment.