@ Override public void exitIdentifier ( VersionParser . IdentifierContext ctx ) { String postfix = ctx . getText ( ) ; // A numeric postfix cannot have leading zeroes // FIXME: Check to see if an alphanumeric postfix with leading zeroes counts Matcher m = numericHasLeadingZeroes . matcher ( postfix ) ; while ( m . find ( ) ) { postfix = m . replaceAll ( "" ) ; } // Hack to ensure correct parsing by SemanticVersion code. A postfix MUST start with a dash, digit, or letter while ( ! postfix . isEmpty ( ) && ! startsWithDigitLetterOrHyphen . matcher ( postfix ) . find ( ) ) { postfix = postfix . substring ( 1 ) ; } stack . push ( postfix ) ; }
Normalize the postfix to something that semantic version can handle