Fixes some cases where the parsing of call chain fails.
Specifically if there is white-space tailing the last % in the chain,
and if the call is made inside of square brackets.
Thanks for all your work on this @JosephWood2001! I noticed there was still an issue with subroutine calls, so I've fixed that up -- it also gave me an opportunity for some other minor refactoring
Fixes some cases where the parsing of call chain fails. Specifically if there is white-space tailing the last % in the chain, and if the call is made inside of square brackets.