Bypassed bug somewhat. If two parts to a token were found, the Optional

logic was not correct.  Instead of fixing, just returned the Token from
the if statement. Closes #9.
This commit is contained in:
Rob Greene 2018-05-15 22:22:03 -05:00
parent 3f4c47551a
commit 8b8b26258a

View File

@ -102,6 +102,7 @@ public class TokenReader {
next(depth-1)
.filter(t -> opt.get().parts.get(1).equals(t.text))
.orElseThrow(() -> new IOException("Expecting: " + opt.get().parts));
return Optional.of(Token.keyword(line, opt.get()));
}
return Optional.of(opt
.map(kw -> Token.keyword(line, kw))