add exception for invalid state and priority

-add exception throwing for invalid state and priority in Parser