Skip to content

Commit

Permalink
Handle very large hexadecimal number literals correctly
Browse files Browse the repository at this point in the history
Very large decimal number literals, binary number literals and octal
literals are lexed into an INFINITY token (instead of a NUMBER token)
and compiled into `2e308`. That is is supposed to be the case for very
large hexdecimal dumber literals as well, but previously wasn't.

Before:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    NUMBER

After:

    $ node -p 'require("./").tokens(`0x${Array(256 + 1).join("f")}`)[0][0]'
    INFINITY

This commit also cleans up `numberToken` in lexer.coffee a bit.
  • Loading branch information
lydell authored and JimPanic committed Sep 26, 2016
1 parent 54f429b commit 9cfca02
Showing 1 changed file with 35 additions and 24 deletions.
59 changes: 35 additions & 24 deletions lib/coffee-script/lexer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9cfca02

Please sign in to comment.