The fix is to avoid mixing lexer constructs in a parser rule. Your
phrase
'{' (options {greedy=false;} : .)* '}'
should be recast as a lexer rule like
FBODY: '{' (options {greedy=false;} : .)* '}' ;
Your parser rule becomes
function: 'function' f=ID '(' ID? (',' ID)* ')' FBODY -> ^
(FUNCTION $f);