AUI-1193 Fixing bug with sequences

This is just fixing minor bugs that could happen when looking for a separator, as the code that does this was assuming that separators would always show up on every 2 indexes of the compiled array. But we can actually have 2 separators next to each other, or even 2 tokens without a separator in between. This fixes it by not running this code for sequences and checking all indexes when looking for separators.
Also took the chance to add unit tests for the cases that were fixed.