Please use this site's [noparse]
...
[/noparse] bbcode tags around your code snippets. Not only does it make them easier to read, but it's syntax highlighting may help to see where the problem is. (Using an editor/IDE with syntax highlighting and built-in parse-checking can help a lot, too.)
For parse errors such as "unexpected blah blah blah...", it may be due to an error somewhere in the preceding code, so it's often useful to supply a few lines before the line cited in the error message along with that offending line.