What line is causing the syntax error?
I already see several problems in your code.
You can't define variables in a package declaration (you should be able to define signals though). Functions can't assign values to signals or variables outside themselves, you could use procedures for that. Variables are reinitialized at each function call, you can't keep a value from one call to another. And you don't call any of the functions, so nothing will be synthesized.
I recommend instead of all those functions to put all your code in a single process. Use a cycle counter and decode your data from there.