JavaCC action in token definition

I was wondering if it were possible to hook into JavaCC’s lexer to call a function to check if a character is valid. The reason I am asking is I’m trying to implement something a bit like: TOKEN { …