Why returning a function in the output? I believe it's for convenience only.

We should construct `getLexerSymbol` from outside, it's a bit longer but the logic is much clearer.