MerlinofMines / EasyCommands

Github Repository for Ingame Scripts built by MerlinofMines. Uses MDK to Deploy to SpaceEngineerse
GNU General Public License v3.0
8 stars 3 forks source link

Refactor `ParseSeperatorTokens` #166

Closed jgersti closed 2 years ago

jgersti commented 2 years ago

While investigating #159 i found some unneeded code. Instead of first splitting, joining, copying (or rather: constructing a new string from the old ones char array that is cast to a list) and then splitting again, the the first split operation is returned directly. Also the loops to add spaces around the tokens got moved into its own method.

For a few characters more ParseSurrounded, ParseSeperateTokens and the lambda in ParseTokens could return IEnumerator<...> and the toArray calls could be removed. This would make these functions truely lazy and maybe give a small performance boost on the tokenizing step.