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.

Build error with a comment just before the end of a grammar file

See original GitHub issue

Hi guys! I’m afraid I’ve found a bug.

Last lines in grammar.ne:

...
_ -> %__:?     {% nuller %}
# --- //terminals ---

Build error (I’m using nearley-template btw):

[build] C:\new_projects\extensions\elm-ast\node_modules\nearley\lib\compile.js:25
        for (var i = 0; i < structure.length; i++) {
                                      ^

TypeError: Cannot read property 'length' of undefined
    at Compile (C:\new_projects\extensions\elm-ast\node_modules\nearley\lib\compile.js:25:39)
    at StreamWrapper.<anonymous> (C:\new_projects\extensions\elm-ast\node_modules\nearley\bin\nearleyc.js:57:17)
    at emitNone (events.js:110:20)
    at StreamWrapper.emit (events.js:207:7)
    at finishMaybe (_stream_writable.js:604:14)
    at endWritable (_stream_writable.js:612:3)
    at StreamWrapper.Writable.end (_stream_writable.js:563:5)
    at ReadStream.onend (_stream_readable.js:595:10)
    at Object.onceWrapper (events.js:312:30)
    at emitNone (events.js:110:20)
[build] [nodemon] app crashed - waiting for file changes before starting...

When I delete that last comment from grammar.ne, everything works.

My SW:

  • node -v => v8.8.1
  • npm -v => 5.6.0
  • nearleyc -v => 2.11.1
  • Windows 10

Very nice project, I’ve just found it today and I am trying to write parser for Elm, thanks 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MartinKavikcommented, Feb 13, 2018

@tjvr No, it’s low prio. You can leave it to me, I’ll try to send PR, thanks 😃

0reactions
kachcommented, Feb 13, 2018

\n is how you tell nearley that you are done with the comment. In any case, I think all files should be \n-terminated. If you cat a non-newline-terminated file, it messes up your prompt! (You can configure your editor to do \n-terminate if it doesn’t already.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Compile Error: Expected: End of Statement - VBA ...
The compile error occurs when you try to run the code and VBA identifies that something is missing. Run Time Errors. Runtime errors...
Read more >
Error Explanations for The W3C Markup Validation Service
This error may appear if you are using a bad syntax for your comments, such as "<!invalid comment>" The proper syntax for comments...
Read more >
No grammar constraints (DTD or XML schema) detected for ...
I had to make sure that the "manual" box as well as the "build" box was checked and then do a manual validate...
Read more >
Common Grammar Mistakes: 11 Goofs You Might Know Too ...
It's time to review some common grammar mistakes that damage our credibility. Not normally a fun task, but absolutely necessary.
Read more >
Using [sic] Properly
Sic is a Latin term meaning “thus.” It is used to indicate that something incorrectly written is intentionally being left as it was...
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