Allow custom functions to be called from the main window

This also lead to variable/function names now being allowed to
contain digits after the first character.