nickng / bibtex

Basic parser for bibtex
Apache License 2.0
23 stars 8 forks source link

Parsing breaks on JabRef comments #22

Open stmichaelis opened 9 months ago

stmichaelis commented 9 months ago

JabRef for managing BibTeX-libraries can add special settings in @Comment-Entries at the end of the file, e.g. @Comment{jabref-meta: databaseType:biblatex;}. Parsing these breaks with an error unknown string variable: jabref-meta:. While these entries of course are not valid BibTeX, shouldn't comments be accepted "as is"?

nickng commented 9 months ago

Yeah probably, the @comment spec I found was this.

If the entry type is @Comment, [it] is not considered to be the start of an entry. (Actually, the rule is that everything from the @Comment and to the end of line is ignored. The remainder lines of the commented entry is ignored by the first comment mechanism we described; in particular a @Comment does not need to be a valid entry, i.e. it can for example skip comas between two fields).

stmichaelis commented 9 months ago

I would assume the definition in bibtex.y for commententry would need to changed, as longstring expects parsable BibTeX-entries? Unfortunately, I have no idea about yacc to be much of a help here.

stmichaelis commented 5 months ago

My apologies for not getting back to you earlier. I assumed Github would notify me about updates here, seems not to be the case for commits mentioning an issue (or I overlooked it).

Tested the new release and can confirm it works for me.