Fix syntax hi-lighting for protocol functions

Previous matches for function declaration looked for a `func` keyword
and ended with a }. This search for a closing curly brace caused
functions declared in a protocol to have incorrect syntax hi-lighting.
I have changed the function-declaration and function-result to end at $
to correct the hi-lighting for protocols.

Also fixed a funcition typo.