apcshields / autocomplete-bibtex

Adds Pandoc-style BibTeX citation key autocompletion to autocomplete+ for Atom.
MIT License
44 stars 17 forks source link

Bibtex file with @string preamble crashes parser #104

Open b-studios opened 5 years ago

b-studios commented 5 years ago

I get the following trace when using a bibtex file that contains a @STRING key. Looking at bibtex-lite-worker.js:507 it seems the functionstring() is simply missing.

Uncaught TypeError: this.string is not a function
    at BibtexParser.parse (~/.atom/packages/autocomplete-bibtex/lib/bibtex-lite-worker.js:507)
    at toJSON (~/.atom/packages/autocomplete-bibtex/lib/bibtex-lite-worker.js:524)
    at onmessage (~/.atom/packages/autocomplete-bibtex/lib/bibtex-lite-worker.js:529)
b-studios commented 5 years ago

Here is a test bibtex file:

Conferences:

@string{ProcOf = "Proceedings of the "}
@string{ICFP = ProcOf # "International Conference on Functional Programming"}

Cities:

@string{NewYork = "New York, USA"}

Papers:

@inproceedings{chen03meta-programming,
  author =  {Chiyan Chen and
                    Hongwei Xi},
  title =  {Meta-Programming Through Typeful Code Representation},
  booktitle =  ICFP,
  year =  {2003},
  pages =  {275--286},
  address =  NewYork
}

@inproceedings{loh06open,
  author = {L{\"o}h, Andres and Hinze, Ralf},
  title = {Open data types and open functions},
  booktitle = ProcOf # {international conference on Principles and practice of declarative programming},
  address = NewYork
}
RaghuNaik commented 5 years ago

I am experiencing the same issue. autocomplete-bibtex does like commands like

@String{amj = {Academy of Management Journal}}

in the bib file.

I think that @comment statements are digested by autocomplete-bibtex.

Thanks.