question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

compiler fails when no terminating newline

See original GitHub issue
root -> "hello"
#

/home/uri/.npm-global/lib/node_modules/nearley/lib/compile.js:22 for (var i = 0; i < structure.length; i++) { ^

TypeError: Cannot read property ‘length’ of undefined at Compile (/home/uri/.npm-global/lib/node_modules/nearley/lib/compile.js:22:34) at StreamWrapper.<anonymous> (/home/uri/.npm-global/lib/node_modules/nearley/bin/nearleyc.js:50:17) at emitNone (events.js:91:20) at StreamWrapper.emit (events.js:185:7) at finishMaybe (_stream_writable.js:488:14) at endWritable (_stream_writable.js:498:3) at StreamWrapper.Writable.end (_stream_writable.js:463:5) at ReadStream.onend (_stream_readable.js:512:10) at ReadStream.g (events.js:286:16) at emitNone (events.js:91:

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
alyssarosenzweigcommented, Dec 31, 2016

On Sat, Dec 31, 2016 at 03:58:40AM -0800, alex wrote:

I just ran into this error and got totally confused.

I feel that everyone should be ending files with trailing newlines anyway.

Agree with you, although you still shouldn’t rely on that. As a quick fix you could try appending \n to the input of nearleyc… In some cases I did that myself:

See https://github.com/bobbybee/uPresent/blob/master/browser/IDE/ide.js#L15 😃

– You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/Hardmath123/nearley/issues/128#issuecomment-269861930

0reactions
kachcommented, Aug 24, 2017

Closing — nobody else complained about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"No newline at end of file" compiler warning - Stack Overflow
The answer for the "obedient" is "because the C++03 Standard says the behavior of a program not ending in newline is undefined" (paraphrased)....
Read more >
What's the point in adding a new line to the end of a file?
The C standard specifies that a C file should end with a newline (C11, 5.1.1.2, 2.) and that a last line without a...
Read more >
error: no newline at end of file [-Werror,-Wnewline-eof] #5990
Just add a blank line at the end of the file. The standard mandates that a C(++) file needs to have a trailing...
Read more >
No new line at end of file? What does this mean?
cpp:9:2: warning: no newline at end of file. That's not an error. It's just a warning. Open the file in an editor, go...
Read more >
Compiler Error C2001 - Microsoft Learn
In this article. A string constant cannot be continued on a second line unless you do the following: End the first line with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found