Hi,
your code was prepared with source lines length of 1024 characters (I looked only near "case of" line 51). Use normal Lazarus editor and keep lines reasonably long (<130 characters).
Code highligting suggested thad something [invisible characters but not white spaces] were detected at line 51 and then code completion failed at lines with string literals.
Problem is not related to "case of" with string selector.