I've been over your code several times and I can't see what's causing the 'end' expected error, but I can see a couple of other things you may want to address:
1. You don't need to nil your variables if they are declared local within the scope of a function - when the function exits the variables will be discarded automatically
2. In your first function (isReactor) you use checkReactor both to wrap the peripheral and to store the result of your check on the wrapped device. Since you aren't going back and referencing the wrapped peripheral again it probably isn't technically a problem, but it's good practice not to re-use a variable like that. I'd recommend changing the wrapping variable name to something like tmpReactor or something else that makes sense.
FWIW, I hope that helps
EDIT: semi-

'd
Dragon53535, on 17 September 2014 - 08:12 PM, said:
...
Using return gets out of the function entirely, so setting checkReactor to being nil after returning messes with the lua interpreter
...
Are you sure about that? I'm no expert (by any stretch of the imagination), but my understanding is that when a return is invoked, everything after the return is ignored. However, looking at it, I can see how that might confuse the interpreter if my understanding is incorrect.
EDIT2: The more I look at it, the more Dragon's answer makes sense - it's the only thing I can see that would seem to be the cause. I learned something new today
Edited by Dog, 17 September 2014 - 08:27 PM.