Show the invisibles. I bet there is an illegal character (null is a favorite) hiding in one of those lines and it's not showing up on your screen. Or maybe the file has the wrong type of line ends.
My usual tricks here:
1) You might have typed it in right in StackOverflow; try copying this code back into the source and see if it fixes things. Sometimes it's hard to see if you put a ] where a ) or } should be.
2) Comment out all the lines, then uncomment them one at a time until the syntax error reappears. If the syntax error is there when you comment out all the other lines, then ther real problem is upstream.
3) Delete the line in question and a couple lines below and above it. Delete these lines in a single operation; you don't want the bad character to stay around because it was in between two lines that you deleted one at a time. Then retype those lines. Don't paste them back in; that might just paste the problem right back in.