Fixed "out of range" bug.

Handle cases where the lexer gives back more tokens than expected.
Added more tests.
Added more tests.
Added check for version end and empty prerelease/metadata.
Checked if string ends with empty set.
Demand that hyphen ranges are surrounded by spaces.
Removed newline.
Use new isEnd function.
Added missing isEnd function.