Let |Lexer_getNumber| support infinity (issue 5039)

Tentative patch to fix #5039.