Use generators
greg0ire opened this issue · 2 comments
The program was written when they did not exist, and it acts on text in a very streamy way (or at least, should). Let's see if we can leverage generators to improve it, be it memory-wise, or just readability-wise: maybe we could get rid of most of the $return .= 'some string'
concatenations.
maybe we could get rid of most of the $return .= 'some string' concatenations.
Won't be possible, there are also occurences of $return = rtrim($return…
Using generators in the code turned out to be too dangerous since we need to look around when taking care of a token, if combined with tokens aware of their neighbors. There is probably some refactoring that can be done here, but generators are probably not going to help as much as I thought they would.