add fromRangedWord function, and add error message to genVarArgs