parse: Refactor parse node encoding to support full range of small ints.

Based on suggestion by @dpgeorge at
https://github.com/micropython/micropython/pull/313