Nothing obvious jumps out at me, and no way am I going to go through a nearly 2000-line file line by line to debug it!
That type of error usually means you omitted a closing "}" somewhere or maybe a closing quote for a string literal.
This, however, is a good case for breaking up your code into smaller, more manageable (and modular) files, as debugging a 2000-line long file can be a royal pain in the butt.
PS: To debug yourself, you could try copy-and-pasting each individual function definition into a separate PHP file and load it by itself, to see if you can isolate where the problem is.