GROOVY-7055: Groovysh: fix Hyphen checking breaking entering code

See https://jira.codehaus.org/browse/GROOVY-7055
This one is URGENT, if it cannot be merged into 2.4.0 for one reason or another, consider reverting commits
6101791074aebb264
and
50259524574eb50d
instead.

For reviewer: The code loops over all chars in a line to get a desired number of individual tokens shelll style. The bug is that when only one token is desired, tokenizing stops e.g. at the first hyphen, and the checks after the loop complain hyphens were not closed. The checks are invalid in that case.