FlamingTempura / bibtex-parse

Parse BibTeX to JSON.
MIT License
7 stars 2 forks source link

No location printed for `SyntaxError` #5

Open njzjz opened 3 months ago

njzjz commented 3 months ago

I got SyntaxError below. However, it didn't show the location and my file has over 20000 lines, so I didn't know how to fix it.

SyntaxError: Expected end of input or preamble, entry, string, or comment but "@" found.
    at peg$buildStructuredError (/home/njzjz/codes/blog/node_modules/bibtex-parse/bibtex-parse.js:374:16)

I found in bibtex-parse.js:374, there is a location passed. So I added there

console.log("location:", location);

and I got

location: {
  start: { offset: 694017, line: 12073, column: 1 },
  end: { offset: 694018, line: 12073, column: 2 }
}

This is helpful. I hope the location can be printed by default.