REVIEW: [NX-501] Token Pattern Parser

JIRA: https://issues.sonatype.org/browse/NX-501
Bamboo: http://bamboo.s/browse/NX-OSSF255-1
prefer checkState(..)