Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexer: Input of asterisk (*) throws exception #4575

Closed
richdougherty opened this issue Jun 15, 2017 · 1 comment
Closed

Lexer: Input of asterisk (*) throws exception #4575

richdougherty opened this issue Jun 15, 2017 · 1 comment
Labels

Comments

@richdougherty
Copy link

I'm upgrading the sbt-coffeescript plugin and encountered an error on one of our unit tests. When upgrading from CoffeeScript 1.7.1 to 1.11.0 (I know this isn't the latest version) I noticed that our unit test that extracts line numbers from compile errors was failing. This error also occurs on the online console (version 1.12.6).

When the input to the compile function is * or *whateveryouwanthere then the lexer throws an exception.

TypeError: Cannot read property '0' of undefined
  at Lexer.exports.Lexer.Lexer.literalToken (...lib/coffee-script/lexer.js:550:39)
  at Lexer.exports.Lexer.Lexer.tokenize (...lib/coffee-script/lexer.js:35:203)
  at Object.<anonymous> (...lib/coffee-script/coffee-script.js:63:20)
  at Object.compile (...lib/coffee-script/coffee-script.js:44:19)
  at ../coffee.js:58:46
  at tryToString (fs.js:414:3)
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)

The expected result was an error like Error on line 1: unexpected *.

The lexer handles this properly if the * character is on the start of line 2 instead of line 1.

@GeoffreyBooth
Copy link
Collaborator

Fixed by #4663.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants